more robust JDBC initialization, e.g. required for Isabelle/jEdit startup;
authorwenzelm
Fri, 17 Mar 2017 20:33:27 +0100
changeset 65292 e3bd1e7ddd23
parent 65291 57c85c83c11b
child 65293 a53a5ae88205
more robust JDBC initialization, e.g. required for Isabelle/jEdit startup;
src/Pure/General/sql.scala
--- a/src/Pure/General/sql.scala	Fri Mar 17 20:21:01 2017 +0100
+++ b/src/Pure/General/sql.scala	Fri Mar 17 20:33:27 2017 +0100
@@ -264,8 +264,11 @@
   // see https://www.sqlite.org/lang_datefunc.html
   val date_format: Date.Format = Date.Format("uuuu-MM-dd HH:mm:ss.SSS x")
 
+  lazy val init_jdbc: Unit = Class.forName("org.sqlite.JDBC")
+
   def open_database(path: Path): Database =
   {
+    init_jdbc
     val path0 = path.expand
     val s0 = File.platform_path(path0)
     val s1 = if (Platform.is_windows) s0.replace('\\', '/') else s0
@@ -296,6 +299,8 @@
 {
   val default_port = 5432
 
+  lazy val init_jdbc: Unit = Class.forName("org.postgresql.Driver")
+
   def open_database(
     user: String,
     password: String,
@@ -304,6 +309,8 @@
     port: Int = default_port,
     ssh: Option[SSH.Session] = None): Database =
   {
+    init_jdbc
+
     require(user != "")
 
     val db_host = if (host != "") host else "localhost"