CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Connection time

  1. #1
    Join Date
    Jan 2013
    Posts
    90

    Connection time

    My VB6 application can connect to the production database located in another state via internet or to the database located on my developement machine.
    From my point of view the time to establish connection should be less when the local database is used. But in reality the connection to the remote database takes about 2 seconds, the time for the local database is about 15 seconds.
    I have the same difference on 3 development machines.
    I'm using ADO, connection strings are very similar:
    Local:
    strConnectionString = "DRIVER=SQL Server;SERVER=(local);UID=;DATABASE=SRSN;Trusted_Connection=Yes"

    Production:
    strConnectionString = "DRIVER=SQL Server;SERVER=RSRNJCOOR;UID=coord;DATABASE=SRSN;pwd=mypass"

    My knowledge in configuration SQL Server is very limited.
    Any advice please.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Connection time

    Locally, you are using a trusted connection which is different than production. What happens when you make this the same?

  3. #3
    Join Date
    Jan 2013
    Posts
    90

    Re: Connection time

    When I use the same format for the connection string for local server
    strConnectionString = "DRIVER=SQL Server;SERVER=(local);UID=coord;DATABASE=SRSN;pwd=mypass" I get an error:
    Name:  SQLError.jpg
Views: 67
Size:  49.4 KB

    What is correct connection string?
    I'm using local copy of the production database. I do a new copy pretty often. With my current connection string I have an issue with the connection opening time only. I would not want to change the string and make me to do some additional changes in the database every time I create a new copy.

    Thank you

  4. #4
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,398

    Re: Connection time

    Quote Originally Posted by chapran View Post
    When I use the same format for the connection string for local server
    strConnectionString = "DRIVER=SQL Server;SERVER=(local);UID=coord;DATABASE=SRSN;pwd=mypass" I get an error:
    Name:  SQLError.jpg
Views: 67
Size:  49.4 KB
    Well, this error message is pretty clear: just report your DB admin!
    I guess, your local SQL Server doesn't have/know an account with SQL login user name "coord" and password "mypass".
    Victor Nijegorodov

  5. #5
    Join Date
    Jan 2013
    Posts
    90

    Re: Connection time

    Thank you.
    "Report to your Administrator" is the error handler I wrote. In MSSQL Management studio I found coord user, I reentered the password for it and the error message changed. Now it says that the account is disabled.
    Name:  SQLError_02.jpg
Views: 68
Size:  58.8 KB
    I see coord user in 2 places in MSSQL Management Studio:
    Name:  SQLError_03.jpg
Views: 66
Size:  66.3 KB
    I opened coord properties:
    Name:  SQLError_04.jpg
Views: 66
Size:  39.4 KB

    What and where else should I check in order to make the connection string work with similar to production server format?

    Thank you

  6. #6
    Join Date
    Jan 2013
    Posts
    90

    Re: Connection time

    In my initial posrt I gave the database with different name. In reality the same correct database is used for both connections.

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Connection time

    As I mentioned in my original reply, you are use different forms of authentication when connecting to the database (i.e. local using trusted vs. sql user/pw).

    To track this down, you are going to have to connect with the same form of authentication (trusted or sql user/pw) to rule out if it's a local connectivity issue or a difference in authentication issue.

    This isn't a code problem.

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

Featured