vb.net 2010: Can't connect to a MySQL DB (64 bit) under Windows 10

Hi there, I'm trying to write a vb.net program (VS 2010) that connects to a MySQL DB (64 bit) under Windows (10).

Amongst other attempts these are my recent once:

     Dim MyConString As String = "DRIVER={MySQL ODBC 5.3 Unicode Driver};" & _
     "SERVER=localhost;" & _
     "DATABASE=CitraTest;" & _
     "UID=xxxx;" & _
     "PASSWORD=xxxx;" & _
     "OPTION=3;"

' -------------------------------------------------------------------------------------------

     Dim MyConString As String = "Provider=MSDASQL;" & _
"DRIVER={MySQL ODBC 5.3 Unicode Driver};" & _
     "SERVER=127.0.0.1;" & _
     "PORT=3306;" & _
     "DATABASE=CitraTest;" & _
     "UID=xxxx;" & _
     "PASSWORD=xxxx;" & _
     "OPTION=3;"

' -------------------------------------------------------------------------------------------

  Dim MyConString As String = "DSN=CitraTest;" & _
"SERVER=127.0.0.1;" & _
  "DATABASE=CitraTest;" & _
  "UID=xxxx;" & _
  "PASSWORD=xxxx;"

  'Connection
  Dim MyConnection As New System.Data.Odbc.OdbcConnection(MyConString)
  MyConnection.Open()

The error message is always the same:

20.10.2016, 16:57:26.8 Connection State::Closed
20.10.2016, 16:57:26.8 System.Data.Odbc.OdbcException (0x80131937): ERROR [IM002] [Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben
bei System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
bei System.Data.Odbc.OdbcConnectionHandle..ctor(OdbcConnection connection, OdbcConnectionString constr, OdbcEnvironmentHandle environmentHandle)
bei System.Data.Odbc.OdbcConnectionOpen..ctor(OdbcConnection outerConnection, OdbcConnectionString connectionOptions)
bei System.Data.Odbc.OdbcConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
bei System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
bei System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
bei System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) bei System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)
bei System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
bei System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
bei System.Data.Odbc.OdbcConnection.Open()
bei MySQLDB.Script.StartScript() in C:\Users\Wolfgang\AppData\Roaming_CitraTest_2010\MySQLDB\MySQLDB.vb:Zeile 62.

THANKS A LOT IN ADVANCE FOR YOUR FEEDBACK!!!

0
edit delete
are you sure?
asked Wolfgang Scheer

2 answers

Looks like you did not install the driver ("MySQL ODBC 5.3 Unicode Driver") on the machine running that code.

Also be aware of 64/32 bit quirks. If your code running 32-bit mode and driver installed is 64-bit this error would occur.

0
edit delete
are you sure?
answered Richard Honnenheim

Hi Richard,
Thx for your reply! I just found the solution:

  Dim MyConnection As New MySql.Data.MySqlClient.MySqlConnection
  Dim myConnectionString As String

  myConnectionString = "server=127.0.0.1;" _
             & "uid=xxx;" _
             & "pwd=xxx;" _
             & "database=CitraTest;"


  MyConnection.ConnectionString = myConnectionString

  MyConnection.Open()

This can be closed.

1
edit delete
are you sure?
answered Wolfgang Scheer

Post an answer but please log in first

Post Answer
  1. Please log in to post answer

Similar Questions

Tagsfor this question

Forumall questions