Cant connect to database

  • Hi there,

    Have created an ASP.NET package that points to database via a web.config file. I know the IP address for the machine is correct and the login allows me to access the data as I've typed in these details into SQL Server Agent and the database fires up. I know this may be more an ASP.NET question, but does anybody have ay ideas why the app would report it could't connect to the database? The server in question is Windows 2003. I've made sure that ASP.NET applications has been enabled in the windows components under the add/remove programs as by default Windows 2003 server disables them!

    Many thanks

    Dave

  • Is your password using special charachters ie & which needs to be translated in the web.config (xml)

    replace & with &

     <add key="connString" value="data source=mysqlserver; initial catalog=northwind; workstation id=webserver; User ID=webuser;Password=pass&amp;word" />

  • Thanks for the response. The connection string in question is in the format of:

    <

    add key="connectionstring" value="data source=10.9.675.3;initial catalog=NW_Data;user id=LOGIN;password=aaabbb"> </add>

    Theres no special characters used. Is their any sort of ASP.Net permission/feature that may cause the error?

  • Check the port that sql server is running on.  You may need to add it to this:

    data source=10.9.675.3,port#;

    Another technique which seems easy is to create a sql server alias (TCP/IP) on the web server.  Under "Client Network Utility".  Name the alias whatever you want, but have it point to your IP address and sql server port.  After this is done just change your web.config to point to the alias:

    data source=myAlias;

    Of course you need the sql server client tools installed on the web server to create this alias, but that shouldn't be a big issue.

     

  • Thanks for that. We've created a modified page in the system to throw back the actual error as opposed to 'Couldn't connect to database'. Will try suggested port number and will keep you posted,

    Cheers

    Dave

  • I had also a connection problem; since I add in the connection string following statement it works:

    <Network Library=DBMSSCOCN>

    "PROVIDER=SQLOLEDB;Network Library=DBMSSOCN;DATA SOURCE=your IP;Initial Catalog=your DB;UID=your User;PWD=your PW"

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply