This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes MS-SQL Data ResultSet Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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: 156

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.
Anand Karia
IT Concretor.......
M/s. Anand Karia Concreting IT
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: 156

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.
anveshhhhh reddy
Greenhorn

Joined: Oct 03, 2013
Posts: 1
12:43:38.765 [DefaultQuartzScheduler_Worker-4] ERROR com.jolbox.bonecp.ConnectionHandle - Database access problem. Killing off all remaining connections in the connection pool. SQL State = 08S01
12:43:38.921 [DefaultQuartzScheduler_Worker-4] ERROR com.healthhiway.agent.jobs.JobsBase - Exception while Executing Job: TextualBase
com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1352) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1339) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.throwInvalidTDS(SQLServerConnection.java:1328) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.TDSReader.throwInvalidTDS(IOBuffer.java:3610) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.TDSReader.readSQLIdentifier(IOBuffer.java:4333) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.StreamTabName.applyTo(StreamTabName.java:41) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.StreamColumns.buildColumns(StreamColumns.java:91) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerResultSet$1CursorInitializer.buildColumns(SQLServerResultSet.java:160) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerResultSet.<init>(SQLServerResultSet.java:285) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1504) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:390) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:340) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4575) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1400) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:179) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:154) ~[sqljdbc4.jar:na]
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:283) ~[sqljdbc4.jar:na]
at com.jolbox.bonecp.PreparedStatementHandle.executeQuery(PreparedStatementHandle.java:172) ~[bonecp-0.7.1.jar:0.7.1.RELEASE]
at com.healthhiway.agent.jobs.DbQueryTSJob.executeJob(DbQueryTSJob.java:60) ~[AgentOne.jar:na]
at com.healthhiway.agent.jobs.JobsBase.execute(JobsBase.java:104) ~[AgentOne.jar:na]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz-all-2.1.5.jar:na]
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz-all-2.1.5.jar:na]
12:43:40.500 [DefaultQuartzScheduler_Worker-4] INFO com.healthhiway.agent.jobs.JobsBase - Exiting job: TextualBase
12:43:40.562 [DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers
12:43:40.703 [DefaultQuartzScheduler_Worker-2] ERROR com.jolbox.bonecp.ConnectionHandle -

this the problem I am helping please help me
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MS-SQL Data ResultSet Problem
 
Similar Threads
com.microsoft.sqlserver.jdbc.SQLServerException: The TDS protocol stream is not valid.
EJB 2.1 JDBC resource references
[JPA] Dynamic CreateNativeQuery - getColumnNames (or ResultSet)?
Using a scrollable resultset to retrieve 'rowcount'
ResultSet in forward direction error