2

I have been trying to deploy one of my projects that uses jsp for the front end, tomcat7 for the server and a mysql database. I tried integrating the mysql database with the libreoffice database because I had to copy a lot of data from existing excel sheets and then paste it into the database. I downloaded the connector from the MySQL site and put it in the library of tomcat7. I modified the class path to include this .jar file into it. Now I run my server and start my project and I encounter a null pointer exception while obtaining the connection.I am posting my code here

Class.forName("com.mysql.jdbc.Driver").newInstance();
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Database_name","root",password");

Thanks in advance

2

To create a connexion, this code:

DriverManager.registerDriver (new com.mysql.jdbc.Driver());
m_Connexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/Database_name","root",password);

should work. Maybe yours too if you quote correctly the password (you should have "password" or password, not password").

If it still don't work you should check the url, username and password.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.