author | František Kučera <franta-hg@frantovo.cz> |
Sun, 17 May 2015 15:43:20 +0200 | |
branch | v_0 |
changeset 195 | aed11d9107bf |
parent 192 | a32bfcbdee51 |
child 235 | 8ce612cca4d8 |
permissions | -rw-r--r-- |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
/** |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
* SQL-DK |
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
3 |
* Copyright © 2015 František Kučera (frantovo.cz) |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
* |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
* This program is free software: you can redistribute it and/or modify |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License as published by |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
* the Free Software Foundation, either version 3 of the License, or |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
* (at your option) any later version. |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
* |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
* GNU General Public License for more details. |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
* |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
*/ |
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
18 |
package info.globalcode.sql.dk.jdbc; |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
|
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
20 |
import info.globalcode.sql.dk.Constants; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
21 |
import info.globalcode.sql.dk.configuration.Configuration; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
22 |
import info.globalcode.sql.dk.configuration.ConfigurationException; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
23 |
import info.globalcode.sql.dk.configuration.DatabaseDefinition; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
24 |
import info.globalcode.sql.dk.configuration.Loader; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
25 |
import info.globalcode.sql.dk.configuration.Properties; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
26 |
import info.globalcode.sql.dk.configuration.Property; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
27 |
import java.sql.Connection; |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
28 |
import java.sql.DriverManager; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
import java.sql.DriverPropertyInfo; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
import java.sql.SQLException; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
import java.sql.SQLFeatureNotSupportedException; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
32 |
import java.util.logging.Level; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
import java.util.logging.Logger; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
35 |
/** |
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
36 |
* <p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
37 |
* Meta JDBC driver that works as redirector/router. It loads SQL-DK's configuration file and |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
38 |
* instantiates a real JDBC connection (PostgreSQL, MariDB etc.) of given name. |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
39 |
* </p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
40 |
* |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
41 |
* <p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
42 |
* Raison d'être: user can define his/her database connections just once (in SQL-DK's configuration) |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
43 |
* and use them in many other programs – there is no need to define the connection (hostname, |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
44 |
* username, password, properties…) in each application again and again. User will simply connect to |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
45 |
* e.g. <code>jdbc:sql-dk://my-connection</code> and this driver reads parameters of |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
46 |
* <code>my-connection</code> from SQL-DK's configuration and returns real driver implementation. |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
47 |
* </p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
48 |
* |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
49 |
* <p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
50 |
* Of course, the real JDBC driver for given database is still needed on the class path. |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
51 |
* </p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
52 |
* |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
53 |
* <p> |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
54 |
* TODO: current version is quite heavy-weight, because it includes whole SQL-DK source tree. Some |
195 | 55 |
* refactoring and separation is desired to provide more light-weight JDBC driver. However the |
56 |
* public interface and behavior of this driver should remain unchanged. |
|
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
57 |
* </p> |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
58 |
* |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
59 |
* @author Ing. František Kučera (frantovo.cz) |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
60 |
*/ |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
61 |
public class Driver implements java.sql.Driver { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
62 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
63 |
private static final Logger log = Logger.getLogger(Driver.class.getName()); |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
64 |
|
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
65 |
private final Loader loader = new Loader(); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
66 |
|
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
67 |
static { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
68 |
try { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
69 |
DriverManager.registerDriver(new Driver()); |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
70 |
} catch (SQLException e) { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
71 |
log.log(Level.SEVERE, "Unable to register JDBC driver", e); |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
72 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
73 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
74 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
75 |
@Override |
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
76 |
public Connection connect(String url, java.util.Properties info) throws SQLException { |
177
5cc7fdad1452
jdbc-loopback: refuse connection if URL is unsupported
František Kučera <franta-hg@frantovo.cz>
parents:
171
diff
changeset
|
77 |
if (acceptsURL(url)) { |
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
78 |
log.log(Level.FINER, "Loading SQL-DK configuration for URL: {0}", url); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
79 |
String name = extractDatabaseName(url); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
80 |
log.log(Level.FINE, "Loading SQL-DK configuration for name: {0}", name); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
81 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
82 |
try { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
83 |
return getConnection(name, info); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
84 |
} catch (ConfigurationException e) { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
85 |
log.log(Level.SEVERE, "Unable to load SQL-DK configuration for name: {0}. Is it defined in {1}?", new Object[]{name, Constants.CONFIG_FILE}); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
86 |
throw new SQLException("Unable to load SQL-DK configuration for name: " + name, e); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
87 |
} |
177
5cc7fdad1452
jdbc-loopback: refuse connection if URL is unsupported
František Kučera <franta-hg@frantovo.cz>
parents:
171
diff
changeset
|
88 |
} else { |
5cc7fdad1452
jdbc-loopback: refuse connection if URL is unsupported
František Kučera <franta-hg@frantovo.cz>
parents:
171
diff
changeset
|
89 |
throw new SQLException("Unsupported URL: " + url); |
5cc7fdad1452
jdbc-loopback: refuse connection if URL is unsupported
František Kučera <franta-hg@frantovo.cz>
parents:
171
diff
changeset
|
90 |
} |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
91 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
92 |
|
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
93 |
private Connection getConnection(String connectionName, java.util.Properties info) throws SQLException, ConfigurationException { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
94 |
Configuration c = loader.loadConfiguration(); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
95 |
DatabaseDefinition dd = c.getDatabase(connectionName); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
96 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
97 |
if (acceptsURL(dd.getUrl())) { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
98 |
log.log(Level.SEVERE, "SQL-DK meta JDBC driver loops to itself: {0} → {1} Please check {2}", new Object[]{connectionName, dd.getUrl(), Constants.CONFIG_FILE}); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
99 |
throw new ConfigurationException("SQL-DK meta JDBC driver loops to itself."); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
100 |
} else { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
101 |
return Loader.jdbcConnect(dd, translate(info)); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
102 |
} |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
103 |
} |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
104 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
105 |
private String extractDatabaseName(String url) { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
106 |
return url.split("//", 2)[1]; |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
107 |
} |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
108 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
109 |
/** |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
110 |
* TODO: refactor/move, reuse |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
111 |
* |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
112 |
* @param info |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
113 |
* @return |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
114 |
*/ |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
115 |
private Properties translate(java.util.Properties info) { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
116 |
Properties properties = new Properties(); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
117 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
118 |
for (String name : info.stringPropertyNames()) { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
119 |
String value = info.getProperty(name); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
120 |
properties.add(new Property(name, value)); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
121 |
} |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
122 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
123 |
return properties; |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
124 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
125 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
126 |
@Override |
192
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
127 |
public boolean acceptsURL(String url) throws SQLException { |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
128 |
return url != null && url.startsWith("jdbc:sql-dk://"); |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
129 |
} |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
130 |
|
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
131 |
@Override |
a32bfcbdee51
jdbc-dk-driver: first working version
František Kučera <franta-hg@frantovo.cz>
parents:
177
diff
changeset
|
132 |
public DriverPropertyInfo[] getPropertyInfo(String url, java.util.Properties info) throws SQLException { |
171
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
133 |
return new DriverPropertyInfo[0]; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
134 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
135 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
136 |
@Override |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
137 |
public int getMajorVersion() { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
138 |
return 0; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
139 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
140 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
141 |
@Override |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
142 |
public int getMinorVersion() { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
143 |
return 1; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
144 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
145 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
146 |
@Override |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
147 |
public boolean jdbcCompliant() { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
148 |
return false; |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
149 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
150 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
151 |
@Override |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
152 |
public Logger getParentLogger() throws SQLFeatureNotSupportedException { |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
153 |
throw new SQLFeatureNotSupportedException("Not supported yet."); |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
154 |
} |
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
155 |
|
701ec4db43fb
JDBC loopback driver: first version
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
156 |
} |