Reputation: 31
I am new java programmer, I try to setup jdbc connnectivity with wamp mysql server.
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection( "jdbc:mysql://182.73.151.36:3306/sbtsystem?user=sbtuser&password=Pm@dmin&useUnicode=true&characterEncoding=UTF-8");
182.73.151.36
this is server IP address. I can't understand how to connect java with wamp mysql server
Upvotes: 0
Views: 15784
Reputation: 775
Try This:
First run these commands
ping 182.73.151.36
telnet 182.73.151.36 3306
And make 182.73.151.36 mysql eligible for remote connection
After that change your connection line and run this program
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection("jdbc:mysql://182.73.151.36:3306/sbtsystem","sbtuser","Pm@dmin");
Upvotes: 1
Reputation: 522
supposing your network configuration is correct, I guess your mysql server on 182.73.151.36 is not configured for remote connection,
Upvotes: 0
Reputation: 23835
The code looks fine. You need to check the network configurations. Try the following commands to see if the server is accessible.
ping 182.73.151.36
telnet 182.73.151.36 3306
Upvotes: 0
Reputation: 344
You need to first download the jdbc driver files for mysql (download from here)
Upvotes: 0