Skip to content

Commit

Permalink
Maybe working now?
Browse files Browse the repository at this point in the history
  • Loading branch information
oscargus committed Dec 6, 2015
1 parent 17372ba commit 1f6b67b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 4 additions & 3 deletions src/main/java/net/sf/jabref/sql/DbConnectAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void action() {
PositionWindow.placeDialog(dbd, panel);
dbd.setVisible(true);

// connnect to database to test DBStrings
// connect to database to test DBStrings
if (dbd.getConnectToDB()) {

dbs = dbd.getDBStrings();
Expand All @@ -82,8 +82,9 @@ public void action() {
Localization.lang("Establishing SQL connection..."));
DBExporter exporter = (new DBExporterAndImporterFactory())
.getExporter(dbs.getServerType());
Connection conn = exporter.connectToDB(dbs);
conn.close();
try (Connection conn = exporter.connectToDB(dbs)) {
// Nothing
}
dbs.isConfigValid(true);
panel.frame().output(
Localization.lang("SQL connection established."));
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/sf/jabref/sql/SQLUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,8 @@ public static String getExceptionMessage(Exception ex) {
*/
public static ResultSet queryAllFromTable(Connection conn, String tableName) throws SQLException {
String query = "SELECT * FROM " + tableName + ';';
try (Statement res = (Statement) SQLUtil.processQueryWithResults(conn, query)) {
return res.getResultSet();
}
Statement res = (Statement) SQLUtil.processQueryWithResults(conn, query);
return res.getResultSet();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ public static PostgreSQLImporter getInstance() {

@Override
protected ResultSet readColumnNames(Connection conn) throws SQLException {
try (Statement statement = (Statement) SQLUtil.processQueryWithResults(conn,
"SELECT column_name FROM information_schema.columns WHERE table_name ='entries';")) {
return statement.getResultSet();
}
Statement statement = (Statement) SQLUtil.processQueryWithResults(conn,
"SELECT column_name FROM information_schema.columns WHERE table_name ='entries';");
return statement.getResultSet();
}

@Override
Expand Down

0 comments on commit 1f6b67b

Please sign in to comment.