Skip to content

Commit 5fdfc87

Browse files
committed
Connection configuration
1 parent 931c8c6 commit 5fdfc87

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/cv/bockdamm/tst/ConnectionTest.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55

66

77
import java.io.FileInputStream;
8-
import java.io.IOException;
98
import java.sql.Connection;
109
import java.sql.DatabaseMetaData;
1110
import java.sql.DriverManager;
12-
import java.sql.SQLException;
1311
import java.util.Properties;
1412

1513

@@ -18,27 +16,24 @@
1816

1917
public class ConnectionTest {
2018

21-
public String makeConnection() throws IOException, ClassNotFoundException, SQLException {
19+
public static void main(String[] args) throws Exception {
20+
2221
Properties props = new Properties();
23-
FileInputStream fis = new FileInputStream("src/com/mikusher/dwr/connection/db.properties");
24-
props.load(fis);
25-
fis.close();
26-
String connectionShow;
22+
FileInputStream fis = new FileInputStream("src/cv/bockdamm/tst/db.properties");
23+
props.load(fis);
24+
fis.close();
2725

28-
String postgresconnection = props.getProperty("postgres.url") + props.getProperty("postgres.dbName");
29-
String postgresusr = props.getProperty("postgres.user");
30-
String postgrespsw = props.getProperty("postgres.passwd");
26+
String postgresconnection = props.getProperty("postgres.url") + props.getProperty("postgres.dbName");
27+
String postgresusr = props.getProperty("postgres.user");
28+
String postgrespsw = props.getProperty("postgres.passwd");
3129

32-
Class.forName(props.getProperty("postgres.driver"));
30+
Class.forName(props.getProperty("postgres.driver"));
3331

3432
try (Connection dbpsql = DriverManager.getConnection(postgresconnection, postgresusr, postgrespsw)) {
3533
DatabaseMetaData dbpsqlmd = dbpsql.getMetaData();
3634

37-
connectionShow = "Connection to " + dbpsqlmd.getDatabaseProductName() + " "
38-
+ dbpsqlmd.getDatabaseProductVersion() + " successful.\n";
35+
System.out.println("Connection to " + dbpsqlmd.getDatabaseProductName() + " "
36+
+ dbpsqlmd.getDatabaseProductVersion() + " successful.\n");
3937
}
40-
41-
return connectionShow;
42-
4338
}
4439
}

0 commit comments

Comments
 (0)