aspose file tools*
The moose likes JDBC and the fly likes Specific SQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Specific SQLException" Watch "Specific SQLException" New topic
Author

Specific SQLException

Roy Cantos
Ranch Hand

Joined: Feb 22, 2002
Posts: 38
Hi Guys,
I have used the oracle thin client (classes12.zip) driver and jdbc, the problem is when i execute a sql command it throws exception, is there any way to determine the exact root of the error for example: table or view doesn't exist, i'm also using a batch update.
Thanks,
Roy
Shuai Liu
Ranch Hand

Joined: Jan 25, 2002
Posts: 49
try e.getMessage()?
Roy Cantos
Ranch Hand

Joined: Feb 22, 2002
Posts: 38
Originally posted by Shuai Liu:
try e.getMessage()?

Hi Shuai,
i've try to use this:
catch(SQLException e) {
System.out.println(e);
System.out.println("Error Code: " + e.getErrorCode());
System.out.println("SQL State: " + e.getSQLState());
System.out.println("SQL Message" + e.getMessage());
}
but it only output this:
java.sql.SQLException: Could not execute sql command - Original message: null
Error Code: 0
SQL State: null
SQL MessageCould not execute sql command - Original message: null
Thanks,
Roy
Shuai Liu
Ranch Hand

Joined: Jan 25, 2002
Posts: 49
Post your query?
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

table or view doesn't exist -
this means the table or view isn't physically in the database or the client that is connected to the database does not have permissions to use the table or view. Usually this will happen if you create a table in the database as the administrator, then forget to assign permissions to the user.
Jamie
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

try not batching to see exactly which SQL statement is giving you problems. You can return to batching after you figure this problem out.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Specific SQLException