SQL Server ODBC errors

Hello,

I抦 trying to migrate one of my application to a non-Microsoft world. I choice Sun Java System Active Server Page 4.0.2 for that, my application uses Microsoft SQL Server, so I used one of ODBC driver that came with ChiliSoft to connect it to SQL Server, whenever I test my DSN I get 揟est completed successfully? while very same code works fine on IIS I get following error running on new server:

The page cannot be displayed

There is a problem with the page you are trying to reach and it cannot be displayed.

Please try the following:

* Click the Refresh button, or try again later.

* Open the xx.xx.xx.xx home page, and then look for links to the information you want.

HTTP 500.100 - Internal Server Error - ASP error

Apache/2.0.46 (Red Hat)

Technical Information (for support personnel)

* Error Type:

ADODB.Recordset.1 (0x80004005)

SQLState: 37000 Native Error Code: 16957 [DataDirect][ODBC SQL Server Driver][SQL Server]FOR UPDATE cannot be specified on a READ ONLY cursor. SQLState: 37000 Native Error Code: 8180 [DataDirect][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared.

/OR/Common/Includes/ASP/DataAccess.asp, line 33

* Browser Type:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1

* Page:

GET /OR/OptOut.asp

* Time:

Wednesday, December 27, 2006, 10:10:55 AM

* More information:

Sun ONE Active Server Pages Support

[1529 byte] By [alexusbiza] at [2007-11-26 13:36:10]
# 1

Sounds like an application coding error.

I guess the datadirect driver is being more strict.

It looks like your transaction has been set read only, therefore the for update is invalid.

Best way to check its not an asp/odbc issue is to write a simple bit of code that opens the database and updates the table in question. If that works then you need to correct the application error.

Duncan

Duncan_Berrimana at 2007-7-7 22:20:51 > top of Java-index,Web & Directory Servers,Web Servers...
# 2
this very same application were copy off production server, so application itself is working fine, also I tested same code before uploading to linux server on my local IIS server, it works fine too.where do i need to check that transaction read only?
alexusbiza at 2007-7-7 22:20:51 > top of Java-index,Web & Directory Servers,Web Servers...
# 3

Just because the application works on one platform with all its component layers does not mean you can expect it to work on a different platform unchanged and you should not rule out a bug in the original application. Even if its not a bug in the application you may have found a problem that you need to work around in the application code.

In my experience IIS asp and Sunone ASP are very compatible but if you look through the forum you will find people have found issues and had to make some changes when porting. It is possible the original application took advantage of some feature or bug in IIS asp whether by design or luck and SunOne ASP is just trapping and reporting the error correctly.

In this case the error appears to being reported by the odbc driver so it does not appear to be a problem with asp itself. If the error message is to be believed then it is very clear, you are trying to run a 'for update' select when the transaction has been set read only.

I'd write a simple bit of code that duplicates what the application is trying to do at this point (eg. the same sql statement) and check if it works on it own. You are probably only talking half a dozen lines of code to prove it one way or the other.

I guess it could also be a permissions problem on the database itself. Again the simple test I suggest will prove whether you have the correct permissions set.

As with any application issue like this you need to reproduce the problem in a sample bit of code so that you can diagnose where the problem is.

If it is a bug in your application code then you will need to debug it by tracking through the code until you find the issue.

Duncan

Duncan_Berrimana at 2007-7-7 22:20:51 > top of Java-index,Web & Directory Servers,Web Servers...
# 4
Could that be due some incomparability in driver? Microsoft SQL Server /opt/casp/odbc/direct/lib/YYmsss20.so 5.0 is this a latest driver?
alexusbiza at 2007-7-7 22:20:51 > top of Java-index,Web & Directory Servers,Web Servers...
# 5
it is the latest driver.Duncan
Duncan_Berrimana at 2007-7-7 22:20:51 > top of Java-index,Web & Directory Servers,Web Servers...
# 6
If you search the forum for "sql read only" there are a number of postings which might help.Duncan
Duncan_Berrimana at 2007-7-7 22:20:51 > top of Java-index,Web & Directory Servers,Web Servers...