himansh06
himansh06

Reputation: 13

Java MySql connection

Java project not getting linked to mysql database when both are uploaded on third party server on c-panel. We are getting null pointer exception error msg (searchdaoimp.java:30) which is corresponding to the connection string. Our connection settings are as follows:

Host= 'ip address of the server' 
Database =database name 
driver=com.mysql.jdbc.Driver 
url=jdbc:mysql://localhost:3306/database name  
User=database username  
Password=database password
MySql connectionPort ='3306'

Project working offline on local computer via following settings:

Driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/muhealdb
User=****
Password=****

Upvotes: 1

Views: 115

Answers (1)

Sirsendu
Sirsendu

Reputation: 273

Why are you using url=jdbc:mysql://localhost:3306/database name Isn't it will be url="jdbc:mysql://"+Host+":"+connectionPort+"/"+database name ?

Upvotes: 1

Related Questions