Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Could not locate entry in sysdatabases for database

Options
  • 05-02-2008 4:35pm
    #1
    Closed Accounts Posts: 5,284 ✭✭✭


    I've made an asp.net/c# wrapper for sql script generated from my local sql server 2005 to populate a sql server database on a shared hosting environment.

    There's a problem connecting to the database:

    These connection strings I've tried:

    server=(correct server name);database=(correct database name);uid=(correct uid);pwd=(correct password)

    server=(correct server name).ie;uid=(correct uid);pwd=(correct password)

    (the default database for the uid is the database I am trying to access)

    I get the following error:

    Could not locate entry in sysdatabases for database (database name)

    I know the host and uid and pwd are correct because if I change the uid or the pwd, it gives an error saying login failed instead.

    Any ideas?

    Thanks


Comments

  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    Here's the wrapper:

    protected void cmdGo_Click(object sender, EventArgs e)
    {
    string sqlConnectionString = txtConnectionString.Text;
    FileInfo file = new FileInfo(Server.MapPath(Request.ApplicationPath + "//script.txt"));
    string script = file.OpenText().ReadToEnd();

    SqlConnection conn = new SqlConnection(sqlConnectionString);
    SqlCommand cmd = new SqlCommand(script, conn);
    cmd.Connection.Open();

    cmd.ExecuteNonQuery();

    cmd.Dispose();

    }


  • Closed Accounts Posts: 81 ✭✭dzy


    This may sound silly, but have you tried connecting to the database server through a client GUI application and open the database manually? Use the exact same server address and double check for any typos in the database name.

    Also, perhaps try connecting to the server as an administrator and run the query : Select * From Sysdatabases where name='database name'. Check that a result row is returned.


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    have you tried connecting to the database server through a client GUI application and open the database manually? Use the exact same server address and double check for any typos in the database name.

    -yes. There are no inconsistencies between the server names/uids etc of the gui connection and the connection string

    Also, perhaps try connecting to the server as an administrator and run the query : Select * From Sysdatabases where name='database name'. Check that a result row is returned.

    -I can see the database in the gui already. It is definitely there.


  • Closed Accounts Posts: 81 ✭✭dzy


    pwd wrote: »
    -I can see the database in the gui already. It is definitely there.

    All the same, can you still try running the query on the master database? Something must be wrong.


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    The gui on the host is this:

    http://www.myopensource.org/internet/asp.net+enterprise+manager/download-review

    There is a query button, but it doesn't seem to respond to queries. That's why I made the wrapper to run the script, instead of just pasting it in there. I don't know if I would have enough rights to run a query there because it's a shared host - there are other people's databases on the same server. I can see the database in the gui however, as well as users.


  • Advertisement
  • Closed Accounts Posts: 81 ✭✭dzy


    I think its going to be difficult for you to troubleshoot this one if you can't run queries on the master database or check the server configuration. If I were you I'd get in touch with whoever is hosting your database and explain the problem. It doesn't seem to be a problem on your side.


  • Moderators, Society & Culture Moderators Posts: 9,689 Mod ✭✭✭✭stevenmu


    That error means it's connecting to the SQL server ok, just not the actual DB you want it to.

    Sounds like maybe a permissions problem, can you choose what uid/pwd the GUI connects with?

    Only other thing I could suggest is to use "Initial Catalog=(dbname)" instead of "database=(dbname)"


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    I contacted the support service. They said they'd passed it to the windows engineer who would look at it in the morning.

    You are probably correct that it is a permissions issue. If I try to edit the user in the manager, I see that no permissions are selected for db. If I try to give permissions it says "User does not have permission to perform this action." The same message is displayed if I try to assign it the role of database owner.


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    from their support:
    I get the same error - have you used this MS SQL manager before? I mean as far as I know due to security updates by microsoft the control panel
    software on the hsphere control panel (MSSQLManager) can no longer access our MSSQL servers. We would advise either useing enterprise manager from microsoft or a free querying tool like Aqua Data studio, available to download from www.aquafold.com to query your servers

    Don't think you can connect over the internet with enterprise manager/Management Studio. I doubt aquafold would help, and it is only free if you are developing open source applications, which I'm not.
    There's no indication anywhere on their site that their online query tool doesn't work.
    Thanks for the replies so far. Hopefully the windows engineer will be able to help.


  • Registered Users Posts: 2,781 ✭✭✭amen


    internet with enterprise manager/Management Studio

    not true.

    You will need the ip address of the SQL Server.

    Your problem is most likely that the user are you connecting as has not access rights to the database.

    Best thing is to get the Windows engineer to connect to the sql server and give your username/password the correct rights/permissions on your database.

    or write a sql script to do that and get him to run it from Master


  • Advertisement
  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    not true.

    You will need the ip address of the SQL Server.

    That's useful to know. Thanks.

    They changed the permissions to give full access to the db. Still got the error.
    I replaced the script file that was generated with a single line test file.
    No error.
    So it's a problem with the sql script.
    I found out they are running 2000, not 2005 like I thought. The script was generated in 2005. I don't know if that is the cause of the issue, but it probably is because I didn't get the error when I ran it on my local install.
    Asked them to change it to 2005 (which is offered as part of the hosting package).


  • Closed Accounts Posts: 1 areel


    Hi

    If you are trying to run a script as an ADO.Net command you will have problems with GO 'statements'.

    Have a look at the following as a way to get your scripts executing without having to 'cut' them up into separate commands.

    http://weblogs.asp.net/jgalloway/archive/2006/11/07/Handling-_2200_GO_2200_-Separators-in-SQL-Scripts-_2D00_-the-easy-way.aspx


Advertisement