Forum OpenACS Q&A: Problems loading postgres.so (snippets of nsd.tcl included)

Hi all,

My first experience compiling and installing AOLserver 3 final and PostgreSQL 7 final from scratch... I am having a problem loading the postgres.so driver. I followed the usual stuff for building AOLserver 3 and it builds and works fine but if I try to load the newly compiled postgres.so I get the following error:

[12/May/2000:21:54:00][13483.1024][-main-] Notice: loading:
/usr/local/aolserver/bin/postgres.so
[12/May/2000:21:54:00][13483.1024][-main-] Warning: no such symbol
"Ns_ModuleInit" in module "/usr/local/aolserver/bin/postgres.so"
[12/May/2000:21:54:00][13483.1024][-main-] Fatal: could not load:
/usr/local/aolserver/bin/postgres.so

What could the problem be ? I never had this problem before and I only changed two things from what I was doing: I am using the nsd.tcl init file and I changes some "text" data types lztext in the datamodel (but this loaded ok). PostgreSQL is fine and working like a clock.

To make sure I am doing this right and in the hope that this will help others, I am posting the relevant sections of my nsd.tcl here.

#
# Server parameters
#
ns_section "ns/server/${servername}"
    ns_param   directoryfile   $directoryfile
    ns_param   pageroot        $pageroot
    ns_param   globalstats     true      ;# Enable built-in statistics
    ns_param   urlstats        true      ;# Enable URL statistics
    ns_param   maxurlstats     1000      ;# Max number of URL's to do
stats on
    ns_param   enabletclpages  true      ;# Parse tcl files in
pageroot (dangerous)
    ns_param   usermapdir      public_html
# Directory listings -- use an ADP or a Tcl proc to generate them.
#
    #ns_param   directoryadp    $pageroot/dirlist.adp ;# Choose one or
the other
    ns_param   directoryproc   _ns_dirlist           ;#  ...but not
both!
    #ns_param   directorylisting simple               ;# Can be simple
or fancy
#
# Database drivers
#
# The database driver is specified here (it is loaded by nsext.so).
 PostgreSQL being used here.
#
ns_section "ns/db/drivers"
    ns_log notice "Entering pg driver section..."
    ns_param   postgres     ${bindir}/postgres.so  ;# Load PostgreSQL
driver
    ns_param   defaultpool  "main"           ;# Specify default pool
as main
ns_section "ns/db/pools"
    ns_param   main "OpenACS Main Pool"
    ns_param   log  "OpenACS Log Pool"
    ns_param   subquery "OpenACS Subquery Pool"
ns_section "ns/db/pool/main"
    ns_param Driver postgres
    ns_param Connections 2
    ns_param DataSource localhost::lbn
    ns_param User nsadmin
    ns_param Password ""
    ns_param Verbose On
    ns_param LogSQLErrors On
    ns_param ExtendedTableInfo On
ns_section "ns/db/pool/log"
    ns_param Driver postgres
    ns_param Connections 2
    ns_param DataSource localhost::lbn
    ns_param User nsadmin
    ns_param Password ""
    ns_param Verbose On
    ns_param LogSQLErrors On
    ns_param ExtendedTableInfo On
ns_section "ns/db/pool/subquery"
    ns_param Driver postgres
    ns_param Connections 2
    ns_param DataSource localhost::lbn
    ns_param User nsadmin
    ns_param Password ""
    ns_param Verbose On
    ns_param LogSQLErrors On
    ns_param ExtendedTableInfo On
#
# Modules to load
#
ns_section "ns/server/${servername}/modules"
    ns_param   nssock          ${bindir}/nssock.so
    ns_param   nslog           ${bindir}/nslog.so
    ns_param   nscgi	       ${bindir}/nscgi.so
    ns_param   nsperm          ${bindir}/nsperm.so
    ns_param   postgres        ${bindir}/postgres.so
##
# To Source OpenACS Config File
#
source /web/${servername}/parameters/${servername}.tcl
ns_log notice "nsd.tcl: finished reading config file."
You put the postgres.so in the "modules" section, which is
incorrect. A DB driver is not like other AOLserver modules. You
should only put postgres.so in the db drivers section of your
param file.
I added postgres.so to the modules section on a desperate attempt. If I just have
ns_param postgres ${bindir}/postgres.so
in the drivers section, then AOLserver seems not to even bother about that and doesn't load the driver.

I get repeated "ns_db not enabled" errors if I do that (just have it in the drivers section). I tried many things: recompiling our driver, using the included nspostgres.so (which seems to be bigger than ours ??) but nothing worked. I went over the AOLserver docs checking for misspelling or wrong params in my ns_'s but they seem ok.

ah yes, so there is another problem. You must include this section in your config file:
ns_section "ns/server/${servername}/db"
ns_param Pools        "*"
ns_param DefaultPool  "main"
Thanks Ben, that did the trick. I wonder why this is not in the AOLserver docs... I went through all that section and didn't see this. I'll volunteer to fix it.