1

I restored my local developing database with a backup file made from production database with SQL Server Management Studio. I overwrited my local database on that restore.

Now I can't connect to the database with SQL Squirrel. What could have caused this and how to fix it? Thank you.

I get the error on login "Unexpected Error occurred attempting to open an SQL connection."

Stack Trace button reveals the following:

java.util.concurrent.ExecutionException: java.lang.RuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "devdatabase_myname" requested by the login. The login failed. ClientConnectionId:[id]
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:206)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.awaitConnection(OpenConnectionCommand.java:132)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$100(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$2.run(OpenConnectionCommand.java:115)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "devdatabase_myname" requested by the login. The login failed. ClientConnectionId:[id]
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:171)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.access$000(OpenConnectionCommand.java:45)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand$1.run(OpenConnectionCommand.java:104)
    ... 5 more
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "devdatabase_myname" requested by the login. The login failed. ClientConnectionId:[id]
    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(SQLServerException.java:216)
    at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(tdsparser.java:254)
    at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:2908)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:2234)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:41)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:2220)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1326)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:991)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:827)
    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1012)
    at net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager.getConnection(SQLDriverManager.java:133)
    at net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand.executeConnect(OpenConnectionCommand.java:167)
    ... 7 more
2
  • Missing GRANTs maybe? Commented May 22, 2015 at 9:39
  • Have you been able to connect from within the SQL Server Management Studio. If you can't then you know that the problem is probably some changes in authentication parameters. If you can, check whether the database name, username, password, host and port match those of the server. Commented May 22, 2015 at 9:41

1 Answer 1

2

It's possible you have an orphaned user. if your database user is not mapped correctly to the login of the same name, the server will have no way to connect you to the right database. You can see the following article for troubleshooting help

http://msdn.microsoft.com/en-us/library/ms175475%28SQL.100%29.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

This is correct. I had one orphaned user and was able to fix that by following instructions here: geekswithblogs.net/bullpit/archive/2010/04/21/… Problem solved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.