aspose file tools
The moose likes JDBC and the fly likes MS-SQL Data ResultSet Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "MS-SQL Data ResultSet Problem" Watch "MS-SQL Data ResultSet Problem" New topic
Author

MS-SQL Data ResultSet Problem

Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 154
I am using netbeans ide with MS-SQL 2000 Server. My problem is that

When I am using

Data is shown on command prompt but when i am using rs.first() or rs.Previous() or rs.last() then it shows error on it
com.microsoft.sqlserver.jdbc.SQLServerException: The requested operation is not supported on forward only result sets.

BUT WHEN I CHANGE THE STATEMENT LIKE

com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.

OR WHEN I CHANGE THE STATEMENT LIKE

com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.

OR WHEN I CHANGE THE STATEMENT LIKE

com.microsoft.sqlserver.jdbc.SQLServerException: The requested operation is not supported on forward only result sets.

OR WHEN I CHANGE THE STATEMENT LIKE

com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.

LAST but not least: While using INSERT,UPDATE,DELETE cnn.createStatement() is working perfectly.

I am using following jar files
sqljdbc4.jar
jtds-1.2.5.jar


I do not know where i make mistake? Can anybody please help me out in solving this problem.

Love is GOD and GOD is Love.<br /> <br />Anand Karia<br />Manager I.T<br />Artistic Garment Ind. Pvt. Ltd<br />MSC (Computer Science)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


I am using following jar files
sqljdbc4.jar
jtds-1.2.5.jar

That is two distinct driver implementations. Your errors suggest you are not using jTDS, so I would remove that from your classpath, or change to using jTDS and drop sqljdbc4.jar. jTDS supports forward only result sets.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Anand Karia
Ranch Hand

Joined: Sep 25, 2004
Posts: 154
Dear Paul Sturrock

Thank you very much. I remove sqljdbc4.jar file and use only jTDS.1.2.5.jar file and make a connection from it. It work perfectly.

Now my application can easily be executed for Postgresql, MS-SQL without making any single code change.

Thanks you very much.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: MS-SQL Data ResultSet Problem
 
Similar Threads
[JPA] Dynamic CreateNativeQuery - getColumnNames (or ResultSet)?
ResultSet in forward direction error
EJB 2.1 JDBC resource references
com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.
Using a scrollable resultset to retrieve 'rowcount'