首页上一页 1 下一页尾页 1 条记录 1/1页
你好
发表在Java图书答疑
2011-06-09
是否精华
是
否
版块置顶:
是
否
我用是SQLSERVER2008,成功的加载了JDBC2.0驱动。URL也成功了。
可是问题出现了。我的电脑的用户为LYMP。密码为1,当时我装SQLSERVER2008时,设置登路身份是WINDOWS身份。
现在我在CONNECTION时出现了错误的提示,用户名不正确。可是我的SQLSERVER2008就是以LYMP的用户名登录的,我找不出来原因,请帮我看一下如吗?
ublic static Connection getConn(){
Connection conn=null;
try{
String url="jdbc:sqlserver://localhost:1433;DatabaseName=mp";
String user="LYMP";
String password="1";
conn=DriverManager.getConnection(url,user,password);
return conn;
错误的代码
om.microsoft.sqlserver.jdbc.SQLServerException: 用户 'LYMP' 登录失败。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2532)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1929)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1917)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1061)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at e.h.getConn(h.java:23)
at e.h.main(h.java:34)
可是问题出现了。我的电脑的用户为LYMP。密码为1,当时我装SQLSERVER2008时,设置登路身份是WINDOWS身份。
现在我在CONNECTION时出现了错误的提示,用户名不正确。可是我的SQLSERVER2008就是以LYMP的用户名登录的,我找不出来原因,请帮我看一下如吗?
ublic static Connection getConn(){
Connection conn=null;
try{
String url="jdbc:sqlserver://localhost:1433;DatabaseName=mp";
String user="LYMP";
String password="1";
conn=DriverManager.getConnection(url,user,password);
return conn;
错误的代码
om.microsoft.sqlserver.jdbc.SQLServerException: 用户 'LYMP' 登录失败。
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:196)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:246)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:83)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2532)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:1929)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:1917)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:4026)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1416)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1061)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:833)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:716)
at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:841)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at e.h.getConn(h.java:23)
at e.h.main(h.java:34)