Following is the code that doesn't work but it describes what I want to do.
Could you please recommend the best approach to this problem?
def resolveDriver(url: String) = {
url match {
case url.startsWith("jdbc:mysql:") => "com.mysql.jdbc.Driver"
case url.startsWith("jdbc:postgresql:") => "org.postgresql.Driver"
case url.startsWith("jdbc:h2:") => "org.h2.Driver"
case url.startsWith("jdbc:hsqldb:") => "org.hsqldb.jdbcDriver"
case _ => throw new IllegalArgumentException
}
}