Postgres Connection
Posted: Sat Mar 07, 2009 1:13 pm
I'm taking a look at Postgresql and have adapted the script in the "Work with Databases" stack to connect my stack to a test database. The following snippet does if fact connect but the connection test "if it is not true then" throws an error. It also throws an error if I use the integer test that works on SQLite and MySQL.
I've done some searching for a solution but can't find one.
Any ideas on how to check that the connection has actually been made to Postgresql will be gratefully received. Otherwise I will remove the test and error dialogue and rely on the fact that a SELECT does in fact select a set.
Thanks
Phil
I've done some searching for a solution but can't find one.
Any ideas on how to check that the connection has actually been made to Postgresql will be gratefully received. Otherwise I will remove the test and error dialogue and rely on the fact that a SELECT does in fact select a set.
Thanks
Phil
Code: Select all
-- Connect to the database.
on databaseConnect
get revOpenDatabase("postgresql", "127.0.0.1:5432", "address_book", "postie", "Bob")
if it is not true then
error "Could not connect to database:" && it
end if
put it into sDatabaseId
showRecord
end databaseConnect