Results 1 to 3 of 3

Thread: Connecting to SQL Server

  1. #1

    Thread Starter
    Addicted Member riechan's Avatar
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    254

    Connecting to SQL Server

    Hi guys. We're trying to connect to an instance of SQL Server 2000 with this connection string:

    Code:
    Public dbConn As SqlConnection = New SqlConnection("Data Source=192.168.1.2, 1433; Network Library=DBMSSOCN; Initial Catalog=CBIS; User ID='serverinstancename\riechan'; Password='passwordhere'")
    and we get this error:

    A network-related or instance-specific error occured while establishing a connection to SQL Server. The server was not found or was not accesible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

    Questions/Verifications:
    1. Do we have to specify the instance name of the SQL Server in the connection string?
    2. The SQL Server 2000 instance is up and running. I don't understand why it is saying that the server cannot be found.
    3. Is the User ID argument the 'sa' account in the SQL Server? Or is that the database user that you set in Enterprise Manager? I'm thinking that this has something to do with how you install SQL Server, whether it is in Windows Authentication or SQL Server Authentication (since you can't easily set/get the password for the 'sa' account).

    Anyone know how to solve this?
    ====================
    ほんとにどもありがとう!

    Rie Ishida

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Connecting to SQL Server

    Thread moved to 'Database Development' forum

    1. If you are using a named instance, you must specify it (because it is effectively a different server) at the end of the Data Source (eg: Data Source=192.168.1.2, 1433\Instance; ).

    2. If there isn't a default instance, the server won't be found.

    3. You should never use the sa account for anything except high-security DBA activities. You should be using the database user accounts you created.

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Connecting to SQL Server

    Might also try specifying the name of the server, not the IP address.... and 1433 is the default port I believe, and so not necessary to specify it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width