java sql2005 database connection problems

Category: Java Related
 
jiabin1022
2009-10-19 08:16:42

Sponsored Links
String classforname =
"com.microsoft.sqlserver.jdbc.SQLServerDriver";
String url = "jdbc: sqlserver :/ / localhost: 1433; "
+" databasename = mydb ";
Class.forName (classforname);
Connection con = DriverManager.getConnection (url, "sa", "sa");
Statement sta = con.createStatement ();

has been built over the database, but this error. . .

error com.microsoft.sqlserver.jdbc.SQLServerException: Can not open database requested by the login "mydb". Login failed.
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 (Unknown Source)
at java.sql.DriverManager.getConnection (Unknown Source)
at BASIC.DBtoXML.main (DBtoXML.java: 19 )

please prawn help. . Will it be a problem where my database?

Sponsored Links

clxby1
2009-10-19 08:22:46
check the name of the database there is no wrong and then see SQLSERVER service is not open
SHB6428
2009-10-19 08:29:53
check the name of the database if the database there is no wrong Are there really this database
fq629209
2009-10-19 08:48:27
String url = "jdbc: sqlserver :/ / localhost: 1433;"
+ "databasename = mydb ";
this code looks a little unusual ah Please confirm you write code to connect database

correctly or if you want to start it sqlserver2005
bltong821
2009-10-19 09:00:17
code seems to be no problem, check the database it.
wenwenzhu
2009-10-19 09:13:38
database has not opened it? Database user name and password are correct?
lion0791
2009-10-19 09:26:30
database name is also right. . Password is also true. . If you replaced the master database can be displayed even on. . . You have not encountered this situation ah. . Pointing to pointing. . . Thank you. .
kaikaikaikaikaikai
2009-10-19 09:43:38
Oh, god I have encountered this disgusting problem. God
Come and help it
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.