package com.ibm.database.compatibility;

import java.io.FileNotFoundException;
import java.io.IOException;

public class OperationReaderRunner implements Runnable {

	private final JdbcClient client;
	private final OperationReader os;

	public OperationReaderRunner(JdbcClient client, OperationReader os) {
		this.client = client;
		this.os = os;
	}

	@Override
	public void run() {
		try {
			while (os.hasNext()) {
				Operation op = os.next();
				if (op != null) {
					//System.out.println(op.toString());
					op.invoke(client);
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		JdbcClient client = new BasicJdbcClient();
		JsonOperationReader os = null;
		try {
			os = new JsonOperationReader("/tmp/ops.json");
			OperationReaderRunner osr = new OperationReaderRunner(client, os);
			osr.run();
		} catch (FileNotFoundException e) {
			if (os != null) {
				try {
					os.close();
				} catch (IOException e1) {
				}
			}
			e.printStackTrace();
		}
	}

}

@@ -99,16 +99,46 @@
 ception;
+%0Aimport java.sql.SQLException;
 %0A%0Apublic
@@ -569,16 +569,133 @@
 %09%7D%0A%09%09%09%7D%0A
+%09%09%7D catch (SQLException e) %7B%0A%09%09%09System.err.println(e.getErrorCode() + %22:%22 + e.getMessage());%0A%09%09%09e.printStackTrace();%0A
 %09%09%7D catc

Handle SQLExceptions