BigDaddyO Posted October 13, 2014 Share Posted October 13, 2014 (edited) I am trying to connect to a Sybase database and I got it working using a VBscript but I can't connect after converting it to AutoIT. Any help you could offer would be greatly appreciated. Oh, and i'm back to scripting after a 3 year hiatius so i'm a little rusty. Here is the working VBScript DB_CONNECT_STRING = "Provider=ASEOLEDB; Data Source=" & server & "; Initial Catalog=" & database & "; User Id = " & UserID & "; Password=" & PWD & ";" Set Conn = CreateObject("ADODB.Connection") Set RS = CreateObject("ADODB.Recordset") RS.CursorType = 3 'wscript.echo Conn & " Conn Connected" Conn.Open DB_CONNECT_STRING 'wscript.echo Conn & " Conn Opened Connection string" RS.Open SQL,Conn wscript.echo Conn & " Record set Opened, SQL statement Executed" Here is the Non-Working AutoIT script which shows the $Conn.Open() line fails with the error code shown $DB_CONNECT_STRING = "Provider=ASEOLEDB; Data Source='" & $server & "'; Initial Catalog='" & $database & "'; User Id = " & $UserID & "; Password=" & $PWD & ";" $Conn = ObjCreate("ADODB.Connection") if @error Then MsgBox(0, "", @error & " Error was encounterd on Conn ObjCreate") $RS = ObjCreate("ADODB.Recordset") if @error Then MsgBox(0, "", @error & " Error was encounterd on RS ObjCreate") $RS.CursorType = 3 $Conn.Open($DB_CONNECT_STRING) if @error Then MsgBox(0, "", @error & " Error was encounterd on Open") ;Throwing ErrorCode -2147352567 $RS.Open("select Top 10 * from dbo.TableName",$Conn) Any ideas? Thanks, Mike ps. i'm going to try and change my UserName on the Forum since I no longer work as sdx EDIT: Added the COM error handler referenced in another thread and it's giving me this. Confusing since the vbscript version works on this same computer. err.number is: 0x80020009 err.windescription: Exception occurred. err.description is: Provider cannot be found. It may not be properly installed. err.source is: ADODB.Connection err.helpfile is: C:WindowsHELPADO270.CHM err.helpcontext is: 1240655 err.lastdllerror is: 0 err.scriptline is: 15 err.retcode is: 0x800A0E7A Edited October 13, 2014 by BigDaddyO Link to comment Share on other sites More sharing options...
jdelaney Posted October 13, 2014 Share Posted October 13, 2014 I use this connection string for ours...using their own (version 11) driver: Driver=SQL Anywhere 11;UID=YOURUSER;PWD=YOURPASSWORD;ENG=YOURSERVER;DBN=YOURDataBaseName;LINKS=ALL IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Zedna Posted October 13, 2014 Share Posted October 13, 2014 I used this Sybase DSN Driver={SYBASE SYSTEM 11};Srvr=server;Database=master;Uid=admin;Pwd=xxx; It worked OK on Win XP but on Win7 (64bit) it doesn't work. You didn't say what OS do you have, so it may be similar problem with missing apropriate 64bit ADO drivers. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 13, 2014 Author Share Posted October 13, 2014 I used this Sybase DSN It worked OK on Win XP but on Win7 (64bit) it doesn't work. You didn't say what OS do you have, so it may be similar problem with missing apropriate 64bit ADO drivers. The only thing I don't like about this new company is I run everything on a locked down Citrix environment running Server 2008 R2 64bit Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 14, 2014 Author Share Posted October 14, 2014 Thanks for the help guys. I think i'm going to punt this up to the helpdesk tommorow to see if there is something they can do. Really frustrated... Oh, and Zedna you have had that Avatar for a LONG time, i still recognize it. Sadly with the new forum version I seem to have lost my Animated Monkey avatar Link to comment Share on other sites More sharing options...
Zedna Posted October 14, 2014 Share Posted October 14, 2014 Oh, and Zedna you have had that Avatar for a LONG time, i still recognize it. Sadly with the new forum version I seem to have lost my Animated Monkey avatar Yes, I'm conservative about avatar changes. If you want to see my avatar in better resolution, look here :-) http://www.mbank.cz/forum/uzytkownik,856,Zedna.html Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 14, 2014 Author Share Posted October 14, 2014 Can anyone tell me how to get ScITE to run my autoit scripts with the 64bit version? After far too much reading last night and this morning, there appears to be 2 odbc connection apps. a 32bit and 64bit. This helps explain why my VBScript code works fine, but AutoIT does not. If I wasn't using this locked down citrix environment I would simply add the connections to 32bit version: C:WindowsSysWOW64odbcad32.exe I can't seem to find any setting in ScITE to change the default F5 run to use the AutoIt3_x64.exe Thanks, Mike Link to comment Share on other sites More sharing options...
Zedna Posted October 14, 2014 Share Posted October 14, 2014 (edited) Can anyone tell me how to get ScITE to run my autoit scripts with the 64bit version? At the top of your script place this #AutoIt3Wrapper_UseX64=n or #AutoIt3Wrapper_UseX64=y Use FULL Scite4AutoIt3 for this to be working, press Ctrl+F1 in Scite editor to see all directives ... Edited October 14, 2014 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 15, 2014 Author Share Posted October 15, 2014 Turns out ScITE was using x64 by default, so I had to turn it off in ScITE, but Now i'm getting [ASEOLEDB] Invalid connection string. Any other ideas? #AutoIt3Wrapper_UseX64=N Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Dim $Server, $Database, $UserID, $PWD, $DB_CONNECT_STRING ;==== Server = ==== $Server = "ServerIP,Port#" $Database = "DBname" $UserID = "myID" $PWD = "myPassword" $DB_CONNECT_STRING = "Provider=ASEOLEDB; Data Source=" & $server & "; Initial Catalog=" & $database & "; User Id = " & $UserID & "; Password=" & $PWD & ";" $Conn = ObjCreate("ADODB.Connection") $RS = ObjCreate("ADODB.Recordset") $RS.CursorType = 3 $Conn.Open($DB_CONNECT_STRING) ;<= Fails here! $RS.Open("select Top 10 * from TableName",$Conn) ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) MsgBox(0, "ErrFunc", $oError.description) Exit EndFunc ;==>_ErrFunc Link to comment Share on other sites More sharing options...
Zedna Posted October 15, 2014 Share Posted October 15, 2014 Look here http://www.connectionstrings.com/ Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
BigDaddyO Posted October 17, 2014 Author Share Posted October 17, 2014 Look here http://www.connectionstrings.com/ That's where I have been getting the connection strings. I made myself a workaround for now. I built a VBScript that will execute a SQL command sent to it as a command line argument and dumps the results to a text file in | delimited. My AutoIT script sends the command in a shellexecutewait then when complete, reads the text file splitting each row of data by that | Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now