Jtds JDBC driver

Source: Internet
Author: User
Tags sybase atlassian jira

 

Overview

Jtds is an open source 100% pure Java (Type 4) JDBC 3.0 driver for Microsoft SQL Server (6.5, 7, 2000,200 5 and 2008) and Sybase (10, 11, 12, 15 ). jtds is based on freetds and is currently the fastest production-ready JDBC driver for SQL Server and Sybase. jtds is 100% JDBC 3.0 compatible, supporting forward-only and scrollable/updateable resultsets, concurrent (completely independent) statements and implementing all the databasemetadata and resultsetmetadata methods. check out the feature matrix for more details.

Quite a few of the specified cial JDBC drivers out there are based on jtds (or freetds), even if they no longer acknowledge this. jtds has been tested with always all JDBC-based database management tools and is the driver of choice for most of these (recommended for dbvisualizer and squirrel SQL, distributed with aqua data studio and datadino ). jtds is also becoming a common choice for enterprise-level applications: it passes both the J2EE 1.3 certification and hibernate Test suites, and is recommended for JBoss, hibernate, Atlassian Jira and confluence and Compiere.

 

 

Why use jtds?

Jtds is free software. jtds is released under the terms of the GNU lgpl, giving you not only the posibility to debug and tweak it to your own liking but also to use it in and distribute it with your free or other cial applications.

the other "free" choices, the JDBC-ODBC bridge and Microsoft's own JDBC driver are not actually free. if you encounter an issue with any of them you won't be able to fix it yourself and response times from both Microsoft and Sun are anything but short. also, both of them lack functionality (the Microsoft driver implements JDBC 2.0, while the bridge is just a JDBC 1.0 implementation) and have serious stability problems: the bridge crashes the JVM if the ODBC driver has any problem and Microsoft just has no intention of really supporting Java/jdbc .

Jtds is also the most connector t JDBC driver for both SQL Server and Sybase. we have an older benchmark result but we strongly encourage you to download any benchmark published by commercial JDBC driver vendors and see for yourself. here are a couple of benchmarks you cocould use: jnetdirect's JDBC performance benchmark and I-net software's benchtest 2.1 for ms SQL Server.

Anyway, just give it a spin. Get the latest one from here and see whether you like it or not.

 

Jtds Feature Matrix

Below is the list of features of JTD 1.2.

Compliance

SQL Server 2005,200 0, 7.0, 6.5 compliant Yes
Sybase 10, 11, 12, 15 compliant Yes (not all features available for Sybase)
JDK 1.4, 1.3 and 1.2 compliant Yes
Sun Certified 100% pure javatm Yes

Feature Summary

Open source and freely distributable Yes
Prepared and callable statements Yes
Updateable result sets Yes
Scrolling result sets Yes
Batch updates Yes (fully optimized, single request/response)
Statement Pooling Yes
Full timeout support Yes
Full range of cursor types Yes
Full blob and clob support Yes
Blob and clob locator support No
Unlimited statements per connection Yes
Generated keys Retrieval Yes
Named Parameters Yes
Savepoints Yes
Parameter metadata Yes
Rowset implementation No (recommended rowset implementation: Sun reference implementation 1.0.1)
Metadata caching Yes (retriable on connection creation)

J2EE support

JNDI data sources Yes
Connection Pooling Yes
Connection Pool implementation No (recommended pool implementations: DBCP and c3p0)
XA distributed transactions Yes (experimental)

SQL Server-specific

Optimized native protocol performance Yes (Benchmark Results: [1])
Windows Authentication Yes
SQL Server named instances Yes
Ignoring of update counts from triggers Yes
Send string data as ASCII/Unicode Yes
Ntext, nchar and nvarchar support Yes
Named Pipes Yes (using the filesystem locally and jcifs over the network)
SSL encryption Yes
Fast forward-only cursors Yes

 

Package COM. WCG. sqlserver; import Java. SQL. *; public class connecturl {public static void main (string [] ARGs) {// create a variable for the connection string. // string connectionurl = "JDBC: sqlserver: // localhost: 1433;" + // "databasename = test; user = sa; Password = PWD "; // string connstring = "JDBC: jtds: sqlserver: // localhost/test"; string connstring = "JDBC: jtds: sqlserver: // localhost: 1433; databasename = test; u SER = sa; Password = PWD; "; // declare the JDBC objects. connection con = NULL; statement stmt = NULL; resultset rs = NULL; try {// establish the connection. // class. forname ("com. microsoft. sqlserver. JDBC. sqlserverdriver "); Class. forname ("net. sourceForge. jtds. JDBC. driver "); con = drivermanager. getconnection (connstring); // create and execute an SQL statement that returns some data. // string SQL = "select Top 10 * From person. contact "; string SQL =" select * from t "; // string sqlinsert =" insert into T values (N 'wu xx111'); "; // sqlinsert + = sqlinsert; // stmt = con. createstatement (); // Boolean bresult = stmt.exe cute (sqlinsert); // system. out. println (bresult); // system. out. println (stmt. getupdatecount (); RS = stmt.exe cutequery (SQL); // iterate through the data in the result set and display it. while (RS. Next () {system. out. println (RS. getstring (1) + "" + Rs. getstring (2); }}// handle any errors that may have occurred. catch (exception e) {e. printstacktrace ();} finally {If (RS! = NULL) Try {Rs. Close ();} catch (exception e) {}if (stmt! = NULL) Try {stmt. Close ();} catch (exception e) {}if (con! = NULL) Try {con. Close () ;}catch (exception e ){}}}}

 

 

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.