CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2010
    Posts
    1

    Question Connection VB6 to Server Mysql Very Slow

    Please information, I created a projects by VB6 and Database MySql. When I connection to server local (127.0.0.1) courses walked smoothly and quick once, however when Database existing in Server or another computer with connections IP courses running but when open connections ages 10-20 seconds.
    please enlightenment. my connection like this:

    Set strCon = New ADODB.Connection
    Dim StrString As String
    Dim ser, user, pass, db, soc, pro As String
    ser = "10.0.0.1" 'ip komputer server
    db = "mydb"
    user = "myuser"
    pass = "mypass"
    soc = "UTF8"
    pro = "UNIX"
    StrString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER= " & ser & ";DATABASE=" & db & ";UID=" & user & ";PWD=" & pass & ";Protocol=" & pro & ";port=3306; OPTION=2105"
    strCon.Open StrString
    strCon.CursorLocati on = adUseClient

    Please help.?

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Connection VB6 to Server Mysql Very Slow

    I doubt that it is causing that big of a deal but the way you have defined your variables is not good.
    ser, user, pass, db, soc will all be defined as variant and only pro will be defined as string. In general this is slower and wastes memory space but again I doubt it is causing a huge issue.

    Some times the useclient cursor setting can slow you down

    other than that it looks ok to me.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Connection VB6 to Server Mysql Very Slow

    Usually slow connections to MySQL have to do with name resolution.

    Try changing the my.cnf file on the server (linux) or my.ini (if windows) and add this line.

    --skip-name-resolve

    Then restart the server. Without that switch, when someone connects, the server tries to do a reverse lookup of the IP address you are connecting from. If your DNS is not set up properly, your connection times may be seconds instead of immediately.

  4. #4
    Join Date
    Dec 2008
    Location
    Step Into(F11)
    Posts
    465

    Smile Re: Connection VB6 to Server Mysql Very Slow

    Please information, I created a projects by VB6 and Database MySql. When I connection to server local (127.0.0.1) courses walked smoothly and quick once, however when Database existing in Server or another computer with connections IP courses running but when open connections ages 10-20 seconds.
    please enlightenment. my connection like this:

    Set strCon = New ADODB.Connection
    Dim StrString As String
    Dim ser, user, pass, db, soc, pro As String
    ser = "10.0.0.1" 'ip komputer server
    db = "mydb"
    user = "myuser"
    pass = "mypass"
    soc = "UTF8"
    pro = "UNIX"
    StrString = "DRIVER={MySQL ODBC 5.1 Driver};SERVER= " & ser & ";DATABASE=" & db & ";UID=" & user & ";PWD=" & pass & ";Protocol=" & pro & ";port=3306; OPTION=2105"
    strCon.Open StrString
    strCon.CursorLocati on = adUseClient

    Please help.?
    I Think.Usually slow connections to MySQL.it is due to connection string.see the following url.
    Code:
    http://www.connectionstrings.com/

  5. #5
    Join Date
    Apr 2010
    Posts
    1

    Re: Connection VB6 to Server Mysql Very Slow

    I used to encounter the same issue when connecting vb6 with mysql. Never really found the reason why, but I have made a work around on it. Initiating an instance of the database connection while still loading the application will eventually enhance the database access.

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