[webApplication]/META-INF/context.xml ------------------------------------ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Context> <Context> <!-- Database --> <Resource name = "jdbc/efw" auth = "Container" type = "javax.sql.DataSource" driverClassName = "org.postgresql.Driver" url = "jdbc:postgresql://localhost:5432/efw" username = "username" password = "password" maxActive = "100" maxIdle = "20" maxWait = "10" /> <Resource name = "jdbc/efw2" auth = "Container" type = "javax.sql.DataSource" driverClassName = "org.postgresql.Driver" url = "jdbc:postgresql://localhost:5432/efw2" username = "username" password = "password" maxActive = "100" maxIdle = "20" maxWait = "10" /> . . . <!-- Mail --> <Resource name = "mail/efw" auth = "Container" type = "javax.mail.Session" username = "" password = "" mail.debug = "false" mail.user = "" mail.from = "[email protected]" mail.transport.protocol = "smtp" mail.smtp.host = "127.0.0.1" mail.smtp.auth = "false" mail.smtp.port = "25" mail.smtp.starttls.enable = "true" description = "E-Mail Resource" /> </Context>
The default one must be named "jdbc/efw". It can be called by db.select ,
db.change and db.master without the jdbcResourceName param.
If you need some addition database, add the database resource with another name. In this way, you must call the db functions with the jdbcResourceName param.
For example,
db.select(groupId, sqlId, params) //using the default db resource "jdbc/efw" db.select(groupId, sqlId, params, "jdbc/efw2") //using the addition db resource "jdbc/efw2"If mail.send is called in your program, the mail resource must be set up with the name "mail/efw".