Index: openacs-4/packages/acs-core-docs/www/tutorial-second-database.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-second-database.html,v diff -u -r1.12 -r1.12.2.1 --- openacs-4/packages/acs-core-docs/www/tutorial-second-database.html 8 Nov 2017 09:42:12 -0000 1.12 +++ openacs-4/packages/acs-core-docs/www/tutorial-second-database.html 2 Mar 2019 19:30:06 -0000 1.12.2.1 @@ -1,15 +1,10 @@ -Connect to a second database

Connect to a second database

- -

It is possible to use the OpenACS Tcl database API with +Connect to a second database

Connect to a second database

It is possible to use the OpenACS Tcl database API with other databases. In this example, the OpenACS site uses a PostGre database, and accesses another PostGre database called - legacy.

-
  1. -

    Modify config.tcl to accommodate the legacy database, and to + legacy.

    1. Modify config.tcl to accommodate the legacy database, and to ensure that the legacy database is not used for standard - OpenACS queries:

      -
      ns_section ns/db/pools
      +        OpenACS queries:

      ns_section ns/db/pools
       ns_param   pool1              "Pool 1"
       ns_param   pool2              "Pool 2"
       ns_param   pool3              "Pool 3"
      @@ -61,20 +56,14 @@
       ns_section ns/server/${server}/acs/database
       ns_param database_names [list main legacy]
       ns_param pools_main [list pool1 pool2 pool3]
      -ns_param pools_legacy [list legacy]
      -
    2. -

      To use the legacy database, use the +ns_param pools_legacy [list legacy]

    3. To use the legacy database, use the -dbn flag for any of the db_ API calls. For example, suppose there is a table called "foo" in the legacy system, with a field "bar". List "bar" for all records with - this Tcl file:

      -
      db_foreach -dbn legacy get_bar_query {
      +          this Tcl file:

      db_foreach -dbn legacy get_bar_query {
         select bar from foo
         limit 10
       } {
         ns_write "<br/>$bar"
      -}
      - -
    -
+}