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

Using database in program. Design ?

 
Michael Boehm
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • 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 !
 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • 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
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic