Reputation: 5079
Does DB2 (LUW) support JDBC 4.1?
From where can I download this driver if it exist?
Upvotes: 1
Views: 1499
Reputation: 580
As a follow up answer to what @AngocA mentioned above, I developed a simple program to test the DB2 driver to check its compliance level with JDBC
.
I found that the first DB2 driver claiming such support is driver 4.13.127
.
So any thing after that should also support JDBC 4.1
Here is my simple program you can use to check for the compliance level:
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.SQLException;
public class tester {
// Replace these info with your DB2 info
private final static String hostName = "mydb2.db2.com";
private final static String portNum = "50000";
private final static String userName = "dasusr";
private final static String password = "db2sdin";
private final static String dbName = "mydb";
private final static String fullURL = "jdbc:db2://" + hostName + ":" + portNum
+ "/" + dbName + ":" + "user=" + userName
+ ";password=" + password + ";";
public static void main(String[] args) {
Connection con = null;
try {
con = DriverManager.getConnection(fullURL);
DatabaseMetaData conMD = con.getMetaData();
String driverName = conMD.getDriverName();
String driverVersion = conMD.getDriverVersion();
String jdbcVersion = conMD.getJDBCMajorVersion()
+"."+ conMD.getJDBCMinorVersion();
System.out.println("driverName: " + driverName + "\n"
+"driverVersion: "+ driverVersion + "\n"
+"jdbcVersion: "+ jdbcVersion);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
In your .classpath
which would look like this in the Navigator
tab in eclipse:
add the location of the driver you would like to test like this:
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse
.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<!-- driver_4.13.127 -->
<classpathentry kind="lib" path="driver_4.13.127/db2jcc_license_cisuz.jar"/>
<classpathentry kind="lib" path="driver_4.13.127/db2jcc4.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
You should then get an output similar to this:
driverName: IBM Data Server Driver for JDBC and SQLJ
driverVersion: 4.13.127
jdbcVersion: 4.1
Upvotes: 1
Reputation: 7693
The db2 driver for JDBC v3 is called db2jcc.jar
For version 4, the JDBC driver for DB2 is called db2jcc4.jar, and the documentation says: JDBC 4.0 or later functions.
Your question is specific for JDBC 4.1, however the DB2 documentation does not say anything about this JDBC specific release (RowSetProviderClass and auto-close of connection, statement an resultSet)
It does not seem that this jdbc driver is available for this jdbc release.
List of db2 jdbc drivers: http://www-01.ibm.com/support/docview.wss?uid=swg21363866
Upvotes: 2