Debian Codegraph @

lang/sql/jdbc/SQLite/JDBCDataSource.javajsr169

raw
1 package SQLite;
2
3 import java.sql.Connection;
4 import java.sql.SQLException;
5 import javax.sql.DataSource;
6 import java.util.Properties;
7 import java.io.PrintWriter;
8
9 public final class JDBCDataSource extends JDBC implements DataSource {
10
11 private String url;
12
13 private int loginTimeout;
14
15 private PrintWriter logWriter;
16
17 public JDBCDataSource(String url) {
18 if (url == null) {
19 this.url = "jdbc:sqlite:/:memory:";
20 } else {
21 this.url = url;
22 }
23 }
24
25 public Connection getConnection() throws SQLException {
26 return getConnection(null, null);
27 }
28
29 public Connection getConnection(String user, String password)
30 throws SQLException {
31 Properties info = new Properties();
32 if (password != null) {
33 info.setProperty("password", password);
34 }
35 return connect(url, info);
36 }
37
38 public int getLoginTimeout() {
39 return loginTimeout;
40 }
41
42 public void setLoginTimeout(int seconds) {
43 this.loginTimeout = seconds;
44 }
45
46 public PrintWriter getLogWriter() {
47 return logWriter;
48 }
49
50 public void setLogWriter(PrintWriter out) {
51 this.logWriter = logWriter;
52 }
53
54 // public <T> T unwrap(java.lang.Class<T> iface) throws SQLException
55 public java.lang.Object unwrap(java.lang.Class iface) throws SQLException {
56 throw new SQLException("unsupported");
57 }
58
59 public boolean isWrapperFor(java.lang.Class iface) throws SQLException {
60 return false;
61 }
62
63 }