Nitin
Nitin

Reputation: 31

how to connect java with wamp mysql server

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

Answers (4)

Kuldeep Choudhary
Kuldeep Choudhary

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

ali4j
ali4j

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

Muhammad Kashif Nazar
Muhammad Kashif Nazar

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

JBourne
JBourne

Reputation: 344

You need to first download the jdbc driver files for mysql (download from here)

Upvotes: 0

Related Questions