gandalfthewhite Posted July 14, 2007 Share Posted July 14, 2007 Hi All, Does anyone know if autoit scripting can be used to connect to a database and run a query? Assuming that I have the username, password and the database driver. Thanks Link to comment Share on other sites More sharing options...
Toady Posted July 14, 2007 Share Posted July 14, 2007 Yes, greatly supported. Do a search for SQL. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding Link to comment Share on other sites More sharing options...
gandalfthewhite Posted July 14, 2007 Author Share Posted July 14, 2007 I ssaw that before, if you are mentioning _SQLite_ but it seems to me that its some internal database that autoit uses. Please correct me if I am wrong. I want to connect to an Oracle DB and run a query? Is that possible? Link to comment Share on other sites More sharing options...
ptrex Posted July 16, 2007 Share Posted July 16, 2007 @gandalfthewhite This is an example on how to connect and run a QRY on an Oracle DB. expandcollapse popup#include <GUIConstants.au3> Dim $oMyError ; Initializes COM handler $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") $ado = ObjCreate( "ADODB.Connection" ) With $ado .ConnectionString =("Provider='OraOLEDB.Oracle';Data Source='YourTNS_Name';User Id='system';Password='YourPswd';") .Open EndWith $adors = ObjCreate( "ADODB.RecordSet" ) With $adors .ActiveConnection = $ado ;.CursorLocation = "adUseClient" ;.LockType = "adLockReadOnly" ; Set ODBC connection read only .Source = "select * from db.test" .Open EndWith While not $adors.EOF For $i = 0 To $adors.Fields.Count - 1 ConsoleWrite( $adors.Fields( $i ).Value & @TAB ) ; Columns in the AutoIt console use Column Name or Index Next ConsoleWrite(@CR) $adors.MoveNext ; Go to the next record WEnd ; This is Sven P's custom error handler added by ptrex Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New 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