MySQL Forums
Forum List  »  Connector/ODBC

Re: Starting off with MySql ODBC
Posted by: Bogdan Degtyariov
Date: July 02, 2018 02:40AM

The problem might be in the connection string (I only quote a part of it):

DRIVER={MySQL ODBC 8.0 Driver};DATABASE=ibsms;PWD=2462;DSN=IBSMSfreestate;

Usually the DRIVER option and the DSN option are not used together.
Note that DSN named IBSMSfreestate should already contain the information about the driver and therefore DRIVER should not be needed. Same goes about all other options specified in the string (DATABASE, PWD, USER, SERVER).

It should be enough just to have a connection string like this "DSN=IBSMSfreestate" because the driver will read all other options that are set for that DSN.
You still can specify other options with DSN if you wish to overrule some options already set in the DSN.

For instance, your DSN connects to a database named "test", but you want to have it connecting to database "ibsms". So, you specify DATABASE=ibsms to change the database and use all other options set into the DSN.

I am concerned about this option in particular:

DRIVER={MySQL ODBC 8.0 Driver}

After you install MySQL ODBC driver package you have two drivers: ANSI and UNICODE and they go by the names as:

DRIVER={MySQL ODBC 8.0 ANSI Driver}
DRIVER={MySQL ODBC 8.0 UNICODE Driver}

The value for DRIVER you used before is most likely wrong because it does no specify which driver flavour is to be used (ANSI or UNICODE). I am saying "most likely" because the driver names can be changed, but that is a topic for another discussion.

As you said the DSN named as IBSMSfreestate was tested and it worked (assuming USER, PWD, DATABASE, OPTION, etc were set correctly). Therefore, you do not need anything else. Your function call should look like this:

Set Conn = wsODBC.OpenConnection("Conn1", , , "ODBC;DSN=IBSMSfreestate;")

Options: ReplyQuote


Subject
Written By
Posted
Re: Starting off with MySql ODBC
July 02, 2018 02:40AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.