Java Connection SQL Server:jtds driver compatibility issues

Source: Internet
Author: User

There are two ways to connect to a SQL Server 2000 database in Java:

(1) Connect through Microsoft's JDBC driver. There are three files in this JDBC driver, namely Mssqlserver.jar, Msutil.jar, and Msbase.jar. However, these drivers have not been found on the Microsoft Official web, and the Sqljdbc.jar and Sqljdbc4.jar provided are not supported by SQL Server 2000.

Driver Name: Com.microsoft.jdbc.sqlserver.SQLServerDriver (that is, classforname below)
Database connection Url:jdbc:microsoft:sqlserver://localhost:1433;databasename=dbname (that is, the following URL)

(2) Connect via Jtds Drive. : http://sourceforge.net/projects/jtds/files/jtds/

Driver Name: Net.sourceforge.jtds.jdbc.Driver (that is, classforname below)
Database connection Url:jdbc:jtds:sqlserver://localhost:1433/dbname (that is, the following URL)

When you connect using the second method, you may have an error:

java.lang.unsupportedclassversionerror:net/sourceforge/jtds/jdbc/driver:unsupported Major.minor version 51.0

The JDK version number corresponds to:

J2SE 7 = Wuyi (0x33 hex),
J2SE 6.0 = (0x32 hex),
J2SE 5.0 = (0x31 hex),
JDK 1.4 = 0x30 Hex,
JDK 1.3 = (0x2F hex),
JDK 1.2 = 0x2e Hex,
JDK 1.1 = (0x2D hex).

As a result, the above error is due to Jtds needs jdk7, and the JDK version you are using is not jdk7.

Solution:

(1) Installation Jdk7

(2) Install the lower version of the Jtds (General Jtds 3.x requires JDK7)

Turn from:

http://blog.csdn.net/kingzone_2008/article/details/9120413

Java Connection SQL Server:jtds driver compatibility issues

Related Article

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.