Browse Source

Moved initial opening of output so that files aren't created if the connection

fails.
master
Christopher Ramey 12 years ago
committed by cdramey
parent
commit
4abd15d18e
  1. 3
      src/com/binarythought/jdbcjson/JDBCJSON.java

3
src/com/binarythought/jdbcjson/JDBCJSON.java

@ -66,8 +66,6 @@ public class JDBCJSON
Connection conn = null;
JsonWriter writer = null;
try {
writer = new JsonWriter(new FileWriter(out, false));
conn = DriverManager.getConnection(url);
Statement st = conn.createStatement(
@ -79,6 +77,7 @@ public class JDBCJSON
ResultSetMetaData rsmd = rs.getMetaData();
int columns = rsmd.getColumnCount();
writer = new JsonWriter(new FileWriter(out, false));
writer.beginArray();
while(rs.next()){
writer.beginObject();

Loading…
Cancel
Save