ASP in JavaScript accessing MySQL

CodeGyver used Ask the Experts™
I've been writing a series of ASP pages using JavaScript and I am trying to write the connection string to a MySQL database, but all the examples I find online are written in VBscript.  Try as I might, when I convert the code to what I imagine it should look like in JavaScript, I can't get it to connect.

Here's the ASP I include when a connection is needed.  I need someone to help me fill in the conn_str variable.  If someone could show me a DNS and DSN-less solution, I'd appreciate it.

var conn, conn_str;
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
conn_str = "Driver={MySQL};Server=;DATABASE=INETDB;UID=readonly;PWD=MyPassword;"

replace the IP , databasename, and password with your own.
... and possibly the UID also

Try this:

OLE DB Data Provider Connection:

conn_str = "Provider=MySQLProv;" & _
           "Data Source=mySQLDB;" & _
           "User Id=myUsername;" & _

ODBC DSN-Less Connections:
To connect to a local database

conn_str = "Driver={mySQL};" & _
           "Server=MyServerName;" & _
           "Option=16834;" & _
To connect to a remote database

conn_str = "Driver={mySQL};" & _
           ";" & _
           "Port=3306;" & _
           "Option=131072;" & _
           "Stmt=;" & _
           "Database=mydb;" & _
           "Uid=myUsername;" & _


conn_str = "DSN=mySystemDSN;" & _
           "Uid=myUsername;" & _

ODBC - File DSN:

conn_str = "FILEDSN=c:\somepath\mydb.dsn;" & _
           "Uid=myUsername;" & _

cheers =0)


actually ivanmata, taking that material straight of another website (which coincidently was coded in VB) was no help at all.  I'd seen that site already.  My problem ended up being in the mySQL settings.  knightEknight's solution worked once I got that straighten out.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial