Com. microsoft. sqlserver. jdbc. SQLServerException: this game is not supported

Source: Internet
Author: User
1. the SQL statement Class connecting the environment 1windows2003, apache-tomcat-5.5.16, jdk1.5.0 _ 06, sql20002windows2008, apache-tomcat-6.0.20, jdk1.6.0 _ 03, and sql2005. forName (com. microsoft. sqlserver. jdbc. SQLServerDriver); 2005versionClass. forNa

Environment 1 windows2003, apache-tomcat-5.5.16, jdk1.5.0 _ 06, sql2000 2 windows2008, apache-tomcat-6.0.20, jdk1.6.0 _ 03, and sql2005 SQL connection statement Class. forName ("com. microsoft. sqlserver. jdbc. SQLServerDriver "); // 2005 version Class. forNa

Environment 1

1 windows2003, apache-tomcat-5.5.16, jdk1.5.0 _ 06, sql2000
2 windows2008, apache-tomcat-6.0.20, jdk1.6.0 _ 03, sql2005

JAVA-connected SQL statements

Class. forName ("com. microsoft. sqlserver. jdbc. SQLServerDriver"); // 2005 version
Class. forName ("com. microsoft. jdbc. sqlserver. SQLServerDriver"); // 2000 version

Connection con = DriverManager. getConnection ("jdbc: sqlserver :// ; User = ; Password = "); // Version 2005
Connection con = DriverManager. getConnection ("jdbc: microsoft: sqlserver :// ; User = ; Password = "); // Version 2000

3. drivers are required for connecting JAVA to SQL.

Sql2000 requires three jar packages: mssqlservice. jar, msutil. jar, and msbase. jar.
Sql2005 requires a jar package: sqljdbc. jar
Therefore, the connection methods of SQL2000 and 2005 are different. As for sqljdbc. jar, you can directly download it from csdn or go to the official next installation package.

4. Based on the above, change the data source



This is the old data source. You need to change the driverClassName and url.

5. Run the old program

Because the query statement of the old program is complex, hibernate and JDBC are used in the program.

Hibernate runs normally, but jdbc reports an error.

PreparedStatement pstat = conn. prepareStatement (SQL, ResultSet. TYPE_SCROLL_INSENSITIVE, ResultSet. CONCUR_UPDATABLE );

In this Code, an exception is thrown because "ResultSet. TYPE_SCROLL_INSENSITIVE, ResultSet. CONCUR_UPDATABLE" is set:

Com. microsoft. sqlserver. jdbc. SQLServerException: This cursor type/concurrent combination is not supported.

The cause is that sqljdbc. jar does not support ResultSet. CONCUR_UPDATABLE to ResultSet. CONCUR_READ_ONLY.

Summary

1 tested: sqljdbc. jar can also be used in sql2000. For hibernate, the program can pass. For jdbc, you only need to change ResultSet. CONCUR_READ_ONLY.

2. If you use the sql2000 driver package to connect to sql2005, an exception will be thrown:
Java. SQL. SQLException: [Microsoft] [SQLServer 2000 Driver for JDBC] [SQLServer] The input table format data stream (TDS) Remote Process Call (RPC) protocol stream is incorrect. Parameter 1 (""): the data type 0x38 is unknown.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.