VB SCRIPT connect to remote mySQL database

Okay, I have the attached code which connects to a MSSQL server.  What I want, if possible, is the most similar code I can that will connect to a mySQL server.  I would like the syntax to be as similar as possible.
Dim cConnection
Set cConnection = CreateObject("ADODB.Connection")
DBConString = "Provider=SQLOLEDB.1;Data Source=servername;Initial Catalog=Portal_Test"	
cConnection.Open DBConString,"username","password"
SQLstmt = "SELECT ServerName, Notes from ServerData"
Set RS = cConnection.Execute(SQLstmt)	
Do While (not RS.EOF) and (intCount < 5)
	'msgbox RS.Fields("ServerName").value
	intCount = intCount + 1

Open in new window

Who is Participating?
Cameron_SConnect With a Mentor Commented:
The only way I have been able to do it was via DSN, so you will need to download an ODBC DSN connector for it.

I also tried this website back in the day for connecting via mySQL within VBS: http://www.connectionstrings.com/mysql#31

Here is an article as well: http://www.visualbasicscript.com/m_36318/tm.htm

...and finally, this forum has some interesting posts: http://forums.nicelabel.com/viewtopic.php?t=886&sid=23c9ec945f5ac2985d4db7edb6e879e2
CerixusAuthor Commented:
DSNless if possible...
CerixusAuthor Commented:
okay forget it, I'll settle for ANYTHING that will connect to a mySQL database on a REMOTE server using VB Script, NOT ASP or asp.net.  I'm talking a .vbs file.
CerixusAuthor Commented:
Right now this is what I have, but I keep getting the error:

"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
set mycon = CreateObject("ADODB.Recordset")
mycon.ActiveConnection = "dsn=ServerName;uid=username;pwd=password;"
mycon.Source = "SELECT ServerName FROM serverteam.servers"
mycon.CursorType = 0
mycon.CursorLocation = 2
mycon.LockType = 3
mycon_numRows = 0
Do while (not mycon.eof) and (intCount < 5)
	msgbox mycon("ServerName")

Open in new window

CerixusAuthor Commented:
Yeah, I came across all three of those links in my searches, but still had no luck.  I went ahead and just ran it locally form the server with the mysql database.  It's just a one (or two) time script to export everything to a MSSQL server anyway, so I guess I won't worry about it.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.