Steveyy Posted October 31, 2011 Share Posted October 31, 2011 (edited) Hi zusammen! Baue im Script eine SQL Verbindung auf mit DRIVER={PostgreSQL ANSI};DATABASE=XXX;SERVER=localhost;Port=5432;Uid=XXX;Pwd=XXX Wenn das Script aus dem Editor heraus läuft, funktionieren die Abfragen perfekt, als ich es jetzt jedoch zu einer .exe compiliert habe, bekomme ich folgenden Fehler, wenn die DB abgefragt wird: [Microsoft][ODBC Diver Manager] Der Datenquellenname wurde nicht gefunden, und es wurde kein Standardtreiber angegeben. Fehlernummer: 80020009 Fehlerquelle: Microsoft OLE DB Provider for ODBC Drivers und ein 2. Fehler: Die Verbindung kann nicht verwendet werden, um diesen Vorgang auszuführen. Sie ist entweder geschlossen oder in diesem Zusammenhang ungültig. Fehlerquelle: ADODB.Recordset Hilfedatei: c:\Windows\HELP\ADO270.CHM Helpcontext: 1240658 und noch weitere Hinweise: Der Vorgang ist für ein geschlossenes Objekt nicht zugelassen. Ein Objekt, das dem angeforderten Namen oder dem Ordinalverweis entspricht, kann nicht gefunden werden. Weiß jemand, warum diese Fehler auftreten und wie man sie beheben kann? Danke, Steveyy Edited October 31, 2011 by Steveyy Link to comment Share on other sites More sharing options...
water Posted October 31, 2011 Share Posted October 31, 2011 Hast Du Dich vom deutschen in das englische Forum verirrt? Du solltest die Frage hier in english formulieren damit Du Hilfe bekommst. To get help from this forum you need to post your question in english. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Steveyy Posted October 31, 2011 Author Share Posted October 31, 2011 (edited) Hello water, thank you for this hint, I'll post it in English. I am establishing a SQL Connection in the script by using the following code: DRIVER={PostgreSQL ANSI};DATABASE=XXX;SERVER=localhost;Port=5432;Uid=XXX;Pwd=XXX When the script is run by the Editor (SciTE Light), the SQL queries work perfectly, but if I compile the script to an executable, I get the following errors, when the database is used: [Microsoft][ODBC Diver Manager] The Data Source hasn't been found. A standard driver has not been set. Error Number: 80020009 Error Origin: Microsoft OLE DB Provider for ODBC Drivers .. and a second error: The connection cannot be established to execute this query. The connection is closed or invalid. Error Origin: ADODB.Recordset Helpfile: C:\Windows\HELP\ADO270.CHM Helpcontext: 1240658 additional output: This Query is not allowed for a closed Object. An object, which equals the requested name, cannot be found. Does somebody know, why these errors occour and how I can fix them? Thanks, Steveyy Edited October 31, 2011 by Steveyy Link to comment Share on other sites More sharing options...
water Posted October 31, 2011 Share Posted October 31, 2011 Do you run the executable on the same machine as you run SciTe? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Steveyy Posted October 31, 2011 Author Share Posted October 31, 2011 Yes, Win7 x64 Link to comment Share on other sites More sharing options...
water Posted October 31, 2011 Share Posted October 31, 2011 Next question: Do you use the same user or do you run the executable as a service? Could you post the code where you establish the connection? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Steveyy Posted October 31, 2011 Author Share Posted October 31, 2011 I use the same user. Source code Func getDatabaseValues($gdbv_param) Local $gdbv_SQL Local $gdbv_returner Local $gdbv_one Local $gdbv_two If($gdbv_param <> "") Then ; connect $oConn = ObjCreate("ADODB.Connection") $oRS = ObjCreate("ADODB.Recordset") $oConnstr = "DRIVER={PostgreSQL ANSI};DATABASE=XXX;SERVER=localhost;Port=5432;Uid=XXX;Pwd=XXX" $ohand = $oConn.Open($oConnstr) ; SQL Statement If($gdbv_param == "XXX") Then $gdbv_SQL = "SELECT *" Else $gdbv_SQL = "SELECT * FROM data LIMIT 10" EndIf ; execute Query $oRS.Open($gdbv_SQL, $oConn, 1, 3) ; getting data If Not $oRS.EOF Then $gdbv_one = $oRS.Fields(0).Value $gdbv_two = $oRS.Fields(1).Value $gdbv_returner = $gdbv_one & $gdbv_two EndIf ; closing DB conn $oRS.Close EndIf ; return value Return $gdbv_returnerEndFunc Link to comment Share on other sites More sharing options...
water Posted October 31, 2011 Share Posted October 31, 2011 Do you use an COM error handler in your script? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Steveyy Posted October 31, 2011 Author Share Posted October 31, 2011 Are screenshots of the error windows valuable? Global $STATE_ERROR = ObjEvent("AutoIt.Error","ErrFunc") Func ErrFunc() Local $sERR = _ "err.description is: " & @TAB & $STATE_ERROR.description & @CRLF & _ "err.windescription:" & @TAB & $STATE_ERROR.windescription & @CRLF & _ "err.number is: " & @TAB & hex($STATE_ERROR.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $STATE_ERROR.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $STATE_ERROR.scriptline & @CRLF & _ "err.source is: " & @TAB & $STATE_ERROR.source & @CRLF & _ "err.helpfile is: " & @TAB & $STATE_ERROR.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $STATE_ERROR.helpcontext Msgbox(0,"AutoItCOM","Ein COM-Fehler ist aufgetreten !" & @CRLF & @CRLF & $sERR) Local $err = $STATE_ERROR.number If $err = 0 Then $err = -1 Local $g_eventerror = $err Endfunc Link to comment Share on other sites More sharing options...
water Posted October 31, 2011 Share Posted October 31, 2011 When compiling your script do you use Obfuscator or UPX? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted October 31, 2011 Share Posted October 31, 2011 Maybe this thread It seems you have to define a DSN. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Zedna Posted October 31, 2011 Share Posted October 31, 2011 (edited) Yes, Win7 x64 Add this at top of your script #AutoIt3Wrapper_UseX64=n and compile script by F7 from full Scite4Autoit3 EDIT: Explanation I think your script was implicitly compiled as 64bit and your database driver is 32bit and this is cause of problems. With my above directive your script will be compiled as 32bit even on X64 Windows Edited October 31, 2011 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Steveyy Posted November 1, 2011 Author Share Posted November 1, 2011 Thank you all alot! I think it was about the 32bit version of the SQL driver. Compiling the script with F7 worked, adding #AutoIt3Wrapper_UseX64=n and "compiling script to .exe" with 64bit did not work ( ), Compiling script to .exe with ANSI and Unicode worked, unfortunately I wasn't able to add a DSN datasource for PostgresSQL to Windows, so I could not try that out, but I am happy to know it was about the 32bit driver. Maybe I'll search for a x64 driver soon or I'll run this script in 32bit mode. Thanks for your help! Steveyy 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