• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to tell if a DDL has failed?

 
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am very new to JDBC.

If i issue a DDL, say "alter table", by stmt.execute() or
stmt.executeUpdate(), is there any way I can check if the statement is
successfully executed in the db? The return value of stmt.executeUpdate() is int and is 0 for DDL. So, is there any way to differentiate between a successful DDL vs a failed one?
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should throw a SQLException. You could try it out with simple DDL that will obviously fail.

See Statement API


executeUpdate
public int executeUpdate(String sql)
throws SQLException

 
reply
    Bookmark Topic Watch Topic
  • New Topic