Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Connect to MySQl from a VBS Script

Connect to MySQl from a VBS Script

Connect to MySQl from a VBS Script

Please, I need from a .VBS file (inventory.vbs) to connect to a MySQL Database on my local network, but I do not know how to do this, could you help me?

MySQL Server IP:
Login: root
Password: 1234
Door: 3306

I tried the following but it does not work:


Dim rs, strConnectString, strSQL 

Set rs = CreateObject("ADODB.Recordset") 

strConnectString = "DRIVER={MySQL ODBC 3.51 Driver};Server=;UID=root;Password=1234;Database=invetario;Option=3" 

rs.ActiveConnection = strConnectString 

strSQL = "INSERT INTO equipamento (hostname, dt_ultimoLogin) VALUES ('UIT-TI06', now()) ON DUPLICATE key update dt_ultimoLogin = now();" 

rs.Open strSQL 


When I run the "Inventory.vbs" file, an MS-Windows window appears with the following error message:

Line 29 to which the error message refers is:

CODE -->

rs.ActiveConnection = strConnectString 

Just as observation, the MySQL server is hosted on a "Linux - Ubuntu".

At first, for testing purposes only, I'm trying to write only basic information in the database, but as soon as it works, I'll enter a lot of other information.

I will upload the "Inventory.vbs" file together with the Windows Server 2008 Logon Script. This way, whenever the user logs in, the Hardware and Software information will be updated in the Database.

The goal is just to take inventory of hardware and software.

My name is Herivelton, I am from Brazil and my level of fluence in English Language is not very high, so I apologize for any errors in the spelling or in the text.

Thanks to whoever can help me ...


RE: Connect to MySQl from a VBS Script

Check in ODBC Data source administrator 32 bit to see if the driver is indeed installed.

David Paulson

RE: Connect to MySQl from a VBS Script

forum329: VBScript


Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.

Never mind this jesus character, stars had to die for me to live.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close