phpMyAdmin in xampp server is used to manage MySQL database.We can connecting java with mysql xampp using the below code:
Prerequisite
Xampp should be installed.
In the java code
String url = "jdbc:mysql://localhost:3306/"; ( MySQL server in xampp is installed in port 3306)
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "";
try {
Class.forName(driver).newInstance();
Connection con =DriverManager.getConnection(url+dbName,userName,password);
}
We need to put mysql-connector-java-5.1.18-bin.jar in the classpath.
Prerequisite
Xampp should be installed.
In the java code
String url = "jdbc:mysql://localhost:3306/"; ( MySQL server in xampp is installed in port 3306)
String dbName = "test";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "";
try {
Class.forName(driver).newInstance();
Connection con =DriverManager.getConnection(url+dbName,userName,password);
}
We need to put mysql-connector-java-5.1.18-bin.jar in the classpath.
No comments:
Post a Comment