Mattias Bogeblad wrote:

Hi all,

I'm building an applications soon to be released as an open source project.
We have used castor and we originally wrote it for
the mysql-database. Now we feel the need to support other databases and
first out is Microsoft SQL-Server which castor says it supports.

The code I run is the same as for MySQL but I get the following error:

Nested error: java.sql.SQLException: [Microsoft][SQLServer JDBC
Driver]ResultSet can not re-read row data for column 1.

I have tested on both sql-server 7 and on sql-server 2000 and my
database.xml looks like this:



Hi Matthias,

your promblem looks similar with a 'bug' with the row-cusor in microsofts jdbc-driver for java.
This means: If your statement looks like this "SELECT col1, col2, col3 FROM tbl1", you can
only read the first column in row, then the second and so on. In the case that you read the third
column at first, the driver cant sroll back the row cursor the column 1 & 2 and if you attempt
to read the column 1 or 2 throws the driver the exception above...I have observerd this strange behavior
only with prepared statements


Try this ways the solve your problem..:

- Redefine your OQL-statement
- try a other driver for sql-server

For castor developers:

If castor using prepared staments for sql-server, your statement must look like this:

conn.prepareStatement(
"SELECT col1, col2, col3 FROM tbl1",
ResultSet.TYPE_SCROLL_SENSITIVE, // <--- this change the behavior for the row-cursor...this takes some preformance, but it will work
ResultSet.CONCUR_UPDATABLE
);


Greets
Andre Teubner

PS: excuse my poor english....

----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev




Reply via email to