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 -N -r1.8 -r1.9 --- openacs-4/packages/acs-core-docs/www/tutorial-second-database.html 17 Oct 2010 21:06:08 -0000 1.8 +++ openacs-4/packages/acs-core-docs/www/tutorial-second-database.html 11 Dec 2010 23:36:32 -0000 1.9 @@ -1,14 +1,14 @@ - -
It is possible to use the OpenACS TCL database API with + +
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.
Modify config.tcl to accomodate the legacy database, and to + legacy.
Modify config.tcl to accomodate the legacy database, and to ensure that the legacy database is not used for standard OpenACS queries:
ns_section ns/db/pools
-ns_param pool1 "Pool 1"
-ns_param pool2 "Pool 2"
-ns_param pool3 "Pool 3"
-ns_param legacy "Legacy"
+ns_param pool1 "Pool 1"
+ns_param pool2 "Pool 2"
+ns_param pool3 "Pool 3"
+ns_param legacy "Legacy"
ns_section ns/db/pool/pool1
#Unchanged from default
@@ -18,7 +18,7 @@
ns_param verbose $debug
ns_param extendedtableinfo true
ns_param logsqlerrors $debug
-if { $database == "oracle" } {
+if { $database == "oracle" } {
ns_param driver ora8
ns_param datasource {}
ns_param user $db_name
@@ -27,7 +27,7 @@
ns_param driver postgres
ns_param datasource ${db_host}:${db_port}:${db_name}
ns_param user $db_user
- ns_param password ""
+ ns_param password ""
}
ns_section ns/db/pool/pool2
@@ -56,14 +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]
To use the legacy database, use the - <code>-dbn</code> flag for any of the - <code>db_</code> 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 +ns_param pools_legacy [list legacy]
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 { select bar from foo limit 10 } { - ns_write "<br/>$bar" + ns_write "<br/>$bar" }