Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Specific SQLException

 
Roy Cantos
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try e.getMessage()?
 
Roy Cantos
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Post your query?
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic