[RESOLVED] adodb mysql connection troubles
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 24

Thread: [RESOLVED] adodb mysql connection troubles

Threaded View

  1. #1
    Join Date
    Sep 2011
    Posts
    12

    [RESOLVED] adodb mysql connection troubles

    Hello. I am working on a project where I need to connect to a mySQL server from vb6.

    I have written a php web-app for my client which has no troubles accessing the database --
    I have also written several database apps with vb using data from servers that I have put together myself. BUT I can't seem to figure out the connection string (or whatever else is missing) to connect to the same database that I can access easily with php.


    Below is the vb code that I am trying to connect with, followed by the php I use to access the same server. I've also provided a copy of the server info to confirm the sql version and driver compatibility)


    It errors with: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified." on the line con1.open cst


    Could someone point me in the right direction?

    The error message seems to me its saying two different things. ..But which one is causing the issue? I've specified a default driver (it may be incorrect, but it's specified ) And I'm not sure what else I would use for a data source name. Could it be having an issue with the fact that the server is routed through port 805? Is it possible there are missing drivers/software on the server that I would need to get installed? Should I be using a different method to connect from vb? Maybe it doesn't like the blank password? ... But it's complaining about the default driver and data source name... Sounds to me like its having connection issues :s

    Thanks in advance for any input.


    ===== VB6 CODE =======
    Dim con1 As New ADODB.Connection

    cst = "Driver={mySQL ODBC 5.1 Driver};Data Source=xxx.xxx.xxx.xxx;Port=805; Database=db_name;User=dbusr01; Password=;"

    con1.open cst



    ===== PHP ======
    <?
    $DBSERVER="xxx.xxx.xxx.xxx:805"; // database server
    $DBUSER="dbusr01"; // database user
    $DBPASS=""; // database password
    $DBNAME="db_name"; // database name

    $con_trucking = mysql_connect($DBSERVER, $DBUSER, $DBPASS) or die ("Error #721");

    mysql_select_db($DBNAME, $con_trucking);
    ?>



    ===== SERVER INFO =====

    MySQL

    * Server: localhost via TCP/IP
    * Server version: 5.1.33-community
    * Protocol version: 10
    * User: root@localhost
    * MySQL charset: UTF-8 Unicode (utf8)

    Web server

    * Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.9
    * MySQL client version: 5.0.51a
    * PHP extension: mysql
    Last edited by thephaze; September 22nd, 2011 at 09:25 AM. Reason: typo in connection string

Tags for this Thread

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