Smith was tested with several databases (including Oracle, MySql, McKoi and Access)
using connection over JDBC-ODBC bridge. In order to access a database you need to
provide a proper JDBC driver on the classpath (e.g. approot/WEB-INF/lib
folder of the web application).
1. Obtaining JDBC driver
JDBC drivers can be found on the official website for your database. Links to
some of those sites are available in our download
section.
Once you have proper JDBC driver on the classpath, you are ready to create a data source.
2. Creating a Data Source
Open Data Sources category on Smith administration screens and fill in the form
on the right hand side.
For example:
Name: myds
(name of data source you'll refer to in, e.g. cfquery)
JDBC URL: jdbc:mysql://localhost:3306/myscheme
(replace localhost with your server, in this example MySQL is used which runs
on port 3306 by default, "myscheme" is name of an existing database scheme -
the one you want to access)
JDBC Driver full class name: com.mysql.jdbc.Driver
(this is JDBC driver whose jar you've previously added to classpath)
Username, Password: user name and password used to access the database scheme.
When you're finished, click "Save data source" button. You'll see the newly created data
source below in "Active Data Sources" section.
3. Configuring Connection Pool
The following parameters control behaviour of the connection pool:
Max Connection Pool Size
Specifies the maximum number of connections in the connection pool at any given time.
Keep DB connection during request
Controls whether the same connection from the pool should be used for each
db access during a single request. If checked, a single connection from the
pool is used for all queries executed during the same request. Otherwise,
a separate connection is taken from the pool for each query.
Keep idle connections for # seconds (zero = infinite)
Amount of time (in seconds) pooled connections can remain unused in
the pool before being considered idle. Many databases (MySQL, DB2, Oracle)
will close connections which are idle after some time. Make this idle
timeout shorter than the database timeout in order to avoid connection
errors caused by idle connections in the pool already closed by the database.
4. Validating Data Sources
To validate created data sources, click "Validate all datasources" button. If added datasources
are available (i.e. can be accessed), "Status" column will show
.
Otherwise,
will appear indicating that you should review your data
source configuration. If that's the case, click on the name of your data source among "Active
Data Sources". Form above will be filled with it's configuration. Correct the config, click
"Save data source" and then "Validate all datasources" again.
When
appears near your data source, simply logout from admin pages
and try some CFML.