blob: a1dfc1f4fa30b86686e492806a33094c3cc3c566 (
plain)
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
|
package org.madore.damlengine;
import java.util.Properties;
import java.sql.Connection;
import java.sql.SQLException;
import org.postgresql.Driver;
public final class WeblogDatabaseConnection {
private WeblogDatabaseConnection() { // Forbid instantiation
throw new AssertionError("WeblogDatabaseConnection cannot be instantiated");
}
public static Connection conn;
public static Connection getConnection()
throws SQLException {
if ( conn == null ) {
final String dbUrl = "jdbc:postgresql://localhost/weblog";
final Properties dbProps = new Properties();
dbProps.setProperty("user", "david");
dbProps.setProperty("password", "IHATETHISWHYCANTIUSEUNIXDOMAINSOCKETS");
dbProps.setProperty("ssl", "true");
dbProps.setProperty("sslfactory", "org.postgresql.ssl.NonValidatingFactory");
conn = (new Driver()).connect(dbUrl, dbProps);
}
return conn;
}
}
|