#639 Unable to switch database

Squirrel SQL
closed-fixed
8
2015-01-08
2008-06-17
Heiko Adams
No

When trying to switch the database to following error message occurs:
"Error: Eintrag in sysdatabases für die "KigaPRO"-Datenbank konnte nicht gefunden werden. Kein Eintrag mit diesem Namen wurde gefunden. Stellen Sie sicher, dass der Name richtig eingegeben wurde.
SQLState: S0001
ErrorCode: 911"

For me it seems that squirrel is using the qouted name which can't be found in sysdatabases table of course because sysdatabases doesn't contain quoted entries.

Discussion

  • Heiko Adams

    Heiko Adams - 2008-06-17
    • milestone: 816968 --> All
     
  • Nobody/Anonymous

    Logged In: NO

    I have been having this issue since upgrading to 2.6.x as well. Changing the catalog gives me this error:

    Error: Could not locate entry in sysdatabases for database '"QADB"'. No entry found with that name. Make sure that the name is entered correctly.
    SQLState: S0001
    ErrorCode: 911

     
  • Heiko Adams

    Heiko Adams - 2008-06-27
    • priority: 5 --> 8
     
  • Heiko Adams

    Heiko Adams - 2008-06-27

    Logged In: YES
    user_id=503730
    Originator: YES

    The problem is still present in the latest snapshot.

     
  • Nobody/Anonymous

    Logged In: NO

    Same here, cannot switch between catalogs in v2.6.6 with MSSQL Server:

    Error: Could not locate entry in sysdatabases for database '"GEORGE"'. No entry found with that name. Make sure that the name is entered correctly.
    SQLState: 08004
    ErrorCode: 911

    I can connect by maintaining a list of aliases each pointing to the catalog I need (databaseName=GEORGE).

    I can only view the current catalog in the objects view, but can run SQL over other catalogs.

     
  • William Daul Hill II

    I downloaded the source and modified the file, because couldn't do my work without MSSQL connections.

    The problem seems to be in net.sourceforge.squirrel_sql.fw.sql in the SQLConnection.java file. Looks like in cases where there's a . in the catalog name, MSSQL crashes, so they blanket added quotes around the catalogue.

    line 359 just says conn.setCatalog(quote(catalogName));

    I added an if statement to verify that there was a period before wrapping in quotes.

    /\*\*
     \* MS SQL Server throws an exception if the catalog name contains a period without it being quoted.
     \* 
     \* @param catalogName
     \*           the catalog name to use
     \* @throws SQLException
     \*            if an error occurs
     \*/
    private void setMSSQLServerCatalog\(String catalogName\) throws SQLException \{
        final Connection conn = getConnection\(\);
        if \(catalogName.contains\("."\)\) \{
            conn.setCatalog\(quote\(catalogName\)\);
        \} else \{
            conn.setCatalog\(catalogName\);
        \}
    \}
    

    Cheers,
    Daul Hill.

     
  • Rob Manning

    Rob Manning - 2008-10-30

    I am definitely missing something here. I have both SQLServer 2005 and 2000 installed. I can change the catalog fine. But I cannot change the catalog fine if I don't use quotes around the catalog when it contains a period or a space:

    use db.with.periods;
    use db with spaces;

    Both of these commands fail for me. They only succeed if I quote them :

    use "db.with.periods";
    use "db with spaces";

    We can certainly only quote when "." or " " are found in the catalog, but unusual db names such as the above must be quoted or else you get something like this:

    Error: Could not locate entry in sysdatabases for database 'db'. No entry found with that name. Make sure that the name is entered correctly.
    SQLState: S0001
    ErrorCode: 911

    Would someone who is having this issue with switching catalogs like to try creating a database with "." or " " in it's name and let me know how you switched the catalog using SQL, without quoting the identifier ?

    Rob

     
  • Nobody/Anonymous

    Hi, I have the same problem, please tell me if you found a solution

     
  • William Daul Hill II

    Ok. I guess it seems that there is an issue more with the description of the problem. We're not having problems switching catalogs by typing "use 'db.whatever'" in the sql window. I'll probably even guess that most of us complaining about this issue didn't even know you could do that.

    What we are complaining about is switching catalogs using the gui. If you try to change catalogs using the drop down combobox in the top left hand corner, then you receive the following:

    Error: Could not locate entry in sysdatabases for database '"QADB"'. No
    entry found with that name. Make sure that the name is entered correctly.
    SQLState: S0001
    ErrorCode: 911

    I even tried using the dropdown box with a catalog containing a period, and the version that quotes the catalog doesn't work. I built a version that doesn't quote the catalog, and it works. So the code that I submitted before, won't work on the gui for catalogs with periods in their names. It should just be:

    private void setMSSQLServerCatalog(String catalogName) throws
    SQLException {
    final Connection conn = getConnection();
    conn.setCatalog(catalogName);
    }

    Cheers,
    Daul Hill

     
  • Rob Manning

    Rob Manning - 2008-12-04

    Daul,

    No, I think I understand the problem well enough, I just failed to accurately describe what I see. I am using the catalog drop-down as well. But when I remove the quoting code in SQLConnection and attempt to switch to my "db.with.periods" catalog, I get :

    Error: Could not locate entry in sysdatabases for database 'db'. No entry found with that name. Make sure that the name is entered correctly.
    SQLState: S0001
    ErrorCode: 911

    I have uploaded a screencast of my desktop session where I demonstrate the problem with the proposed solution to comment out the quote method in SQLConnection. As you will see in the video, I can't use the catalog drop-down to change the catalog to "db.with.spaces". Here is the short video (1.9MB) in ogg format :

    http://www.squirrelsql.org/screencast/unquoted_identifier_demo.ogg

    At the moment I suspect that it's a problem with how the database is configured, since you and I seem to get the opposite result.

    Rob

     
  • William Daul Hill II

    Rob,

    I think I may have gotten us closer to the "issue". When I was looking at your screencast, I noticed you were using the SQL Server 2000 JDBC driver. I have it installed on my machine as well (SP3 version), used it, and lo and behold, the error occurred. Looks like Microsoft fixed this problem with the SQL Server 2005 JDBC drivers, which is what I am currently using. (Hopefully it stays fixed with SQL Server 2008).

    There's also a 2000 sp4 JDBC driver which I haven't tried yet, but the bugfix list doesn't mention this as an issue, so my guess is that the functionality differs between the 2000 and 2005 JDBC drivers.

    Hope this helps,
    Daul.

     
  • pmoleri

    pmoleri - 2008-12-11

    I'd like to add that I experienced the same problem with jTDS driver on Windows XP.

     
  • Rob Manning

    Rob Manning - 2008-12-12

    I use a SQLServer 2005 driver to access both of my database servers (2000 and 2005). My alias is called MS-SQL 2000, because I happened to be using SQLServer 2000 at the time. I have also tried this same test on SQLServer 2005 with the same driver. Here are my driver/database version details for my most recent test which I screencasted:

    getDriverName Microsoft SQL Server 2005 JDBC Driver - Beta 1
    getDriverVersion 1.0.107.104

    getDatabaseMajorVersion 8
    getDatabaseProductVersion 8.0.760

    Rob

     
  • Rob Manning

    Rob Manning - 2008-12-23

    The older 2005 driver I was using masked the behavior that is described in this ticket. I updated my driver to version 1.2.2828.100 and now I can see the problem. I'll try to look in to it next.

    Rob

     
  • Rob Manning

    Rob Manning - 2008-12-23
    • assigned_to: nobody --> manningr
    • status: open --> open-accepted
     
  • William Daul Hill II

    I'll do it tomorrow morning at work. And get back to you when I've checked it.

    Cheers,
    Daul.

    PS Merry Christmas/ Happy Chanukkah/ Happy Kwanzaa (or just Season's Greetings!)

     
  • William Daul Hill II

    I checked the snapshot (20081223-1034) for the problem I was experiencing, and it does fix the problem with both the mssql2000 and mssql2005 drivers.

    Cheers,
    Daul.

     
  • Rob Manning

    Rob Manning - 2009-01-05

    Then I'll roll the fix into 2.6.x branch for the 2.6.9 release. Thanks!

    Rob

     
  • Rob Manning

    Rob Manning - 2009-01-31

    The fix for this that was verified by Dahl for the snapshot release has been back-ported to 2.6.9, which will be released shortly.

    Rob

     
  • Rob Manning

    Rob Manning - 2009-01-31
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks