Java项目没有链接到mysql数据库时,两者都上传到第三方服务器上的c-panel。我们得到与连接字符串相对应的空指针异常错误消息(searchdaoimp.java:30)。我们的连接设置如下:
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'通过以下设置在本地计算机上脱机工作的项目:
Driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/muhealdb
User=****
Password=****发布于 2016-07-26 16:52:20
你为什么要用url=jdbc:mysql://localhost:3306/database name,它不会是url="jdbc:mysql://"+Host+":"+connectionPort+"/"+database name吗?
https://stackoverflow.com/questions/38585081
复制相似问题