If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] adodb mysql connection troubles

Hello. I am working on a project where I need to connect to a mySQL server from vb6.

I have written a php web-app for my client which has no troubles accessing the database --
I have also written several database apps with vb using data from servers that I have put together myself. BUT I can't seem to figure out the connection string (or whatever else is missing) to connect to the same database that I can access easily with php.

Below is the vb code that I am trying to connect with, followed by the php I use to access the same server. I've also provided a copy of the server info to confirm the sql version and driver compatibility)

It errors with: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified." on the line con1.open cst

Could someone point me in the right direction?

The error message seems to me its saying two different things. ..But which one is causing the issue? I've specified a default driver (it may be incorrect, but it's specified ) And I'm not sure what else I would use for a data source name. Could it be having an issue with the fact that the server is routed through port 805? Is it possible there are missing drivers/software on the server that I would need to get installed? Should I be using a different method to connect from vb? Maybe it doesn't like the blank password? ... But it's complaining about the default driver and data source name... Sounds to me like its having connection issues :s

Re: adodb mysql connection troubles

Also, port 805??? According to you php code, the default port setting for mysql was used, so the port would be 3306.

Doesn't this line indicate to use port 805? Im pretty sure it gave me errors when I didn't specify a port: $DBSERVER="xxx.xxx.xxx.xxx:805"; // database server

I've tried in vb to use "xxx.xxx.xxx.xxx:805" as the data source, as well as no port identification. Also tried the connection string with and without the port definition parameter.

I've seen some implementations of the odbc connection string and they use a "server:xxx;" and an "address:xxx" parameter. There's obviously a difference between the two? or would this just be for different versions of the odbc connector? Could I be missing something like this?

Re: adodb mysql connection troubles

Ask the administrator to provide valid credentials. Pretty much impossible to guess with partial info.

I'm not trying to guess. I'm trying to establish the reason as to why I am having this issue.

I tried connecting again following the code from the link you provided (which was pretty much the same as my many other attempts).... BUT it still timesout and stops responding.

Sure, I could ask the admin for "valid credentials"... but as far he and I are concerned, I shouldn't need anything more from him. If I am going to ask for "better credentials" I would at least like to know what I am asking for. I have root access to phpadmin and can create new users and databases for the sql server. I don't know what else he would be able to provide that would be able to help.

...what would make the mySql software stop responding and make vb stop responding and crash when I try to connect? I didn't have this issue with connections from other projects I have built.

Re: adodb mysql connection troubles

the actual statement, or did you just mistype it here in the forum?
Please follow the flow of the quotes and there is qite oviously an error.
I only guess, that db_name is a variable holding the actual name of the database. So a properly concatenated open-string would be:

Re: adodb mysql connection troubles

Well, just a maybe stupid question:
Is that the actual statement, or did you just mistype it here in the forum?

Hi, thanks for actually taking the time to read what I posted

Yes, it was a typo just on the forum post.

In my actual application I am using a variable for the db_name, but for now I am just trying to get a connection to work with pretty much a blank form and a command button in vb (to narrow down possible issues).

I can't establish a connection through the mySql connector software either. - It just 'stops responding'. I'm pretty sure I don't have any typos when filling in the required input fields.

It feels like I'm missing a piece of the equation, but I don't know what it is...

Re: adodb mysql connection troubles

Back now.

It appears that you probably do not have the rights to access this db remotely. Try downloading the mysql workbench from the mysql site, and setting up your connection in that. If you can connect with that, you can connect through ODBC. If you can't your need to grant privileges on your user to access the MySQL server remotely. I am not sure how to do it through PHPAdmin, so you might have to google that. If you have direct access to the server, see here.