关于数据库连接的一个错误:Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.

很容易看出是数据库出了问题,看看是否是db.properties文件中路径错误

各数据库连接数据库中db.properties中的写法:

SQLServer 2000 连接数据库

driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver

url=jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=mytestdb

username=robinliu

password=robinliu

initialSize =2

maxActive=2

maxWait=2000

 

mySql 连接数据库

driverClassName=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/test

username=root

password=mysql

initialSize=4

maxActive =10

 

SQLServer 2005 连接数据库

driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver

url=jdbc:sqlserver://127.0.0.1:1433;databaseName=stuinfo

username=sa

password=1234

initialSize =2

maxActive=100

maxWait=2000

 

oracle数据库 连接数据库

 

database.database=ORACLE

database.driverClassName = oracle.jdbc.driver.OracleDriver

database.password        = sinple

database.show_sql        = true

 

database.url = jdbc\:oracle\:thin\:@localhost\:1521\:sinple

database.username        = sinple

转载于:https://www.cnblogs.com/tangling/p/6726705.html

你可能感兴趣的:(数据库)