Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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

Using database in program. Design ?

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After having run through Sun's beginning tutorial on JDBC I am playing around with making a small program that retrieves some rows from a local mySQL database.

Is it reasonable to create a class whos responsibility is to retrieve rows based on schema-dependent queries ?
After this I have been thinking that it seems likely that this class is something I could use whenever I am connecting to a database from a program so it could be beneficial to make it reusable. But then one needs to somehow "abstract" the specific relational schema for the present database away and somehow make this class "generic". So it is as if I am in need of constructing some interface for the database which can give me info about its schema(s). Don't know if I am making sense here !
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think you're making sense A lot has been done regarding this issue.

Take a look at Apache Cayenne, CRUD maybe even Hibernate or TopLink

Regards,

Martin
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might however be reinventing the wheel; things like ResultSet might already provide the functionality you require.

And I shall move this thread to our JDBC forum.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic