java中的配置文件
url=jdbc:microsoft:sqlserver://localhost:1433;databaseName=TS_yfyxh_xf
username=sa
driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
password=123
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.wjy.util.SqlHelper.getConnection(SqlHelper.java:66)
at com.wjy.util.SqlHelper.executeQuery(SqlHelper.java:214)
at com.wjy.timer.Test$2.run(Test.java:42)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
错误解决方案:
1. 可能是数据库访问端口出错
解决方案:
打开数据库的查询窗口输入:exec sys.sp_readerrorlog 0, 1, 'listening'
可以看到这个数据库的端口号是多少
然后更改url=jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=TS_yfyxh_xf的1433为查询出来的端口号即可
url=jdbc:microsoft:sqlserver://localhost:1433;databaseName=TS_yfyxh_xf
username=sa
driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
password=123
运行时报错:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown Source)
at com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.wjy.util.SqlHelper.getConnection(SqlHelper.java:66)
at com.wjy.util.SqlHelper.executeQuery(SqlHelper.java:214)
at com.wjy.timer.Test$2.run(Test.java:42)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)
错误解决方案:
1. 可能是数据库访问端口出错
解决方案:
打开数据库的查询窗口输入:exec sys.sp_readerrorlog 0, 1, 'listening'
可以看到这个数据库的端口号是多少
然后更改url=jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=TS_yfyxh_xf的1433为查询出来的端口号即可