You can do that as below:
// add a new JDBC driver and initialize a connection pool
def initialize(driverClassName: String, url: String, user: String,
password: String) = {
Class.forName(driverClassName)
var connectionPoolName = url // connection pool name needs to be a
unique value
ConnectionPool.add(connectionPoolName, url, user, password)
someDataStore.register(connectionPoolName) // save the connection
pool name for later
}
def runQuery(connectionPoolName: String, query: SQL): Seq[Map[String, Any]] = {
NamedDB(connectionPoolName).readOnly { implicit session =>
query.map(_.toMap).list.apply()
}
}
On Thu, Jan 24, 2019 at 8:57 PM Meghal Pandya <
meghal....@gmail.com> wrote:
>
> Hi,
> My application allows user to add multiple datasources. User will fill form by adding database type and credentials and can query for databases, tables, schemas, column metadata and preview data. How should driver be loaded and connection pool be set up in the given scenario?
>
> --
> You received this message because you are subscribed to the Google Groups "ScalikeJDBC Users Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
scalikejdbc-users...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.