• 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

Starter Question.

 
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are the following statements correct.


For DML (Data Manipulation Language) statements like update, insert, delete we use the method executeUpdate.

For select statement we use executeQuery which returns a ResultSet instance.

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sort of yes.

There are times and ways you could use execute() instead, but for beginners (and for most of general purpose code), that's the way to do it.

Beginners should also start with using PreparedStatement, instead of Statement. Many people have the idea that Statement is easier, and therefore should be learned first, but Statement has all sorts of problems and really shouldn't be used much at all...
reply
    Bookmark Topic Watch Topic
  • New Topic