Handle Exceptions of database importing from dump

I'm restoring my MySQL database from java code.

I use Process for running a batch file and i need to roleback if there were any exceptions.

How can I track the exceptions?

Is there any way doing it with jdbc "Statements"?

[247 byte] By [yaronra] at [2007-11-27 11:47:00]
# 1

Use try-catch blocks.

BalusCa at 2007-7-29 18:10:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

The Problem is that The Procces can be successful because it ran the command but I can't know wether the command ran well.

yaronra at 2007-7-29 18:10:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

Oh, now I see the point.

Wel, it depends on batchfile and the process. What exactly does the batchfile? Is there any output from the batchfile? Does the process exit with -1 if there is any error? Etcetera.

BalusCa at 2007-7-29 18:10:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

I realy prefer using Java Statements if there is any way doing that, and control the exceptuions with JDBC instead of Procces

At the moment the command I run is:

mysql -h localhost -u Username -pPassword db_name < dump_file_name.sql

yaronra at 2007-7-29 18:10:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

yaronra at 2007-7-29 18:10:42 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...