Thursday, July 1, 2010

Java DB Connectivity

Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
String dataSourceName = “connectjava”; //user defined variable
String dbURL = “jdbc:odbc:” + dataSourceName;
con = DriverManager.getConnection(dbURL, “root”,”root”);
Statement s = con.createStatement();
s.execute(“insert into JAVA.test values(‘”+no+”‘,’”+name+”‘)”);
ResultSet rs1=s.executeQuery(“select * from JAVA.test”);

No comments:

Post a Comment