Hi,
Follow these steps.
1. Create an ODBC DSN - Using the Windows Control Panel, create an ODBC DSN (data source name) for the database.
2. Load the driver - In a
JDBC program, one of the first things to do is to load the JDBC driver by calling the forName() static method of the Class class. forName() takes one
string parameter: the name of the driver along with its package. For JavaSoft's JDBC-ODBC Bridge, this string is "sun.jdbc.odbc.JdbcOdbcDriver". Therefore, the call would look like:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
3. Establish a database connection
Once the JDBC driver loads, you can establish a connection to the database using the DriverManager.getConnection() method. This method's first argument is a string that contains the JDBC URL for the database. The second and third parameters are the user name and password, respectively.
A JDBC URL is formulated using the following
pattern:
jdbc:<subprotocol>:<subname>
A connection to the database could be estd. in this manner:
Connection connection_ = DriverManager.getConnection("jdbc:odbc:myDSN", "sa", "");
I hope you must have got it.
Parmeet