Partager via


Micorosoft SQL Server JDBC 3.0 Released!!!

Dear SQL Server developers and users:

On behalf of Microsoft SQL Server JDBC team I am very excited to announce our latest JDBC driver Microsoft SQL Server JDBC 3.0 release.

This version of the JDBC driver provides support for features introduced in SQL Server 2008, which includes date and time data types, sparse columns, MERGE statements and large user-defined types (UDTs). The support for the new date and time data types includes new setter, getter, and updater methods for SQL Server time, date, datetime2 and datetimeoffset data types. Support for large UDTs includes handling CLR UDTs that are larger than 8000 bytes as binary data. Also, this release adds interfaces for unwrap and isWrapper in the Wrapper interface. In addition, this release enhances metadata support by adding sparse column metadata and new date and time metadata.

Thank you for providing great feedback on our CTP. We really appreciate your continued support on our driver. Feel free to download a copy and check it out!

Thank you,

Amina Saify - JDBC

Comments

  • Anonymous
    May 06, 2010
    Environment OS: Vista HP SP2 x64 SQLServer: 2008 R2 x64 Java: 6u20 x64 Driver: sqljdbc4-3.0.jar Running a Java app for retrieving some metadata, the driver still returns java.sql.Types.NVARCHAR for 'date', 'time' and 'datetime2' database types, rather than java.sql.Types.DATE/TIME/TIMESTAMP respectively, which is what I expected. What is the reason that the Java app (or the JDBC driver itself?) is treated as a "down-level client"?

  • Anonymous
    May 06, 2010
    Do you have a concise repro you can share with us. The 2.0 driver returned nvarchar but the 3.0 should not. Are you sure that you are picking up the right jar? I would print the version of the jar in my application via getDriverVersion()

  • Anonymous
    May 07, 2010
    Yes, I am. Output (excerpt):


General information

Database product name   : Microsoft SQL Server Database product version: 10.50.1600 Driver name             : Microsoft SQL Server JDBC Driver 3.0 Driver version          : 3.0.1301.101

Supported data types

...

TYPE_NAME: Database type name = date DATA_TYPE: SQL/JDBC data type = -9 (corresponds to java.sql.Types.NVARCHAR) PRECISION: Maximum precision  = 10

TYPE_NAME: Database type name = time DATA_TYPE: SQL/JDBC data type = -9 (corresponds to java.sql.Types.NVARCHAR) PRECISION: Maximum precision  = 16

TYPE_NAME: Database type name = datetime2 DATA_TYPE: SQL/JDBC data type = -9 (corresponds to java.sql.Types.NVARCHAR) PRECISION: Maximum precision  = 27

TYPE_NAME: Database type name = datetimeoffset DATA_TYPE: SQL/JDBC data type = -9 (corresponds to java.sql.Types.NVARCHAR) PRECISION: Maximum precision  = 34

...

TYPE_NAME: Database type name = datetime DATA_TYPE: SQL/JDBC data type = 93 (corresponds to java.sql.Types.TIMESTAMP) PRECISION: Maximum precision  = 23

TYPE_NAME: Database type name = smalldatetime DATA_TYPE: SQL/JDBC data type = 93 (corresponds to java.sql.Types.TIMESTAMP) PRECISION: Maximum precision  = 16

  • Anonymous
    May 07, 2010
    Source code:

package test.database; import static java.sql.Types.; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; public final class SQLServerInfo {  private static final Map<Integer,String>    TYPES = new HashMap<Integer,String>(37);  private static final String    CONNECTION_URL = "jdbc:sqlserver://localhost:1433;databaseName=;user=;password=",  // * to be set!    NL = System.getProperty("line.separator"),    SEPARATOR = "------------------------------------------------------------" +                "------------------------------------------------------------";  static {    TYPES.put(ARRAY,         "ARRAY");    TYPES.put(BIGINT,        "BIGINT");    TYPES.put(BINARY,        "BINARY");    TYPES.put(BIT,           "BIT");    TYPES.put(BLOB,          "BLOB");    TYPES.put(BOOLEAN,       "BOOLEAN");    TYPES.put(CHAR,          "CHAR");    TYPES.put(CLOB,          "CLOB");    TYPES.put(DATALINK,      "DATALINK");    TYPES.put(DATE,          "DATE");    TYPES.put(DECIMAL,       "DECIMAL");    TYPES.put(DISTINCT,      "DISTINCT");    TYPES.put(DOUBLE,        "DOUBLE");    TYPES.put(FLOAT,         "FLOAT");    TYPES.put(INTEGER,       "INTEGER");    TYPES.put(JAVA_OBJECT,   "JAVA_OBJECT");    TYPES.put(LONGNVARCHAR,  "LONGNVARCHAR");    TYPES.put(LONGVARBINARY, "LONGVARBINARY");    TYPES.put(LONGVARCHAR,   "LONGVARCHAR");    TYPES.put(NCHAR,         "NCHAR");    TYPES.put(NCLOB,         "NCLOB");    TYPES.put(NULL,          "NULL");    TYPES.put(NUMERIC,       "NUMERIC");    TYPES.put(NVARCHAR,      "NVARCHAR");    TYPES.put(OTHER,         "OTHER");    TYPES.put(REAL,          "REAL");    TYPES.put(REF,           "REF");    TYPES.put(ROWID,         "ROWID");    TYPES.put(SMALLINT,      "SMALLINT");    TYPES.put(SQLXML,        "SQLXML");    TYPES.put(STRUCT,        "STRUCT");    TYPES.put(TIME,          "TIME");    TYPES.put(TIMESTAMP,     "TIMESTAMP");    TYPES.put(TINYINT,       "TINYINT");    TYPES.put(VARBINARY,     "VARBINARY");    TYPES.put(VARCHAR,       "VARCHAR");  }  public static void main(final String[] args)  {    Connection connection;    DatabaseMetaData md;    try {      connection = DriverManager.getConnection(CONNECTION_URL);      md = connection.getMetaData();      /* General information /      System.out.println(SEPARATOR);      System.out.println("General information");      System.out.println(SEPARATOR);      System.out.println(        "Database product name   : " + md.getDatabaseProductName() + NL +        "Database product version: " + md.getDatabaseProductVersion() + NL +        "Driver name             : " + md.getDriverName() + NL +        "Driver version          : " + md.getDriverVersion()        );      / Supported types */      System.out.println(SEPARATOR);      System.out.println("Supported data types");      System.out.println(SEPARATOR);      ResultSet rs = md.getTypeInfo();      while (rs.next())      {        int type = rs.getInt("DATA_TYPE");        System.out.println("TYPE_NAME: Database type name = " + rs.getString("TYPE_NAME"));        System.out.print("DATA_TYPE: SQL/JDBC data type = " + type);        System.out.println(" (corresponds to java.sql.Types." + TYPES.get(type) + ")");        System.out.println("PRECISION: Maximum precision  = " + rs.getLong("PRECISION"));        System.out.println(SEPARATOR);      }    }    catch (SQLException e) {      System.err.println(e.getMessage());      System.exit(-1);    }    System.exit(0);  } }

  • Anonymous
    May 07, 2010
    The comment has been removed

  • Anonymous
    May 08, 2010
    m using windows 7 and sql server 2005 express edition. m new to java.Try to connect my java proram(written in notepad) .plz tel me how to connect my java to sql server 2005  edition using this jdbc driver.plz help as i m in middle of my engg. project.thanks

  • Anonymous
    May 12, 2010
    We'd like to be able to associate a user with a connection during the time we have it out of the pool.  Oracle lets you run "DBMS_SESSION.SET_IDENTIFIER" with the user name.  Is this possible with the 3.0 MS JDBC driver?  I tried playing around with the Connection.setClientInfo() and .getClientInfo() without luck.

  • Anonymous
    May 12, 2010
    I wasn't logged in when I left the last comment, so if you replied to this one, I'll be notified.

  • Anonymous
    May 12, 2010
    The comment has been removed

  • Anonymous
    May 14, 2010
    It looks like the documentation is not correct here. From 3.0 the varchar(max) will be reported as varchar and similarly varchar(binary). If you want to know if the type is max type or standard type you have to also use precision to determine whether the type is max type or small type.

  • Anonymous
    May 14, 2010
    The comment has been removed

  • Anonymous
    May 14, 2010
    The comment has been removed

  • Anonymous
    May 14, 2010
    If we could modify applicationName cheaply and dynamically, we could slip in the user name.

  • Anonymous
    May 25, 2010
    Hi, sorry for distrurbing. I can't find any help with problem: Could not load the DLL SQLJDBC_XA.dll, or one of the DLLs it references. Reason: 193 ... Removing dll lead to same error with different reason 126 I tried all supplied dll versions... same result My config: server: win2k8 64bit + mssql2008 64bit   client: JDBC Driver 3.0 3.0.1301.101 Please help if you can... just simple hint, where is the problem...

  • Anonymous
    May 27, 2010
    DatabaseMetaData.getUserName() method returns login name instead of username.  Is this as per the JDBC specification

  • Anonymous
    June 15, 2010
    Hi Nice release!! Any plans to support TVPs from JDBC ? BR Hans

  • Anonymous
    August 11, 2010
    The comment has been removed

  • Anonymous
    August 21, 2010
    Any ideas whent TVP will be suported?

  • Anonymous
    November 01, 2010
    like other notorious MS software, the driver just issue "Specified driver could not be loaded due to system error  1114", what the heck is that?

  • Anonymous
    November 29, 2010
    How about a UDT example?  I can't seem to find any documentation on how to use it.

  • Anonymous
    December 21, 2010
    The comment has been removed