SmarteStudio
November 17, 2017, 11:36:38 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SmarteStudio forum launched!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to feed the automation data from database table, like MySQL, MS SQL  (Read 8480 times)
mykung11
Newbie
*
Posts: 1


View Profile
« on: June 07, 2013, 02:36:03 PM »

Try to attach MySQL and MS SQL database, and get the data feed from those two type of database.
Thanks.
Logged
SmarteStudio Development Team
Administrator
Newbie
*****
Posts: 42


View Profile Email
« Reply #1 on: June 24, 2013, 04:00:51 AM »

Please, see an example published here: http://smartesoft.s3.amazonaws.com/smartestudio/samples/UsingDB.zip

It works with MS Access database (included with example). However it may be changed to work with any other DB that is accessible using ADODB protocol.

The only thing that varies between databases is the connection string.

For MS Access it is:
Code:
var strCnxn = "driver={Microsoft Access Driver (*.mdb)};dbq="+Global.GetFullPath('MSAccess.mdb');

If one needs MS SQL then it should be like:
Code:
strCnxn = "PROVIDER=SQLOLEDB;SERVER="+server+";UID="+user+";PWD="+password+";DATABASE="+db_name;

For MySQL the connection string is like that:

Code:
strCnxn = "mysql://"+user+":"+password+"@"+server+"/"+db_name+"?persist";

In each case user, password, server, db_name - are variables containing corresponding values. These may be replaced right in the connection string like that:

Code:
strCnxn = "mysql://root:admin@localhost/test_data?persist";
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!