-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDriver.java
More file actions
63 lines (53 loc) · 1.78 KB
/
Driver.java
File metadata and controls
63 lines (53 loc) · 1.78 KB
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
62
63
package com.ionic.sdk.addon.jdbc;
import com.ionic.sdk.addon.jdbc.impl.IonicState;
import com.ionic.sdk.agent.Agent;
import com.ionic.sdk.error.IonicException;
import java.sql.Connection;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.util.Properties;
import java.util.logging.Logger;
/**
* Implementation of JDBC interface {@link java.sql.Driver}. Populated from IDE "Implement Methods" wizard.
*/
public class Driver implements java.sql.Driver {
@Override
public Connection connect(final String url, final Properties info) throws SQLException {
try {
final Agent agent = IonicState.getAgent(info);
final String driverClassName = info.getProperty("driverClassName");
final Class<?> driverClass = Class.forName(driverClassName);
final java.sql.Driver driverWrapped = (java.sql.Driver) driverClass.newInstance();
final Connection connection = driverWrapped.connect(url, info);
return new IonicConnection(info, connection, agent);
} catch (IonicException e) {
throw new SQLException(e);
} catch (ReflectiveOperationException e) {
throw new SQLException(e);
}
}
@Override
public boolean acceptsURL(String url) {
return false;
}
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
return new DriverPropertyInfo[0];
}
@Override
public int getMajorVersion() {
return 0;
}
@Override
public int getMinorVersion() {
return 0;
}
@Override
public boolean jdbcCompliant() {
return false;
}
@Override
public Logger getParentLogger() {
return Logger.getLogger(getClass().getName()).getParent();
}
}