|
How to make JDBC connection |
|
|
This tip shows the way to make JDBC connection to the database. For this first go to the ODBC DataSources in Control Panel and make a DSN using named Dumy (you can give any name) and maps this to your database.
Now include following code block to make a connection and create Statement. A statement object is used to sends your SQL statement to the DBMS.
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:dumy"; "sa", "");
Statement stmt = con.createStatement();
}
catch( Exception e ) {
e.printStackTrace();
}
|
Related Tips
|
Page 1 of 0 ( 0 comments )
You can share your information about this topic using the form below!
Please do not post your questions with this form! Thanks.