Guest User

Untitled

a guest
Jul 30th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. Class Boot {
  2.  
  3. ...
  4.  
  5. def boot {
  6.  
  7. if (!DB.jndiJdbcConnAvailable_?) DB.defineConnectionManager(DefaultConnectionIdentifier, DBVendor)
  8.  
  9. ...
  10. }
  11.  
  12. }
  13.  
  14. object DBVendor extends ConnectionManager with Logger {
  15. def newConnection(name: ConnectionIdentifier): Box[Connection] = {
  16. try {
  17. Class.forName("com.mysql.jdbc.Driver")
  18. val jdbcurl= (Props.get("db.url") openOr "") +
  19. "?user=" + (Props.get("db.user") openOr "") +
  20. "&password=" + (Props.get("db.password") openOr "") +
  21. "&" + Props.get("additionalurlparam").openOr("")
  22. debug( jdbcurl)
  23.  
  24.  
  25. val dm = DriverManager.getConnection(jdbcurl)
  26. Full(dm)
  27. } catch {
  28. case e : Exception => e.printStackTrace; Empty
  29. }
  30. }
  31. def releaseConnection(conn: Connection) {conn.close}
  32. }
Add Comment
Please, Sign In to add comment