Results 1 to 2 of 2
  1. #1
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    MYSQL ODBC Remote Link Driver Opens if NO Internet

    I am using a small VB6 app that links to an Access Database
    and uses an SSH tunnel once a day to link to a remote MySQL database using MYSQL ODBC Driver 3.51.11-2 for windows.

    I can open and close the tunnel just fine
    and I have configured the ODBC
    In fact everything is just Hunky Dory when there is an Internet connection.

    However, because the tunnel uses localhost, it opens just fine even if there is no internet.
    It is only when the ODBC driver tries to connect to the remote site that I have the problem.

    If there is NO Internet connection at this point, the ODBC Driver dialog pops up.
    I cannot see a way to stop this happening.
    It stops the app at this point waiting, but the app should run transparently twice a day.

    So, what I need is one of the following.

    1. A way to stop the darn driver dialogue appearing so the code can continue to run.
    If it doesn't appear I can trap the error when I try to get data from the remote table.

    or

    2. A way (some API I guess) to detect if there is a working internet connection.
    Which I can use before I try to get the app to talk to the remote sql database.
    But I have no idea how to do this.

    3. Any other sensible suggestion.

    Love some help on this because it all works just dandy apart from the one little glitch.
    I have a feeling it is the ODBC driver that is to blame.
    And Yes, I have requested info from the MySQL driver development forum as well.

    Many Thanks
    Andrew

  2. #2
    5 Star Lounger AndrewKKWalker's Avatar
    Join Date
    Apr 2001
    Location
    Cambridge, UK
    Posts
    1,020
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: MYSQL ODBC Remote Link Driver Opens if NO Inte

    I have NOT resolved the ODBC driver issue, but I have got an API function that detects an Internet connection.
    At least on IE5 and above based systems. (Which is fine for me)

    I have posted these below in case they help anyone else.

    I STILL NEED AN ANSWER TO THE ODBC DRIVER ISSUE HOWEVER!

    'Internet Connection Testing

    Private Declare Function InternetGetConnectedStateEx Lib "wininet.dll" (ByRef lpdwFlags As Long, ByVal lpszConnectionName As String, ByVal dwNameLen As Integer, ByVal dwReserved As Long) As Long

    Public sConnType As String * 255

    Function IsConnected() As Boolean
    Dim lngRet As Long
    On Error GoTo NoConnectionError

    lngRet = InternetGetConnectedStateEx(lngRet, sConnType, 254, 0)
    If lngRet = 1 Then
    'MsgBox "You are connected to Internet via a " & sConnType, vbInformation
    IsConnected = True
    Else
    'MsgBox "You are not connected to internet", vbInformation
    IsConnected = False
    End If
    Exit Function

    NoConnectionError:

    IsConnected = False
    'MsgBox "Error in Connection Test" & vbLf & Err.Number & vbLf & Err.Description
    Exit Function

    End Function
    Andrew

Posting Permissions

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