Home
The Toolkit for Online Communities
17516 Community Members, 0 members online, 1980 visitors today
Log In Register
OpenACS Home : Forums : OpenACS Development : Changes in DB connections oacs-5-2 vs HEAD?

Forum OpenACS Development: Changes in DB connections oacs-5-2 vs HEAD?

Icon of envelope Request notifications

Has there been some change in acs-kernel from oacs-5-2 to HEAD in how connections are made to the databases? With a fresh install from HEAD, I'm unable to access two databases using the db_* -dbn switch, whereas the exact same code works fine on an oacs-5-2 install. (The intent of this is to migrate a 3.x db to 5.x.)

Here's how the second 3.x db is configured in /etc/config.tcl (I'm omitting the regular 5.x db stuff):

# stuff for db conversion
#  put all this somewhere in /etc/config.tcl after debug is defined

set 3xdb_name             "cvdb"

# this lets us get the db names via parameter::get_from_package_key thus:
# set source_db [parameter::get_from_package_key -package_key acs-kernel -parameter src3x_db]

ns_section ns/server/${server}/acs
    ns_param   src3x_db          $3xdb_name
    ns_param   dest5x_db         $db_name

# this defines the db pool for the 3.2.5 db

ns_section ns/db/pools 
    ns_param   acs32       "OpenACS 3.2 pool"

ns_section ns/db/pool/acs32
    ns_param   maxidle            0
    ns_param   maxopen            0
    ns_param   connections        5
    ns_param   verbose            $debug
    ns_param   extendedtableinfo  true
    ns_param   logsqlerrors       $debug
    if { $database == "oracle" } {
        ns_param   driver             ora8
        ns_param   datasource         {}
        ns_param   user               $3xdb_name
        ns_param   password           3xdb_name_password # whatever this is
    } else {
        ns_param   driver             postgres 
        ns_param   datasource         localhost::$3xdb_name
        ns_param   user               $db_user
        ns_param   password           ""
} 

ns_section "ns/server/${server}/acs/database"
    ns_param database_names [list main acs32]
    ns_param pools_main [list pool1 pool2 pool3]
    ns_param pools_acs32 [list acs32]

# end stuff for db conversion

There is no error during server startup. Here's error.log from the HEAD case (the db is named "oacsh"):

[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Database API: For database 'main', the following pools are available: pool1 pool2 pool3
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Database API: For database 'acs32', the following pools are available: acs32
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Database API: Default database (dbn) is: 'main'
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Database API: The following pools are available for OpenACS: pool1 pool2 pool3
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: dbdrv: opening database 'postgres:localhost::oacsh'
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Opening oacsh on localhost
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Ns_PgOpenDb(postgres):  Openned connection to localhost::oacsh.
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: dbdrv: opening database 'postgres:localhost::oacsh'
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Opening oacsh on localhost
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Ns_PgOpenDb(postgres):  Openned connection to localhost::oacsh.
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: dbdrv: opening database 'postgres:localhost::oacsh'
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Opening oacsh on localhost
[30/Aug/2006:16:57:17][19160.2684358124][-main-] Notice: Ns_PgOpenDb(postgres):  Openned connection to localhost::oacsh.

And here's error.log from the oacs-5-2 case (the main db is named "oacs52"):

[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Database API: For database 'main', the following pools are available: pool1 pool2 pool3
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Database API: For database 'acs32', the following pools are available: acs32
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Database API: Default database (dbn) is: 'main'
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Database API: The following pools are available for OpenACS: pool1 pool2 pool3
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: dbdrv: opening database 'postgres:localhost::oacs52'
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Opening oacs52 on localhost
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Ns_PgOpenDb(postgres):  Openned connection to localhost::oacs52.
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: dbdrv: opening database 'postgres:localhost::oacs52'
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Opening oacs52 on localhost
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Ns_PgOpenDb(postgres):  Openned connection to localhost::oacs52.
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: dbdrv: opening database 'postgres:localhost::oacs52'
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Opening oacs52 on localhost
[30/Aug/2006:15:58:07][18942.2684358124][-main-] Notice: Ns_PgOpenDb(postgres):  Openned connection to localhost::oacs52.

So, in both cases, both the 5.x db (oacsh or oacs52) and the 3.x db appear to be correctly initialized.

Nevertheless, in the HEAD case, the 3.x db cannot be accessed. For instance, in DS shell in the oacs-5-2 site, this call returns the correct value of 1872 from the 3.x db:

db_string -dbn acs32 ust "select count(*) from users where user_id > 2"

whereas in DS shell in the HEAD site, the same call returns the value 1, which is the value from the 5.x db.

This is most baffling, and it's a showstopper. Anyone know what's going on?