Bug #26368 Cannot connect using SQLDriverConnect
Submitted: 14 Feb 2007 13:20 Modified: 14 Feb 2007 13:36
Reporter: Mikko metsola Email Updates:
Status: Not a Bug Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.00.10 OS:Windows (Win XP)
Assigned to: CPU Architecture:Any

[14 Feb 2007 13:20] Mikko metsola
Description:
Hi,

SQLDriverConnect is successful with 3.51.12 connector by using a connection string

Driver={MySQL ODBC 3.51 Driver}; Server=<host>; Port=<port>; UID=<user>; PWD=<password>; DATABASE=<database>"

But it is not possible to connect with SQLDriverConnect by using a connection string

Driver={MySQL Connector/ODBC v5}; Server=<host>; Port=<port>; UID=<user>; PWD=<password>; DATABASE=<database>"

How to repeat:
        SQLHENV henv;
	SQLHDBC conHandle;

	SQLAllocEnv( &henv );

	SQLAllocConnect( henv, &conHandle );

	std::string connectionString  = "Driver=";
	connectionString += "{MySQL Connector/ODBC v5}";
        connectionString += "; Server=";
	connectionString += "<host>";
	connectionString += "; Port=";
	connectionString += "<port>";
	connectionString += "; UID=";
	connectionString += "<user>";
	connectionString += "; PWD=";
	connectionString += "<password>";
	connectionString += "; DATABASE=";
	connectionString += "<database>";

	SQLCHAR inbuf[1024], outbuf[1024];
        SQLSMALLINT outbuflen = 0;
        memset(inbuf, 0, 1024);
        strncpy((char*)inbuf, connectionString.c_str(), 1023);

	rc = SQLDriverConnect(conHandle, NULL,
                            inbuf, SQL_NTS,
                            outbuf, 1024, &outbuflen,
                            SQL_DRIVER_NOPROMPT);
[14 Feb 2007 13:36] Mikko metsola
You can remove this. I just installed 5.00.11 beta, and I was able to connect using DriverConnect.