Apache2Triad Help, Support and Development Forum Index Search Profile Log in to check your private messages Log in Register Memberlist Attachments Statistics Crew/Ranks Archive
 connecting to MySQL ODBC
Google
Post new topic Reply to topic
Author Message
Crash0
 
 


Joined: 27 Apr 2005
Posts: 6

PostPosted: Thu Apr 28, 2005 12:59 pm Reply with quoteBack to top

I'm trying to get this to work on my end as well, but having some problems. First off, on mySQL, I made a database named 'test', with 1 table named 'test'. I've built a connection string like this:

Quote:
String MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=192.168.0.5;" +
"DATABASE=mysql;" +
"UID=****;" +
"PASSWORD=*****;" +
"OPTION=3";

//Connect to MySQL using MyODBC
OdbcConnection MyConnection = new OdbcConnection(MyConString);
MyConnection.Open();


(note, I've tried both the fully qualified driver name above, and the shorter MyODBC name you sugested). When I try to run this, I get this error message:

Quote:
[OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified]
System.Data.Odbc.OdbcConnection.Open() +638


I'm not using a DSN to connect to the database, so why it can't find one is beyond me. So, I'm guessing that I need to set up a DSN on the server for that database, and maybe install the MyODBC drivers. I was told (from microsoft) that MyODBC was in the latest version of the .NET SDK, which I have running on that server.

So anyway, I'm missing something. If you have any more advice to give, I'ld be grateful to try some of it out.

Thanks!
Crash
View user's profileSend private message
Vlad Alexa Mancini
lead developer
lead developer


Joined: 07 Jul 2003
Posts: 1539

PostPosted: Thu Apr 28, 2005 2:41 pm Reply with quoteBack to top

What is the value of the Server setting under "Login" in your MySQL ODBC Connector ?
View user's profileSend private message
Crash0
 
 


Joined: 27 Apr 2005
Posts: 6

PostPosted: Thu Apr 28, 2005 6:05 pm Reply with quoteBack to top

not sure how to check that. The computer involved is at home, I wont be back there for a couple hours, unfortunately. I just spent the last 2 hours messing with the SQL server, and here is what I've gotten so far:

First off, I know the SQL server is up and running, I can connect to it via the console on the server. When I set my server=127.0.0.1 in the ASP code, then move the code over to my webserver (I develope on a seperate machine), I can run the code and it seems to work, loggin in as Root. When I leave the server=192.168.0.5 (the ipadress of my webserver), I can't connect to the SQL server from either the webserver itself, or my dev machine.

I did some research, and it looks like the user 'root' can't connect from a remote location. However, I changed that, and now 'root' should be able to connect, but i'm seeing the same error. I still get the error message:

Quote:
Can't connect to MySQL server on '192.168.0.5' (10061)


Sometimes I'll get an error msg listing my host (i.e. the computer I'm trying to connect from) as not being able to connect to the server. I'm completely stumped by this.

As a test, today at work I installed the stand alone MySQL server on my laptop, and using my dev machine at work I was able to set up the MyODBC connection and talk to the laptop MySQL server without any problem at all. I did see the same error at first that I saw at home, but disabling the firewall on the Laptop fixed them, and I was able to connect at will. Disabling my windows firewalls at home had no effect. Both machines are behind my router/firewall, but neither are running the Windows Firewall software.

Anyway, I'm stumped for now. I'll be home in about 3 hours, and I'll probably be hammering away at this all night until it works or I go postal Wink

Crash
View user's profileSend private message
Vlad Alexa Mancini
lead developer
lead developer


Joined: 07 Jul 2003
Posts: 1539

PostPosted: Thu Apr 28, 2005 8:48 pm Reply with quoteBack to top

Crash0 wrote:
not sure how to check that.

do you even know the program for managing your operating system's ODBC drivers then ?
it is called odbcad32.exe and if you run it you can find and configure the mysql ODBC connector from there , and as you can see the server address there defaults to localhost which resolves to 127.0.0.1 not 192.168.0.5
View user's profileSend private message
Crash0
 
 


Joined: 27 Apr 2005
Posts: 6

PostPosted: Thu Apr 28, 2005 8:54 pm Reply with quoteBack to top

I don't have the connector downloaded from mySQL, I'll try that when I get home. As for the .5 thing vs. localhost, please note that I am connecting to the server from across my network (when I am working on my developement machine), and so I must refer to it via it's IP address. This works fine here at work with the MySQL I set up on my laptop. I'll play around with it and try to figure it out. I saw somewhere else that someone was having the same problem, and they fixed it by removing the bind-address=127.0.0.1 from the my.ini file. I'll give that a shot too, and let you know what I find. If removing the bind works, and doesn't break my PHPBB pages, I'll be happy.

Crash
View user's profileSend private message
Vlad Alexa Mancini
lead developer
lead developer


Joined: 07 Jul 2003
Posts: 1539

PostPosted: Thu Apr 28, 2005 9:01 pm Reply with quoteBack to top

Crash0 wrote:
I don't have the connector downloaded from mySQL


If you do not even have it how is it that you are trying to connect to it ?
The connector is the interface of the driver and is part of it and is installed by apache2triad btw .

You can not remotely connect to a server running on loopback see FAQ #16 and if you change the mysql bind address in my.ini you would still have to change the connector setting too to reflect the change

And you can not remotely conect to ODBC in my opinnion , it does not listen for incomming conections in a server-client fashion
View user's profileSend private message
Crash0
 
 


Joined: 27 Apr 2005
Posts: 6

PostPosted: Thu Apr 28, 2005 10:09 pm Reply with quoteBack to top

I just got home, and I tried commenting out the bind-address in the my.ini file. Works like a charm. My test ASP page is working just fine, it connects to the database on the server (when I run the ASP page from visual studio on my machine). I'm pulling the test data out of the test database I built just fine. I should be ok from here on out. I havn't looked at the connector interface yet, but it seems that I wont need too, either. I'll have to test this from outside my firewall, but I don't see it being a problem.

Thanks for all your help, and for building Triad. If you want help testing future releases, drop me a message.

Crash
View user's profileSend private message
Display posts from previous:      
Post new topic Reply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme
All times are GMT