I use MySQL using the -skip-networking option on Linux.
I am trying to connect my J2EE based application (using servlets) to a MySQL database using JDBC.
Previously, when I used MySQL with the -skip-networking option disabled, I connected to the database as follows:
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatabase","myuser","mypassword");
After enabling the -skip-networking option, I tried to connect it as:
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/mydatabase","myuser","mypassword");
But this does not work, and I get java.lang.NullPointerException when I try to connect to the database in my application.
After commenting on the -skip-networking option and using the old JDBC statement, I can connect to the database.
I can connect to the database through the mysql command line client with the -skip-networking option enabled.
- , JDBC? , . .