Dynamic Database Switching: Difference between revisions

m
categories
m (typos)
m (categories)
Line 16: Line 16:
Some applications - those used by the customers - will only access one database, perhaps defined by a user's login, while others - those used by administrators perhaps - will need to be able to switch between databases. However certain kinds of application, even as used by the customers, may require the capability to dynamically switch database: web applications (especially if using process pooling) are an example of this.
Some applications - those used by the customers - will only access one database, perhaps defined by a user's login, while others - those used by administrators perhaps - will need to be able to switch between databases. However certain kinds of application, even as used by the customers, may require the capability to dynamically switch database: web applications (especially if using process pooling) are an example of this.


This article will look at a technique for handling this using [[MySQL]] and the [[Mertech]] database driver for that database.
==Technique using a MySQL Database==


==Technique using MySQL Database==
This article will look at a technique for handling this using [[MySQL]] and the [[Mertech]] database driver for that database.  The techniques for other database servers may be added later.


===The Database Switching Object===
===The Database Switching Object===
Line 228: Line 228:


This might be invoked in the login module of some applications, where the database to use is determined by the user's identity, or in the Session Manager module of an [[Ajax]] [[Web Application]] where the database to use is mainteined in the Session record, or simply in the change of a visual control (such as a Combo Form) in an application in which the user can choose between many databases to work on.
This might be invoked in the login module of some applications, where the database to use is determined by the user's identity, or in the Session Manager module of an [[Ajax]] [[Web Application]] where the database to use is mainteined in the Session record, or simply in the change of a visual control (such as a Combo Form) in an application in which the user can choose between many databases to work on.
===In the .INT files===
The Mertech Set_Database_Name command, on which the underlying functionality is based, will only be effective if the database is '''not''' set in the .INT file - so you should '''remove''' the line DATABASE_AREA_NAME=XXXX from the appropriate .INT files (and indeed probably from all the .INT files). Then the .TD files should be deleted so that they will be freshly regenerated on next access from the .INT files.
[[Category:Database Connectivity]]
[[Category:Tutorials]]
[[Category:Cookbook]]