Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 3rd, 2013, 04:11 PM
kniskernlm kniskernlm is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 kniskernlm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 37 sec
Reputation Power: 0
Connecting to mysql server

Hopefully this is the right place...

I have an HTA application that runs on the desktop. So far it works really well. Recently I was wondering if it was possible to connect to a mysql server that is running on my computer? If so... how do I go about connecting and using the database via HTA/vbscript? Or does someone have another suggest that would work? I'm flexible!

Reply With Quote
  #2  
Old February 3rd, 2013, 05:24 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 18 h 51 m 19 sec
Reputation Power: 4445
Unless something has changed in recent years, you need to visit the mysql site and download the mysql ODBC drivers. Then as long as you have no firewall blocking the path to your mysql server you can create an ADO connection to the mysql database.

Google will find you plenty of examples of using ADO with VB and VBScript. There are some VB examples in the myodbc documentation too.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
  #3  
Old February 4th, 2013, 06:37 PM
kniskernlm kniskernlm is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 kniskernlm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 37 sec
Reputation Power: 0
Doug,

Thanks for the help! I did find some great examples but I'm still a bit stuck. I followed several of the examples but for some reason I'm getting an error message.

I'm running MySQL 5.5
I have Connector ODBC 5.2 installed

I have no problems connecting and using the MySQL server from the command prompt... but I just cannot figure out a working ADO connection that will work via vbscript.

The latest example is:
SQL = "SELECT * FROM master"
ConnString = "Server=localhost; Database=catalog; User=loop; Password=loopy;"
Set Connection = CreateObject("ADODB.Connection")
Set Recordset = CreateObject("ADODB.Recordset")
Connection.Open ConnString

If I try and connect I get the following error:
[Microsoft][ODBC Driver Manager] Data Source Name Not Found and No Default Driver Specified

Any thoughts?

Reply With Quote
  #4  
Old February 6th, 2013, 06:46 AM
debasisdas's Avatar
debasisdas debasisdas is offline
Humble Learner
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2007
Location: Bangalore, India
Posts: 279 debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)debasisdas User rank is First Lieutenant (10000 - 20000 Reputation Level)  Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3Folding Points: 1142847 Folding Title: Super Ultimate Folder - Level 3
Time spent in forums: 2 Months 3 Days 4 h 56 m 45 sec
Reputation Power: 118
Send a message via ICQ to debasisdas Send a message via AIM to debasisdas Send a message via Skype to debasisdas
Try creating a DSN for connection to MySql
Use the DSN in the connection string.
__________________
http://folding.extremeoverclocking.com/user_summary.php?s=&u=472288

Reply With Quote
  #5  
Old February 6th, 2013, 05:56 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 18 h 51 m 19 sec
Reputation Power: 4445
Your connection string is wrong. Here's an example for MyODBC 5.1 but you may need to check for what to use with 5.2

http://www.connectionstrings.com/my...ector-odbc-3-51

Reply With Quote
  #6  
Old February 7th, 2013, 05:47 PM
kniskernlm kniskernlm is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2013
Posts: 3 kniskernlm User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 37 sec
Reputation Power: 0
Okay... I corrected the string but it still wouldn't work. I tried the DNS and well... it worked but didn't.

If I put the connection string for the DNS in a stand alone VBS file it works fine.

If I include the VBS file as part of the HTA application it gives the above error.

Is there something special about HTA's that might be preventing it from accessing the DNS connection?

PS: Thank y'all for your patience in helping with this!

Reply With Quote
  #7  
Old February 7th, 2013, 09:25 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,257 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 18 h 51 m 19 sec
Reputation Power: 4445
What is an HTA application? Is that some part of visual basic, and if so what version of VB includes it?

Reply With Quote
  #8  
Old March 29th, 2013, 08:14 AM
necproi necproi is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2013
Posts: 13 necproi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 47 m 35 sec
Warnings Level: 5
Reputation Power: 0
You can simply use

Public cnnConection As ADODB.Connection

Set cnnConection = New ADODB.Connection
With cnnConection
.Open "Provider=SQLNCLI10;Server=USER\SQLEXPRESS;Database=Name;Trusted_Connection=yes; Encrypt=yes"

Easy and simple ....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Connecting to mysql server

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap