VB6 Connection to MySQL database
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: VB6 Connection to MySQL database

  1. #1
    Join Date
    Dec 2004
    Posts
    16

    Exclamation VB6 Connection to MySQL database

    Hi,
    I'm trying to create a connection to a MySQL database from VB, I'm using the following code but I'm getting this error
    "Error: S1T00[MySQL][ODBC 3.51 Driver]Can't connect to MySQL on 'localhost'(10061)"

    Private Sub Command1_Click()

    Dim cnMySql As New rdoConnection
    Dim rdoQry As New rdoQuery
    Dim rdoRS As rdoResultset

    ' set up a remote data connection using the
    ' MySQL ODBC driver.
    ' change the connect string with your username,
    ' password, server name and the database you
    ' wish to connect to.

    cnMySql.CursorDriver = rdUseOdbc
    cnMySql.Connect = "uid = username; pwd = password; server = serverName;" & _
    "driver={MySQL ODBC 3.51 Driver};" & _
    "database=2005_mag1;dsn='';"
    MsgBox "Error:" + Err.Description
    cnMySql.EstablishConnection

    I can't figure out why this is happening, I'd appreciate any help with this or if someone has another means of making this connection.

    Thanks,

    Mag2.

  2. #2
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: VB6 Connection to MySQL database

    10061 is a winsock error code for "connection refused", meaning that the target machine exists but actively denied the connection attempt. this most often occurs because the requested service is not running or some other software (a firewall) is stopping the connection attempt

    i'd attempt the following from a dos box:

    telnet localhost 3306


    if that doesnt connect, then it's because MySQL server is not running, or is firewalled. doh!
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center