Sunday, September 11, 2011

Connecting Mysql in tomcat server in linux

You can connect to mysql in tomcat
- Setup mysql
Download Mysql click here
-download mysql connector(driver) and add file .jar to your project
Click here to download jconnector

-run mysql create datasource

Example for connecting the mysql in tomcat jsp
public static Connection getConnection(){
Connection conn DriverManager.getConnection(“jdbc:mysql:// root&password password”);
return conn;
catch(SQLException se)
return null;