RE: How to connect data source for mysql in tomcat server
You can nonnect to mysql datasource without tomcat server by folowing way:
- Setup mysql -download mysql connector(driver) and add file .jar to your project -run mysql create datasource - Write code to connect to that datasource:
RE: How to connect data source for mysql in tomcat server
First download mysql.jar and mysql connector then load the driver
Class.forName("com.mysql.jdbc.Driver");
then create a database in mysql lets assuse "test" is the database name. for using mysql we must provide user name and password while obtaining connection. here we assume "root" is username and password as well. so the code will be
Connection con DriverManager.getConnection("mysql://localhost:3306/test" "root" "root");