Thursday, September 18, 2008

Database connectivity using IBM DB2 with JDBC Driver.


The Code Goes Like this :



Driver driver = new COM.ibm.db2.jdbc.app.DB2Driver();

DriverManager.registerDriver(driver);

connection = DriverManager.getConnection("jdbc:db2:", "username", "password");

if (connection == null)

{

System.out.println("connection failed");

}

connection.setAutoCommit(true);

System.out.println("Successfully Connected to DB2...");

statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,

ResultSet.CONCUR_UPDATABLE);



No comments: