connecting web server and remote db server via asp
im a newbie in asp and totally new to forums like this.
my prob is i have 2 different computers, one that runs my asp pages and the other my database server (mySQL). im working on my local and trying to connect my remote database with my remote webserver using DSNless connection string as more advisable. I installed a myodbc (driver) in my local, supplied the connection details in the data source configuration. (i followed this http://www.devarticles.com/c/a/ASP/...base-Via-ASP/3/ instructions about either connecting to the mySQL db using a System DSN or the Connection String.)
although i was able to query the db already using the System DSN way but only via localhost as testing webserver. i want to connect the remote mysql db to the remote webserver the DSNless connection string approach.
via System DSN:
set adoConn = Server.CreateObject("ADODB.Connection")
set adoRS = Server.CreateObject("ADODB.Recordset")
adoConn.Open "DSN=mysql_dsn"
etc..
via DSNless connection string:
set adoConn = Server.CreateObject("ADODB.Connection")
set adoRS = Server.CreateObject("ADODB.Recordset")
adoConn.Open "Driver={mySQL}; Server=192.168.1.35; Port=3306; Option=0; Socket=; Stmt=; Database=testdb; Uid=root; Pwd=;"
See how your DSNless connstring contains the IP of your db server and your DSN connstring doesn't? THAT'S your problem.
How does your script know where to look? Of course, in the absence of any guidance it checks localhost (hence working locally) but if you need it to look elsewhere you need to instruct it as such.
gRobert's extremely useful link has the appropriate connection in it - I suspect since you've only just downloaded MyODBC you'll need this string for the later versions: "DRIVER={MySQL ODBC 3.51 Driver};SERVER=data.domain.com;PORT=3306;DATABASE=myDatabase; USER=myUsername;PASSWORD=myPassword;OPTION=3;"
Put your server IP address, 192.168.1.35, in Server= as you did with your DSNless connstring.
Bookmarks