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