Ad Code

We define a connection for URL and JDBC


how do we load a driver and how do we define a connection for URL and JDBC

 Load Driver
 Need to load suitable driver for underlying database.
 Different drivers & types for different databases are available.
 For MS Access, load following driver available with j2se.
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
 For Oracle, load the following driver. You have to download it explicitly.
Class.forName(“oracle.jdbc.driver.OracleDriver”); Define Connection URL To get a connection, we need to specify the URL of a database (Actually we need to specify the address of the database which is in the form of URL) As we are using Microsoft Access database and we have loaded a JDBC-ODBC driver. Using JDBC-ODBC driver requires a DSN which we have created earlier and named it personDSN. So the URL of the database will be
Reactions

Post a Comment

0 Comments