Results 1 to 5 of 5

Thread: connecting to MySQL.........help needed....

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    more help needed.......

    hi,

    I need to connect to MySQL from my VB application. To open a connection,as hkmai said, I used the code:

    Dim cn As New ADODB.Connection

    'To establish connection string to MYSQL database

    cn.Open "Provider=MSDASQL;Driver=MySQL;Data Source=[datasource name];Database=[name of database];Server=[IP address where MySQL database resides];UID=[username];PWD=[password];PORT=3306;FLAG=1;"

    where:
    [datasource name] --> DSN as in control panel
    [name of database] --> database name as in MySQL
    [username] --> root
    [password] --> I left it blank



    When I try connecting i get an error message "ADO could not fing the secifies provider"

    What is it that I've got to do to correct this?

    Thanks a lot.

    [Edited by rammy on 04-06-2000 at 04:26 AM]

  2. #2
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Hi there, I believe that if you have a system DSN on your machine you only need to do the following:

    cnn.Open "DSN=[datasource name]",root

    When you create a system DSN you allredy have chosen your ODBC driver and location.

    Good luck,

    André

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    more help needed.....


    It still doesn't work. I had created a user DSN before. Does that make any difference? I tried the same with a system DSN and got the same error message:
    "ADO could not find the specified provider".

    Do I need to include anything under
    Project--> References??? or maybe use another provider???

    Thanks.

  4. #4
    Addicted Member
    Join Date
    Jun 1999
    Location
    Los Angeles
    Posts
    186
    Hi again,

    this sounds strange, please confirm your way of creating a system DSN.

    Are you running Windows NT? 98?

    the MSDAC installed in your machine may not be properly registered or you don't have MSDAC installed.

    Try this on a command prompt:
    REGSVR32 "C:\Program Files\Common Files\System\ole db\MSDASQL.DLL"

    then try your program again, remember (as I forgot" to put quotes aroud your user name:

    cnn.open "DSN=[data source name]","root"

    If you are unavailable to register the msdac dll you can freely dowload it from the following URL:
    http://www.microsoft.com/data/download.htm


    Let me know if it works,

    André

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298

    VB & MySQL......system DSN....

    Hi Andre,
    I dont know how I missed mentioning the platform i work on. Sorry abt that! I work on VB6 with Windows 95/NT .....95 mainly.

    I ran:
    REGSVR32 "C:\Program Files\Common Files\System\ole db\MSDASQL.DLL" .........

    and I think my program is on the way to working.....my Internet connection was down during the afternoon(my time) and so I couldn't test it. Will let u know if it works. Thanks a lot.

    Here's how I created a system DSN:

    Start-->Settings-->Control Panel-->ODBC32
    I then went to the System DSN tab and clicked on Add. I then selected MySQl driver and clicked Finish.

    I was prompted for the:
    DSN name,
    server name,
    database,
    user,
    password,
    port,
    options.

    Of these I left password, port and options blank.

    Hope this was what u wanted to know.

    Thanks again.

    [Edited by rammy on 04-07-2000 at 12:07 AM]

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