CGI access to PostGreSQL
Sivakatirswami
katir at hindu.org
Fri Feb 18 12:45:59 EST 2005
Aloha, Mark:
Still no go on Linux as a CGI...--
fixed the case as you said to:
dbPostgresql.so
one of our team put the file in
"/usr/local/lib/revolution/dbPostgresql.so "
and tried to run this script from the cmd line shell as root but it
didn't work
And I also tried putting it in the cgi bin of the virtual site where it
will eventually be used... still didn't work
I also tried a full path from root to the cgi bin of the virtual site
it still fails. Not sure how to trouble shoot this one..I mean we
*can* do it by issuing SQL in shell commands but it would be much
better if we can use rev's dictionary then I can repurpose code that is
in thin rev clients for re-use in cgi's.
#!/usr/local/bin/revolution
on startup
## revSetDatabaseDriverPath "/usr/local/lib/revolution/dbPostgresql.so"
## revSetDatabaseDriverPath
"/home/virtual/site1/fst/var/www/cgi-bin/dbPostgresql.so"
revSetDatabaseDriverPath "dbPostgresql.so"
put
revOpenDatabase("Postgresql","69.94.64.57","cybertalks","user","password
") into pConnectionID
if (pConnectionID) is a number then
put "Your Cybertalks data base opened successfully with connection
ID " into tResult
put pConnectionID after tResult
put tResult into buffer
else
put "Gosh darn, what's up? The data base connection failed." into
buffer
end if
put "Content-Type: text/plain" & cr
put "Content-Length:" && the length of buffer & cr & cr
put buffer
end startup
this works fine from inside the IDE on OSX:
revSetDatabaseDriverPath "dbPostgresql.so"
put
revOpenDatabase("Postgresql","69.94.64.57","cybertalks","user","password
") into pConnectionID
if (pConnectionID) is a number then
put "Your Cybertalks data base opened successfully with connection
ID " into tResult
put pConnectionID after tResult
put tResult
else
put "Gosh darn, what's up? The data base connection failed."
end if
We must still be missing something.
Sivakatirswami
On Feb 10, 2005, at 12:05 AM, Mark Waddingham wrote:
> The Revolution 2.5 (and up) Linux engine has both revXML and revDB
> embedded within it, so the externals are not necessary. However, the
> database drivers themselves are not embedded and you need to tell the
> engine where to find them by doing:
> revdb_setdriverpath <path_to_drivers>
> (or revSetDatabaseDriverPath <path_to_drivers>)
> Where <path_to_drivers> is the directory containing the drivers. Also,
> Linux paths are case-sensitive so make sure that the value you pass for
> the database type looks the same as the driver file:
> i.e. if you pass "mysql" the engine will look for dbmysql.so
> if you pass "MySQL" the engine will look for dbMySQL.so
>
> Warmest Regards,
>
> Mark.
_______________________________________________
>
More information about the use-livecode
mailing list