wrap timestamps in quotes and print more status info

This commit is contained in:
Paul Trowbridge 2022-10-24 15:17:29 +00:00
parent 54ab5645b1
commit e60a92cfdc

View File

@ -35,7 +35,7 @@ public class jrunner {
Integer cols = null;
String[] dtn = null;
msg = "jrunner version 0.32";
msg = "jrunner version 0.34";
msg = msg + nl + "-scu source jdbc url";
msg = msg + nl + "-scn source username";
msg = msg + nl + "-scp source passowrd";
@ -140,6 +140,7 @@ public class jrunner {
//-------------------------------------------establish connections-------------------------------------------------
//source database
System.out.println("------------open database connections---------------------");
try {
scon = DriverManager.getConnection(scu, scn, scp);
} catch (SQLException e) {
@ -147,16 +148,17 @@ public class jrunner {
e.printStackTrace();
System.exit(0);
}
System.out.println(" ✅ source database");
//destination database
try {
dcon = DriverManager.getConnection(dcu, dcn, dcp);
} catch (SQLException e) {
System.out.println("issue connecting to desctination:");
System.out.println("issue connecting to destination:");
e.printStackTrace();
System.exit(0);
}
System.out.println(" ✅ destination database");
//----------------------------------------open resultset------------------------------------------------------------
System.out.println("issue connecting to desctination:");
try {
stmt = scon.createStatement();
rs = stmt.executeQuery(sq);
@ -183,7 +185,7 @@ public class jrunner {
try {
for (int i = 1; i <= cols; i++){
dtn[i] = rs.getMetaData().getColumnTypeName(i);
System.out.println(rs.getMetaData().getColumnName(i) + ": " + dtn[i]);
System.out.println(" * " + rs.getMetaData().getColumnName(i) + ": " + dtn[i]);
}
} catch (SQLException e) {
e.printStackTrace();
@ -230,6 +232,9 @@ public class jrunner {
case "TIME":
nc = "'" + rs.getString(i).replace("'","''") + "'";
break;
case "TIMESTAMP":
nc = "'" + rs.getString(i).replace("'","''") + "'";
break;
case "BIGINT":
nc = rs.getString(i);
default:
@ -297,6 +302,7 @@ public class jrunner {
System.out.println("issue closing connections");
e.printStackTrace();
}
System.out.println(" rows written");
System.out.println("");
}
}