Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class Boot {
- ...
- def boot {
- if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
- ...
- }
- }
- object DBVendor extends ConnectionManager with Logger {
- def newConnection(name: ConnectionIdentifier): Box[Connection] = {
- try {
- Class.forName("com.mysql.jdbc.Driver")
- val jdbcurl= (Props.get("db.url") openOr "") +
- "?user=" + (Props.get("db.user") openOr "") +
- "&password=" + (Props.get("db.password") openOr "") +
- "&" + Props.get("additionalurlparam").openOr("")
- debug( jdbcurl)
- val dm = DriverManager.getConnection(jdbcurl)
- Full(dm)
- } catch {
- case e : Exception => e.printStackTrace; Empty
- }
- }
- def releaseConnection(conn: Connection) {conn.close}
- }
Add Comment
Please, Sign In to add comment