This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Actually I am developing some application on Linux machine and written following code where I need to establish database connection using mysql driver. My task is to fethch data from database and put in textarea.
I think this wherer I have strucked. I m not getting how to include jar on CLASSPATH. Where can I find this Mysql connector jar and how can proceed then. Since I m new to Linux I m not getting how to do this. Could you please explain me the same.
Joined: Sep 17, 2009
Could you please tell me the procedure. I m trying but getting confused. please help.
Download the MySQL JDBC driver from the MySQL web site (or if you are building using Maven, you can let Maven download it for you) and add it to the "-cp" parameter on your command line. For example, assume the driver is in the current directory, and that my classes are in the target/classes directory, and my main class is org.peter.Main, then I would use:
Oh, wait, you are attempting to access the database from a servlet. In that case, place the mysql-connector-java-5.1.6.jar in the library directory of the servlet container or application server you are using. What app server are you using? If we knew that we could offer more specific advice.