Wednesday, December 6, 2006

What is JDBC? How do you connect to the Database?

JDBC stands for Java Database Connectivity. Its a set of programming APIs which allow easy connection to a wide range of databases through Java programs.

To connect to the database we will need to load the database driver and then request a connection as below:

code:
Class.forName(LOCATION OF DRIVER);
Connection jdbcConnection = DriverManager.getConnection (LOCATION OF DATASOURCE)

____________________________________________________________________________________________________________________

Once ur done with it.You would have the Connection Object(
jdbcConnection )

No comments: