Question

i creating a windows application from VS2010 under Win7 64Bit and its work fine... then i build the app and i copy the app to another machine that work under Win XP SP2 32Bit.

When i try to running the app its work fine and when i try to connect to mysql database i got some error like this:

Error [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and not default driver specified.

this is my conection string :

Dim MysqlCon As New MySqlConnection
        Dim OdbcCon As New OdbcConnection

        Dim ConnString As String = ("Dsn=SqlConn;Server=192.168.10.1;uid=USERID;pwd=PASSWORD;database=DATABASE;port=3306")
        OdbcCon.ConnectionString = ConnString
        OdbcCon.Open()

some people says i have to change my connection string but no one can tell me the right connection string..

how can i resolve this problem? sory for my bad english.

RESOLVED :

On Windows XP

  1. Open Control Panel - Administrative Tools - Data Source (ODBC)

  2. Under "User DSN" click "Add"

  3. In my case i choose "MySQL ODBC 5.2 Unicode Driver"

  4. Data Source Name:SqlConn, TCP/IP Sever:192.168.10.1, User:USERID, Password:PASSWORD, Database:DATABASE

  5. OK

this simple step is working.. thanks for the answer.

Was it helpful?

Solution

The error is pretty clear. On your development machine you have an ODBC entry for the database you are trying to connect to. On the test machine you do not.

On your development machine go to :

Control Panels -> ODBC -> UserDSN(tab)

On that tab you will have an entry for SqlConn. You need to replicate this entry on any system that you will be running your software on. Your database is a MySQL database so you will probably also need to install the MySQL ODBC Driver.

To make it nice for your users you can have your application install the MySQL driver with an installer and you can also add the ODBC entry programmatically. The latter can be done using either the standard API, or by hacking the registry. The API is probably the better plan.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top