aspose file tools*
The moose likes JDBC and the fly likes Using database in program. Design ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using database in program. Design ?" Watch "Using database in program. Design ?" New topic
Author

Using database in program. Design ?

Michael Boehm
Ranch Hand

Joined: Jun 02, 2010
Posts: 51
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

Joined: Sep 16, 2008
Posts: 241
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


SCJP 6, OCMJD 6, OCPJWSD 6
I no good English.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39409
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using database in program. Design ?