VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   how to connecting securecrt to mysql database (https://forums.vandyke.com/showthread.php?t=12175)

WilsonGallardo 12-02-2015 10:51 AM

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

bgagnon 12-02-2015 11:21 AM

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.

WilsonGallardo 12-02-2015 02:50 PM

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

bgagnon 12-02-2015 04:04 PM

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"?

WilsonGallardo 12-02-2015 04:21 PM

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

bgagnon 12-03-2015 09:16 AM

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. :)

WilsonGallardo 12-03-2015 04:07 PM

hi Brenda

thanks, i will check my MYSQL.

Wilson


All times are GMT -6. The time now is 10:20 AM.