|
Step 4: Create a DataSource Object
Substep 2: Define the DataSource
- In the Types view, right-click DataSources.
- From the pop-up menu, select Create.
- Use these values in the subsequent dialog:
- Name: Type sample, in lower case.
- Database name: Type the actual name of the database created in Step 3: SAMPLE
- Driver: Select the JDBC driver you created in Step 4-SubStep 1: SybaseSampleDriver
- Optionally you can use the Advanced tab to specify pooling
parameters for the DataSource or you can accept the defaults.
- Click OK.
- Go to Substep 3
 
- The name of the DataSource must be sample but the name of the database should match the one that you entered in Step 2.
The Samples use the DataSource named sample to connect to a database and the DataSource uses the database name to connect to the particular database; therefore, the Samples do not directly use the database name to connect to the database.
- The DataSource will be stored as "sample" in the /jdbc directory. In the servlet files, we specify "jdbc/sample" as the DataSource object and the code uses this to attach to the database. (In the ConnPoolTest servlet, we use this directory as the JNDI lookup name to locate this DataSource object as specified in its properties file, ConnPoolTestStrings.properties.)
|