Inside Out

How to : JDBC with MySQL

JDBC (Java Data Base Connectivity) is the basic driver used to connect Java applets or applications to various databases. Here are some of the resources to get started with JDBC :

**Windows**

http://www.developer.com/java/data/article.php/3417381

**\*nix**

1. Start off with installing the Connector/J package (mysql-connector-java) from [here](http://dev.mysql.com/downloads/connector/j/3.1.html) Details are [here](http://dev.mysql.com/doc/connector/j/en/cj-installing.html) 2. Next just extract the files in the *tar.gz* archive using :

`tar -xvzf mysql-connector-java.tar.gz` 3. Then just copy the *jar* files to any directory. I moved the *jar* files to */usr/share/java* 4. Then we got to edit the CLASSPATH variable so edit the .bashrc file to contain following options :

</p>
`JAVA_HOME=/usr/java/jdk1.5.0_06/  #root directory where jdk is present  `

export JAVA\_HOME  

CLASSPATH=/usr/java/jdk1.5.0\_06/lib/tools.jar:.:/usr/java/jdk1.5.0\_06/lib/dt.jar:\\  

/usr/share/java/mysql-connector-java-3.1.13.jar  

export CLASSPATH  

<p>
</code>

Then try and test the stuff as mentioned [here](http://www.kitebird.com/articles/jdbc.html)

technorati tags:[jdbc](http://technorati.com/tag/jdbc), [java](http://technorati.com/tag/java), [mysql](http://technorati.com/tag/mysql), [database](http://technorati.com/tag/database), [dbms](http://technorati.com/tag/dbms)