Wanja Posted July 20, 2007 Posted July 20, 2007 (edited) Well I'm messing around with postgresql so I tried some examples from the forum but I just get errors ^^ @error=2 - ODBC driver not installed I'm using this example: $oConn = _SQLConnect($sServer, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", $sDriver = "{SQL Server}") So where do I get the odbc driver for postgresql? And what do I insert here: {SQL Server} ?? anyone got an example for postgresql??? thx in advance ^^ Wanja Edited July 20, 2007 by Wanja
PsaltyDS Posted July 21, 2007 Posted July 21, 2007 Well a google for "postgresql odbc drive" turned up 1,190,000 hits like this one: psqlODBC Downloads.Run the odbcad32.exe utility and look at the 'Drivers' tabe, you'll see the list of driver names. Once you download and install it, your postgre ODBC driver will be listed there too. 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
Wanja Posted July 22, 2007 Author Posted July 22, 2007 Well a google for "postgresql odbc drive" turned up 1,190,000 hits like this one: psqlODBC Downloads.Run the odbcad32.exe utility and look at the 'Drivers' tabe, you'll see the list of driver names. Once you download and install it, your postgre ODBC driver will be listed there too. ok I installed psqlodbc.msiso what to do next? $sDriver = "{????}"
PsaltyDS Posted July 23, 2007 Posted July 23, 2007 ok I installed psqlodbc.msiso what to do next? $sDriver = "{????}"Look in the ODBC utility again, at the Drivers tab. You should now have drivers for:PostgreSQL ANSIPostgreSQL UnicodeUse whichever is appropriate for you. 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
Wanja Posted July 23, 2007 Author Posted July 23, 2007 Look in the ODBC utility again, at the Drivers tab. You should now have drivers for:PostgreSQL ANSIPostgreSQL UnicodeUse whichever is appropriate for you. How do I "use" it?
PsaltyDS Posted July 24, 2007 Posted July 24, 2007 How do I "use" it? Your original question was: $oConn = _SQLConnect($sServer, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", $sDriver = "{SQL Server}") So where do I get the odbc driver for postgresql? And what do I insert here: {SQL Server} ?? You have the driver and installed it (if you see it on the drivers tab of the ODBC utility), and that would make your command: $oConn = _SQLConnect($sServer, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", $sDriver = "PostgreSQL ANSI") ...or "PostgreSQL Unicode" if that's what you need. 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
Wanja Posted July 24, 2007 Author Posted July 24, 2007 Your original question was: You have the driver and installed it (if you see it on the drivers tab of the ODBC utility), and that would make your command: $oConn = _SQLConnect($sServer, $sDatabase, $fAuthMode = 0, $sUsername = "", $sPassword = "", $sDriver = "PostgreSQL ANSI") ...or "PostgreSQL Unicode" if that's what you need. Great!!! this works ... stupid me XD but I have a final problem this works: _SQLQuery($oConn, "INSERT INTO myDB VALUES ('bla','lala', 'hoho')") but how do I get some data out? I tried this: $result = _SQLQuery($oConn, "Select * from myBD") MsgBox(0,"Result",$result) I only get get blanck msgbox T.T
PsaltyDS Posted July 24, 2007 Posted July 24, 2007 Great!!! this works ... stupid me XDbut I have a final problem this works:_SQLQuery($oConn, "INSERT INTO myDB VALUES ('bla','lala', 'hoho')")but how do I get some data out? I tried this:$result = _SQLQuery($oConn, "Select * from myBD")MsgBox(0,"Result",$result)I only get get blanck msgbox T.TI am learning the SQLite UDF myself right now, and I don't know the UDF you are using. Are you sure the return value from _SQLQuery() is the results of the query? In SQLite, you get back a handle to the query and use further commands like _SQLite_FetchData() to get the returned data one row at a time.In addition, the return data is usually in some kind of array, so you might try _ArrayDisplay() instead of a MsgBox(). 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
Wanja Posted July 24, 2007 Author Posted July 24, 2007 (edited) I am learning the SQLite UDF myself right now, and I don't know the UDF you are using. Are you sure the return value from _SQLQuery() is the results of the query? In SQLite, you get back a handle to the query and use further commands like _SQLite_FetchData() to get the returned data one row at a time.In addition, the return data is usually in some kind of array, so you might try _ArrayDisplay() instead of a MsgBox(). OK I tried _ArrayDisplay(_SQLQuery($oConn, "Select * from mmopager"))if @error then MsgBox(0,"Result",@error)and I got "1" so no array? do you know if there is any documentation for this stuff? Edited July 24, 2007 by Wanja
Wanja Posted July 24, 2007 Author Posted July 24, 2007 (edited) I GOT IT FINALLY XXXXDDDDD $oConn = _SQLConnect("localhost", "myDB", 1, "myUser", "myPass", "{PostgreSQL ANSI}") $adors = ObjCreate( "ADODB.RecordSet" ) $adors.Open( "SELECT * FROM myDB", $oConn ) While not $adors.EOF MsgBox(0, "Result", "Name = " & $adors.Fields("name").Value ) $adors.MoveNext WEnd WOOOOOOOOOHOOOOOOOOOOOOOOOOOOOOOOOOOOOO XD BIG THX 4 YOUR HELP PsaltyDS Edited July 24, 2007 by Wanja
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