Database configuration
To configure the database connection pool you can use the net::stubbles::rdbms::stubDatabaseXJConfInitializer. It reads a configuration file from config/xml/rdbms.xml.
This is how a fully configured file may look like:
<?xml version="1.0" encoding="iso-8859-1"?>
<xj:configuration
xmlns:xj="http://xjconf.net/XJConf"
xmlns="http://stubbles.net/rdbms">
<pool>
<connection>
<id>__default</id>
<connectionClassName>net::stubbles::rdbms::pdo::stubDatabasePDOConnection</connectionClassName>
<dsn>mysql:host=localhost;dbname=test</dsn>
<userName>bar</userName>
<password>baz</password>
<driverOptions>
<driverOption name="foo">bar</driverOption>
<driverOption name="bar">baz</driverOption>
</driverOptions>
</connection>
<connection>
[...]
</connection>
[... more connections ...]
</pool>
</xj:configuration>
The database pool can hold several connections which are distinguished by their id. If you omit the id it will be __default. If you have several connection configurations with the same id only the last one is used.
The connectionClassName states which class should be used to establish the connection. If omitted, it defaults to net::stubbles::rdbms::pdo::stubDatabasePDOConnection. If an application has its own connection class and this implements the net::stubbles::rdbms::stubDatabaseConnection interface this may be used as well. (See description of connection?.)
The dsn, userName and password fields are required. The dsn should look like mysql:host=localhost;dbname=test. However the dsn may look different if another database connection class is used, you should refer to its documentation.
The driverOptions are optional and store driver specific data which can be used by the connection instance.
This is an example for the smallest possible configuration:
<?xml version="1.0" encoding="iso-8859-1"?>
<xj:configuration
xmlns:xj="http://xjconf.net/XJConf"
xmlns="http://stubbles.net/rdbms">
<pool>
<connection>
<dsn>mysql:host=localhost;dbname=test</dsn>
<userName>bar</userName>
<password>baz</password>
</connection>
</pool>
</xj:configuration>
