-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathJDCConnectionDriver.java
executable file
·61 lines (53 loc) · 1.86 KB
/
JDCConnectionDriver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Properties;
/**
* <b>Purpose:</b>Wrapper for JDBCConnectionDriver.<br>
* <b>Description:</b>http://java.sun.com/developer/onlineTraining/Programming/JDCBook/
* conpool.html<br>
* <b>Copyright:</b>Licensed under the Apache License, Version 2.0.
* http://www.apache.org/licenses/LICENSE-2.0<br>
* <b>Company:</b> SIMPL<br>
*
* @author schneimi
* @version $Id: JDCConnectionDriver.java 1224 2010-04-28 14:17:34Z
* [email protected] $<br>
* @link http://code.google.com/p/simpl09/
*/
public class JDCConnectionDriver implements Driver {
public static final String URL_PREFIX = "jdbc:jdc:";
private static final int MAJOR_VERSION = 1;
private static final int MINOR_VERSION = 0;
private ConnectionService pool;
public JDCConnectionDriver(String driver, String url, String user, String password)
throws ClassNotFoundException, InstantiationException, IllegalAccessException,
SQLException {
DriverManager.registerDriver(this);
Class.forName(driver).newInstance();
pool = new ConnectionService(url, user, password);
}
public Connection connect(String url, Properties props) throws SQLException {
if (!url.startsWith(JDCConnectionDriver.URL_PREFIX)) {
return null;
}
return pool.getConnection();
}
public boolean acceptsURL(String url) {
return url.startsWith(JDCConnectionDriver.URL_PREFIX);
}
public int getMajorVersion() {
return JDCConnectionDriver.MAJOR_VERSION;
}
public int getMinorVersion() {
return JDCConnectionDriver.MINOR_VERSION;
}
public DriverPropertyInfo[] getPropertyInfo(String str, Properties props) {
return new DriverPropertyInfo[0];
}
public boolean jdbcCompliant() {
return false;
}
}