List:General Discussion« Previous MessageNext Message »
From:Roger Davis Date:May 22 2003 3:03pm
Subject:RE: ODBC, MySQL connection...
View as plain text  
Michael,
	A DSN connection does not have to be local.  First set up a DSN and try it
out in something like Access or VisData.  That should tell you very quickly
if everything is ok.  I would suggest you try the connection string from
Mike.  His looks to be complete.  Here is mine from a DAO connection in vb.

Set md_Client = md.OpenDatabase("DBName", dbDriverComplete, False,
"ODBC;DATABASE=MySQLDatabaseName;UID=MySQLUser;PWD=MySQLUsersPassword;DSN=Th
eNameoftheDSN;SERVER=" & IPAddr & ";")

Hope this helps
Roger

> -----Original Message-----
> From: Michael Burbidge [mailto:mburbidg@stripped]
> Sent: Thursday, May 22, 2003 8:06 AM
> To: mysql@stripped
> Subject: ODBC, MySQL connection...
>
>
> I have a Windows machine running MySQL. I'm trying to connect to it
> from a remote machine and execute queries using ODBC. I have installed
> the MyODBC driver on the Windows machine and it show up in the data
> sources setting dialog. I want to connect using a DSN-less connection.
> But I can't seem to get the parameters right in my SQLConnect call. I
> would actually settle for a DSN connection, but my understanding is
> that DSN connection can only be local.
>
> Here's the relevant snippet of code:
>
> string server("DRIVER={MySQL ODBC 3.51 Driver}; SERVER=153.32.225.44;
> PORT=3306; OPTION=3; DATABASE=test;");
> string user("");
> string password("");
>
> SQLHENV henv;
> SQLRETURN result = SQLAllocEnv(&henv);
> validate_result(result);
>
> SQLHANDLE hdbc;
> result = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);
> validate_result(result);
>
> result = SQLConnect(hdbc, (SQLCHAR*) server.c_str(), server.size(),
> NULL, 0, NULL, 0);
> validate_result(result);
>
> I can connect to the same server if I use the MySQL C API. So I know
> the server is set up correctly and responding to remote requests
> through its own API.
>
> Thanks,
> Michael-
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/mysql?unsub=1

Thread
ODBC, MySQL connection...Michael Burbidge22 May
RE: ODBC, MySQL connection...Mike Hillyer22 May
RE: ODBC, MySQL connection...Dave Christensen22 May
  • RE: ODBC, MySQL connection...Roger Davis22 May