JDBC Connections |
![]() ![]() ![]() |
org.moremotion.util.JdbcConnection class provides static methods to obtain JDBC connections in a practical way. It is enough just to pass the MoreMotionRequest object and the name of a JDBC connection configuration (jdbcConnection element). Connection con = org.moremotion.util.JdbcConnection.getConnection(request, connection-name);
request MoreMotionRequest Object connection-name The name of the configuration element defined with jdbcConnection in the MoreMotion configuration.
If jndids element was defined in the connection configuration, the getConnection method first tries to get the connection through JNDI, if it fails it then loads the JDBC Driver Class (driver element) and gets the connection from the Driver Manager.
JNDI During the start up, MoreMotion creates an InitialContext object to access JNDI definitions (if defined any) through it. If there is a file named {APPLICATION_PATH}/WEB-INF/MM-INF/jndi.properties, the InitialContext is constructed using it as follows.
Example:
|