Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

preparedStament and JDBC 2.0

Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pardon my ignorance: i'm using MySql and as a front end a swing app; i display my dinamic queries in JTables.
i wonder if i can take advantage of Updatable Result Sets... and how (i read the java tutorial but only found examples with command line, no table models in the middle...)
i've a table model that receives a resultset and then populates my jtable;
is it possible to have my jTable refreshed whenever i insert i new line in database?

author & internet detective
Posts: 40200
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works the same way as from the command line. The difference is that you need to setup Swing event handlers to update the model and resultset when one or the other changes. I recommend posting in the Swing/AWT forum to ask about this part.
miguel lisboa
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks, Jeanne
i got very discouraged because i tried something along those lines and got this error msg:

com.mysql.jdbc.NotUpdatable: Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.

i do use several tabs, so i guess there�s no way...
His brain is the size of a cherry pit! About the size of this ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic