carabusu Posted March 6, 2008 Posted March 6, 2008 i have this command $sqlCon = ObjCreate("ADODB.Connection") $sqlCon.Open ("Provider='IBMDADB2';Data Source='maindb';UID='db2admin';Password='pass'") The command returns me this error: OK We intercepted a COM Error ! err.description is: SQL30082N Security processing failed with reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001 err.windescription: . err.number is: 80020009 err.lastdllerror is: 0 err.scriptline is: 81 err.source is: IBM OLE DB Provider for DB2 err.helpfile is: err.helpcontext is: 0 I have tried in Administrative tool -> Data Sources (ODBC) and it's working. What is wrong in my script?
PsaltyDS Posted March 6, 2008 Posted March 6, 2008 i have this command $sqlCon = ObjCreate("ADODB.Connection")$sqlCon.Open ("Provider='IBMDADB2';Data Source='maindb';UID='db2admin';Password='pass'") The command returns me this error:OKWe intercepted a COM Error !err.description is: SQL30082N Security processing failed with reason "24" ("USERNAME AND/OR PASSWORD INVALID"). SQLSTATE=08001err.windescription: .err.number is: 80020009err.lastdllerror is: 0err.scriptline is: 81err.source is: IBM OLE DB Provider for DB2err.helpfile is: err.helpcontext is: 0I have tried in Administrative tool -> Data Sources (ODBC) and it's working. What is wrong in my script?It would appear your "USERNAME AND/OR PASSWORD" are "INVALID"... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
carabusu Posted March 6, 2008 Author Posted March 6, 2008 It would appear your "USERNAME AND/OR PASSWORD" are "INVALID"... i did said: I have tried in Administrative tool -> Data Sources (ODBC) and it's working
PsaltyDS Posted March 6, 2008 Posted March 6, 2008 i did said: I have tried in Administrative tool -> Data Sources (ODBC) and it's working...and you copy/pasted the same account/password from the script? I ask because all the SQL stuff I do uses Windows Authentication only, so I don't routinely even see login prompts when testing databases. The logged in account (or RunAs credentials) either work or don't with no username/password provided ("TrustedConnection=True"). So it's not a slam dunk to me that your script's credentials are good because your (perhaps different) account can connect from ODBC manager.Assuming you did in fact test those credentials, are there any special characters in the user name or password that might not be interpreted correctly in the string format? Also, is the local/domain context the same where the script is running and where you tested from ODBC? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
carabusu Posted March 10, 2008 Author Posted March 10, 2008 (edited) ...and you copy/pasted the same account/password from the script? I ask because all the SQL stuff I do uses Windows Authentication only, so I don't routinely even see login prompts when testing databases. The logged in account (or RunAs credentials) either work or don't with no username/password provided ("TrustedConnection=True"). So it's not a slam dunk to me that your script's credentials are good because your (perhaps different) account can connect from ODBC manager.Assuming you did in fact test those credentials, are there any special characters in the user name or password that might not be interpreted correctly in the string format? Also, is the local/domain context the same where the script is running and where you tested from ODBC? can you write me a full sintax connection? the user and pass are the same (copy/paste). Edited March 10, 2008 by carabusu
Xenobiologist Posted March 10, 2008 Posted March 10, 2008 Hey, I'm interested in this too. Never tested to connect to DB2 via Autoit. I'll give a try. Hopefully someone did it before and can post some lines. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
ptrex Posted March 10, 2008 Posted March 10, 2008 @all Maybe this can get you going. ; ; where [ip_address] is the IP address of the database server, [port_number] is the port for the database server, ; [database_name] is the name of the database, ; and [username] and [password] are the username and password required for accessing the database. $sqlCon.Open ("Driver={DB2}; IP=[ip_address]; Port=[port_number]; Database=[database_name]; UID=[username]; PWD=[password]") If @error Then MsgBox(0, "ERROR", "Failed to connect to the database") Exit EndIf http://ns7.webmasters.com/caspdoc/html/syn...rings.htm"</a>">Connectionless DB2 Not tested though, I don't have an AS400 around to play with. 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
Xenobiologist Posted March 10, 2008 Posted March 10, 2008 @all Maybe this can get you going. ; ; where [ip_address] is the IP address of the database server, [port_number] is the port for the database server, ; [database_name] is the name of the database, ; and [username] and [password] are the username and password required for accessing the database. $sqlCon.Open ("Driver={DB2}; IP=[ip_address]; Port=[port_number]; Database=[database_name]; UID=[username]; PWD=[password]") If @error Then MsgBox(0, "ERROR", "Failed to connect to the database") Exit EndIf Connectionless DB2 Not tested though, I don't have an AS400 around to play with. regards ptrex Thanks, I'll give it a go. Besides, I do have a AS400 to play with Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
PsaltyDS Posted March 11, 2008 Posted March 11, 2008 Thanks, I'll give it a go. Besides, I do have a AS400 to play with MegaMega has all the cool geek toys! Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Xenobiologist Posted March 11, 2008 Posted March 11, 2008 Mega has all the cool geek toys! I work in a EDPC (electronic data processing center) for banks. So we do need that power. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
ptrex Posted March 11, 2008 Posted March 11, 2008 @Xenobiologist If you have the example going. Please post back the solution. Thanks 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
Xenobiologist Posted March 11, 2008 Posted March 11, 2008 @XenobiologistIf you have the example going. Please post back the solution.ThanksptrexHI,at the moment there is no need to go for a trial and error session on this. But, if ... then I'll post the result.Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Xenobiologist Posted March 11, 2008 Posted March 11, 2008 HI, I thought about giving this a try. The problem is connecting needs either a JBDC Typ 4 driver or cataloged db. I will install a db2 db on my localhost and see whether I can connect to it and maybe afterwards I try to connect to some zOS and AIX ones. Anybody you already did that with VB or even Autoit, please post your code. Global $g_eventerror = 0 ; to be checked to know if com error occurs. Must be reset after handling. $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") ; Install a custom error handler Global $sqlCon = ObjCreate("ADODB.Connection") If Not IsObj($sqlCon) Then ConsoleWrite("! Error" & @CRLF) $sqlCon.Open("DRIVER={IBMDADB2}; IP=; PORT=; DSN=; UID=; PWD=") If @error Then MsgBox(0, "ERROR", "Failed to connect to the database") Exit EndIf Func MyErrFunc() Local $HexNumber = Hex($oMyError.number, 8) ConsoleWrite("> We intercepted a COM Error !" & @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 & @CRLF) $g_eventerror = 1 ; something to check for when this function returns EndFunc ;==>MyErrFunc Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
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