Improve XML parsing to handle attributes as well.
[cfb.git] / prod / net / jaekl / cfb / db / driver / PostgresqlDriver.java
1 package net.jaekl.cfb.db.driver;
2
3 // Copyright (C) 2015 Christian Jaekl
4
5 import java.sql.Connection;
6 import java.sql.DriverManager;
7 import java.sql.ResultSet;
8 import java.sql.SQLException;
9 import java.util.Properties;
10
11 import net.jaekl.cfb.db.Column;
12 import net.jaekl.cfb.db.Table;
13
14 public class PostgresqlDriver extends DbDriver {
15
16         @Override
17         public void load() throws ClassNotFoundException {
18                 // This should no longer be necessary, so long as we're using 
19                 // JDBC 4 (which came out with JDK 6) and an updated driver.
20                 // But, it shouldn't hurt, either.
21                 Class.forName("org.postgresql.Driver");
22         }
23
24         @Override
25         public Connection connect(String host, int port, String dbName, String user, String pass) throws SQLException {
26                 String url = "jdbc:postgresql://" + host + ":" + port + "/" + dbName;
27                 Properties props = new Properties();
28                 props.setProperty("user", user);
29                 props.setProperty("password", pass);
30                 //props.setProperty("ssl", "true");
31                 return DriverManager.getConnection(url, props);
32         }
33
34         @Override
35         public ResultSet selectColumnsFromWhere(Column[] columns, Table[] tables, String where) {
36                 // TODO Auto-generated method stub
37                 return null;
38         }
39
40 }