• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MS-SQL Data ResultSet Problem

 
Ranch Hand
Posts: 158
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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.
 
Anand Karia
Ranch Hand
Posts: 158
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic