Forum OpenACS Q&A: Problems Loading Postgres Drivers

Posted by Rod Cap on
When I test in the browser the server it throws:
command "ns_db" is not enabled
    while executing
"ns_db pools"
    (procedure "db_bootstrap_set_db_type" line 72)
    invoked from within
"db_bootstrap_set_db_type database_problem"

I've read some posted Forums, and I check out in the error.log where I notice that:
Error: dbdrv: failed to load driver 'postgres'
Error: dbinit: no such default pool 'pool1'

Then I notice that the file is not in

I tried to locate the but I only find a nsposgres.txt. Do I have to comile the drivers again?  How do I do that? Where do I get it?
In other server whith openACS there is the file, but I dont know if I can only copy that binary in the path or there is some other process.

Posted by bill kellerman on
if you don't have the driver, download nspostgres4.0beta1 from's download section and compile.  there are instructions included in the tarball, but basically use the command:

% make ACS=1 POSTGRES=/usr/local/pgsql NSHOME=/usr/local/aolserver
% sudo make install

if you are using aolserver 4...

aolserver 4 has broken the database stuff into an external module.
add to your nsd.tcl file:
ns_param   nsdb       ${bindir}/

for reference:

Posted by bill kellerman on
this really is kind of confusing.  unless it has changed in the 5.0 docs, it's not clear what version of the postgres driver to use and where to get it.

also, a note in the oacs config about the ns_db thing for aolserver 4 would probably help.  or maybe some tcl in the config that can determine if 4 is being used and load nsdb automatically...?

Posted by Rod Cap on
I've copied from another server only the binary, and then I kill all the nsd and:
./nsd-postgres -t /web/service0/etc/config.tcl
But it throws the same error in the browser, now in the error log I found :

Warning: modload: failed to load '/usr/local/aolserver/bin/': ' cannot open shared object file: No such file or directory'

Error: dbdrv: failed to load driver 'postgres'

Error: dbinit: no such default pool 'pool1'

What should I do??

Posted by bill kellerman on
This can be solved a couple of different ways...

Add the path '/usr/local/pgsql/lib' to your LD_LIBRARY_PATH shell variable before starting aolserver process (using "set" or "setenv" command depending on your shell).

Or add the path to the file /etc/ and then run the command

Neither of these worked for me (I was using freebsd though).  I made a
soft link from /usr/lib/ to the pgsql directory:

% ln -s /usr/local/pgsql/lib/ /usr/lib/

Make sure the user starting aolserver can read from this directory.

Posted by Rod Cap on
OK... I download nspostgres-4.0beta1, untar it an do make but I get:
** POSTGRES variable not set.
** will not be built.
** Usage: make POSTGRES=/path/to/postgresql
**        make POSTGRES=LSB
** Usage: make install POSTGRES=/path/to/postgresql INST=/path/to/aolserver
**        make install POSTGRES=LSB INST=/path/to/aolserver
** OpenACS users should also set ACS=1
Although, I check in the /usr/local/pgsql/lib/ and there is no only the by the way the postgres version is 7.3.3.
Posted by Benjamin Bytheway on
did you do a

`make POSTGRES=/usr/local/pgsql ACS=1 INST=/usr/local/aolserver` ?

(with variance allowed in the paths)

Posted by bill kellerman on

i gave you the two commands that you need to compile the pg driver above.  just change POSTGRES and NSHOME to wherever your postgresql and aolserver are located.

the instructions that you just cut and paste also tell you:

"Usage: make install POSTGRES=/path/to/postgresql INST=/path/to/aolserver"

just add ACS=1 to the end of that.

Posted by bill kellerman on
to correct myself...

% make ACS=1 POSTGRES=/path/to/postgresql INST=/path/to/aolserver
% sudo make install POSTGRES=/path/to/postgresql INST=/path/to/aolserver

Posted by Rod Cap on
Thanks for your patience Derek.
Now it load the postgres drivers but..
In the browser it says OpenACS Installation: Error
OpenACS could not allocate a handle from database pool "pool2".

I have no idea...
Thx, for your time

Posted by bill kellerman on
hmm...  i'm not sure what causes that.

check this thread:

make sure you have your database server and username specified correctly.

Posted by Cathy Sarisky on
Rod, please post the last bit of your AOLserver log and anything that looks like an error message - what displays in the browser isn't always the whole problem.

What you're describing now _might_ be a permissions problem or an environment problem.

Posted by Rod Cap on
This are the lates error in the log....

Error: Ns_PgOpenDb(postgres):  Could not connect to localhost::beethoven:  could not connect to server: No such file or directory

Error: dbdrv: failed to open database 'postgres:localhost::beethoven'

Error: RDBMS type could not be determined for any pool.

Error: <p>The following database pools generated errors:

<ul><li>OpenACS could not allocate a handle from database pool "pool2".</ul><p>
Possible causes might include:<p>
    <li>The database is not running.
    <li>The database driver has not been correctly installed.
    <li>The datasource or database user/password are incorrect.
    <li>You didn't define any database pools.

That is the error it displays.
Maybe the drivers has not been correcly install???
I follow the steps above. I did it al root make ... and then make install.

Posted by Jeff Lu on
Ive got this error before "command "ns_db" is not enabled" and ive solved it thru the db drivers. It seems after you run "make" you didnt run "make install". Or another thing that happened might be that your port for postgres isnt the default one. How many instances of postgres are you running?
Posted by Selim Erol on
I recently installed OpenACS on Linux Ubuntu 9.04 and got the same error when loading localhost:8000 for the first time. (I used the installation instruction on

What actually solved the problem was killing the aolserver4-nsd process and restarting openacs.

Only restarting openacs didn't work..

Seems to be too simple to be a good solution but it might help someone out there.

Posted by Andrew Piskorski on
How do you "restart OpenACS" without restarting AOLserver? AFAIK there is no such thing, it can't be done. Therefore, I think what you actually found is that your "restart OpenACS" script didn't work right. It probably tried but failed to shutdown and restart AOLserver. You might want to look into just what your script is doing and what went wrong.