Results 1 to 3 of 3

Thread: VB can't connect to SQL Server, all other programs and telnet can

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    2

    Question VB can't connect to SQL Server, all other programs and telnet can

    Hi! I've and old VB 6 application, that tries to connect to a SQL Server DB (2000 and/or 2005), but it can't. It just keep telling me that "can't establish connection with the Data Base", and that´s it. I'm using VBSQL.OCX function SqlOpenConnection for this.

    I've tried other ways to reach the DB, in order to see if it's and external problem but every other test works ok. I've connectet through ODBC, by the SQL Manager of SQL 2008 and 2005, with Java JDBC, and even I did a telnet to the address and the tcp port and it responds OK. I even remove all firewalls, anti-virus and so. I've no idea what to do now

    The .vbp project starts correctly.

    Best regards,

    Raul

  2. #2
    Frenzied Member
    Join Date
    May 2006
    Location
    some place in the cloud
    Posts
    1,886

    Re: VB can't connect to SQL Server, all other programs and telnet can

    You could try the next way (only change for the real names)
    Code:
    '
    Dim MyConStr AS String
    Dim MySQL    AS ADODB.Connection
    '
    '
        MyConStr = "Provider=SQLOLEDB.1;" & _
                   "UID=xxx;" & _
                   "PWD=yyyyyy;" & _
                   "Persist Security Info=False;" & _
                   "Initial Catalog=DBNAME;" & _
                   "Data Source=SERVERNAME"
    
        Set MySQL = New ADODB.Connection
            MySQL.CursorLocation = adUseClient
            MySQL.ConnectionString = MyConStr
            MySQL.Open
            MySQL.CommandTimeout = 0
    Also, it could be helpful if you visit ---> http://www.connectionstrings.com/
    JG


    ... If your problem is fixed don't forget to mark your threads as resolved using the Thread Tools menu ...

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    2

    Re: VB can't connect to SQL Server, all other programs and telnet can

    Quote Originally Posted by jggtz View Post
    You could try the next way (only change for the real names)
    Code:
    '
    Dim MyConStr AS String
    Dim MySQL    AS ADODB.Connection
    '
    '
        MyConStr = "Provider=SQLOLEDB.1;" & _
                   "UID=xxx;" & _
                   "PWD=yyyyyy;" & _
                   "Persist Security Info=False;" & _
                   "Initial Catalog=DBNAME;" & _
                   "Data Source=SERVERNAME"
    
        Set MySQL = New ADODB.Connection
            MySQL.CursorLocation = adUseClient
            MySQL.ConnectionString = MyConStr
            MySQL.Open
            MySQL.CommandTimeout = 0
    Also, it could be helpful if you visit ---> http://www.connectionstrings.com/
    I can't chance anything, because is an old code that is working right now in many PCs, I only need to run it on my computer because I'm migrating it to Java and need to go line by line in the code. I managed to have it running before, but I reinstalled my computer and can't now, and can't figure out what I'm missing (it has been a pain in the ... always to install this thing)

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