Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-02-2015, 09:51 AM
WilsonGallardo WilsonGallardo is offline
Registered User
 
Join Date: Nov 2015
Posts: 4
how to connecting securecrt to mysql database

hi

I need to connecting a Mysql database from secureCRT, my scrip has the next lines:

Set Cnn = CreateObject("ADODB.CONNECTION")
SConn="provider=MySQL.OBDC.5.3;data"
Source=MySQL
Cnn.open(sConn)

but, the script is´t working, it´s generate a DataBase error

regards

Wilson Gallardo
Reply With Quote
  #2  
Old 12-02-2015, 10:21 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hello Wilson,

I do not have enough information to assist at this time.

What version of SecureCRT are you using?

On what platform?

The lines provided don't seem to have anything to do with connecting via SecureCRT.

Is that the complete script?

Is the MySQL database on the same machine where SecureCRT is installed?

If not, see the Scripting / Script Objects Reference / Session Object topic in SecureCRT's Help file for information on the Connect() and ConnectInTab() methods available to SecureCRT's Session Object.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 12-02-2015, 01:50 PM
WilsonGallardo WilsonGallardo is offline
Registered User
 
Join Date: Nov 2015
Posts: 4
hi, thanks for you answer

* I have a SecureCRT version 7.3.5 (x64 build 903)
* I need create an script to do a ping to many servers, the list ips are in a Mysql database, i need connect SecureCRT to Mysql for run the script
* Database and Segure CRT are in the same pc
* I work in windows 8 and Windows 10
* the complet scrips is the follow. (That script a copy in internet but to Access Database and modify it)

thanks for your help.


#$language = "VBScript"
#$interface = "1.0"


Const ForReading = 1
Const ForWriting = 2
Dim Rst, Cnn, sConn, sTip

Sub Main

crt.Session.Connect "/S PSM_RUN"
Set Cnn = CreateObjet("ADODB.connection")
sConn="Provider=MySQL OBDC 5.3;Data"
Source=MySQL
Cnn.Open(sConn)
sel ="SELECT Cliente,ip,Sede, Tipo FROM direcciones WHERE ip<>''"
Set Rst = Cnn.Execute(sel)
Set fsoerror = CreateObject("Scripting.FileSystemObject")
set fileerror = fsoerror.CreateTextFile("E:\PLANTILLAS DB\errorlogping.txt", True)
Rst.MoveFirst
conterror = 0

Do While Not (Rst.BOF Or Rst.EOF)
str=trim(Rst.Fields("ip").Value)
crt.Screen.Synchronous = True
crt.Screen.Send " ping -c 1 -w 1 -s 8 " & ip & chr(13)
if (crt.Screen.WaitForString(str & " is alive",3)=False) then
crt.Screen.Send Chr(3) & VbCr
fileerror.Write trim(Rst.Fields("ip").Value) & VbCrLf
conterror = conterror + 1
end if

crt.Screen.WaitForString "$",2
crt.Screen.Synchronous = False
Rst.MoveNext
Loop

Rst.Close
Cnn.Close
End Sub
Reply With Quote
  #4  
Old 12-02-2015, 03:04 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Wilson,

Thanks for clarifying.

Quote:
* the complet scrips is the follow. (That script a copy in internet but to Access Database and modify it)
I am not sure what you mean by the above statement. Please elaborate/restate.

I have no familiarity with the format of the MySQL database or how you would access the info.

What is the error message you are receiving?

If you put in some "debugging", such as a message box to check the contents of str, does it contain the expected value from the database?

Or is there any info written to the "error file"?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 12-02-2015, 03:21 PM
WilsonGallardo WilsonGallardo is offline
Registered User
 
Join Date: Nov 2015
Posts: 4
Hi Brenda

I Mean, for Microsoft Access Data Base, the script is

Set Cnn = CreateObject("ADODB.Connection")
sConn = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\mibbdd.mdb;"
Cnn.Open(sConn)

but, i have a MySQL DataBase in my script that is I need.

Set Cnn = CreateObject("ADODB.connection")
sConn="Provider=MySQL ODBC 5.3 Driver; Data Source=MySQL;"
Cnn.Open(sConn)

the Error Messaje is "No se encontró el proveedor especificado. Es posible que no esté instalado correctamente"

thanks
Reply With Quote
  #6  
Old 12-03-2015, 08:16 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Wilson,

The error message translates to (provided for the forum users that don't read Spanish):

Quote:
The specified provider was not found. It may not be properly installed.
And that would seem to have *nothing* to do with SecureCRT. You will need to check with MySQL to see exactly how to reference the provider or what files are needed if files are missing.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply

Tags
connect , database , error , mysql , script

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 05:50 AM.