|
MDi JLib 1.7.4 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Class Summary | |
---|---|
Connector | Connector for connecting to database source using a database names property file. |
The class is built for two types of databases in particular, Oracle and MySQL. The basic functionality is the same for either database type. Other database types may work as well but have not been tested. Essentially, the connection parameters must include a URL, a username, and a password. The connections are built using these parameters in that order. Assuming the vendor's database driver responds to that construct, it should work.
This classes uses dedicated connections, in Oracle parlance. If you desire connections formed from a Connection pool, you should use the ConnectionPool class instead. In both cases, the connections must be explicitly closed when operations are completed.
To use these classes, you must have a database.properties file available. The default location the class
looks in is META-INF within it's class path. This can be placed in a JAR or stored in the file system. Under
Tomcat, for example, the physical path would be %CATALINA_HOME%/%CONTEXT_HOME%/WEB-INF/classes/META-INF. The
construct of the file must contain, at a minimum, the following:
#Alias
test
#Driver
test.Driver=oracle.jdbc.driver.OracleDriver
#URL
test.Url=jdbc\:oracle\:thin\:@db.oracle.com\:1521\:orcl
and may optionally contain:
#JNDI database name
test.JNDI=test
#default test user
test.User=scott
#Scott's (encrypted) password
test.Pw=Rq2lKFXWb2c\=
There are always one group of entries per database connection. They can appear in any order in the file but it is usually best to keep them grouped together for readability.
Refer to the individual classes for connection usage instructions.
Package documentation version 1.0.2
|
MDi JLib 1.7.4 |
|||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |