Availability: |
| |||
JavaScript syntax: | NES | myDbPool = new DbPool(); | ||
NES | myDbPool = new DbPool(aType, aServer, aUser, aPassword, aDb); | |||
NES | myDbPool = new DbPool(aType, aServer, aUser, aPassword, aDb, maxCon); | |||
NES | myDbPool = new DbPool(aType, aServer, aUser, aPassword, aDb, maxCon, aFlag); | |||
Argument list: | aType | A database type | ||
aServer | A data source name or server name | |||
aUser | A user identifier | |||
aPassword | A valid password for the user | |||
aDb | A database name if required by the data source | |||
maxCon | A number indicating maximum connections | |||
aFlag | Commit/rollback flag value | |||
Object properties: | prototype | |||
Object methods: | connect(), connected(), connection(), disconnect(), majorErrorCode(), majorErrorMessage(), minorErrorCode(), minorErrorMessage(), storedProcArgs(), toString() |
In JavaScript 1.2, you can connect to multiple databases and reuse connections. Each database can have a pool of available and ready connections which can be created when needed.
A DbPool object is created in a similar way to when you connect a single database object to a database. In this case however, you create a new DbPool object each time so you could maintain connections to several databases which is not possible with a plain (JavaScript 1.1) database object.
To create an object instance of the DbPool class, use the new operator on the DbPool() constructor.
The database type would likely be one of:
ORACLE
SYBASE
INFORMIX
DB2
ODBC
The server value would identify one of the available data source names.
The user and password details would correspond to valid users you have already created on your database server.
Likewise the database name, although for some databases such as Oracle, this may be done through the data source description and so the argument should be left blank in that case.
The maximum number of connections depends on your licensing arrangements with your database supplier and the capacity of your server and whether it needs to share connections with other services.
The commit flag indicates whether to commit (true) or rollback (false) a pending transaction.
See also: | database.connect(), Netscape Enterprise Server, unwatch(), watch() |
Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
prototype | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
Method | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
---|---|---|---|---|---|---|---|---|---|---|---|
connect() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
connected() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
connection() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
disconnect() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
majorErrorCode() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
majorErrorMessage() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
minorErrorCode() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
minorErrorMessage() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
storedProcArgs() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
toString() | 1.2 ![]() | ![]() | ![]() | ![]() | ![]() | 3.0 ![]() | ![]() | ![]() | ![]() | ![]() | - |
Prev | Home | Next |
Days in year | Up | DbPool() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |