I can successfully connect, but I cannot seem to get a simple select query to work. Anyone have any sample connect and query code?
Thanks
How to Query a PostgreSQL Database
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: How to Query a PostgreSQL Database
Voila.McJazz wrote:I can successfully connect, but I cannot seem to get a simple select query to work. Anyone have any sample connect and query code?
Thanks
Code: Select all
--- complete with ip adress, db name, user name and pwd
put revOpenDatabase("postgresql","xxx.Xxx.xxx.XXX","yourdbname","thedbuser","thepaswword") into dbID
if dbID is not a number then
answer "there is a problem "&dbID
else
answer "You are connected"
end if
put "SELECT * from yourtable" into dbSQL
put revDataFromQuery(, , dbID, dbSQL) into theData
answer theData
revCloseDatabase dbID
Re: How to Query a PostgreSQL Database
Thanks ... that is basically what I have tried, but when I use the SQL statement
put "SELECT * FROM Departments" into sql
I get the following message
revdberr,ERROR: relation "departments" does not exist at character 15
I know that the table exists with data and I do get a connection id. Any ideas?
put "SELECT * FROM Departments" into sql
I get the following message
revdberr,ERROR: relation "departments" does not exist at character 15
I know that the table exists with data and I do get a connection id. Any ideas?
Re: How to Query a PostgreSQL Database
I found that the syntax of the select statement for PostgreSQL requires the following syntax:
SELECT "Departments"."name" FROM "Main"."Departments";
SELECT "Departments"."name" FROM "Main"."Departments";