this is the prob...
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("nehalDS");
Connection con = ds.getConnection();
Statement stmt = con.createStatement();
stmt.execute(some query");
ResultSet rs = stmt.getResultSet();
the same code i am using in all the jsps through out the site to access the oracle database. I need to abstract it into some reuseable pattern.i found out Data Access Object pattern is the solution but how to use it... can any1 help me with some small example on which i can built up...
Thanks
Nehal.
-
Data Access Design Pattern what is it &how to use it .. ???? (2 messages)
- Posted by: Nehal Dave
- Posted on: December 02 2002 22:16 EST
Threaded Messages (2)
- Data Access Design Pattern what is it &how to use it .. ???? by Dorel Vaida on December 03 2002 03:52 EST
- Data Access Design Pattern what is it &how to use it .. ???? by Web Master on December 03 2002 13:51 EST
-
Data Access Design Pattern what is it &how to use it .. ????[ Go to top ]
- Posted by: Dorel Vaida
- Posted on: December 03 2002 03:52 EST
- in response to Nehal Dave
If I understand right you are looking for a replaceable persistence layer ? You might look into EJB Design Patterns of Floyd Marinescu and search for Data Access Command Bean pattern. It's lightweight and extremely effective unless you have lotsa domain objects, situation when your persistence layer becomes clutterd with small classes... but it's your choice at last
Dunno if this helps, sorry. you might be a little more specific in your next note ... :-) -
Data Access Design Pattern what is it &how to use it .. ????[ Go to top ]
- Posted by: Web Master
- Posted on: December 03 2002 13:51 EST
- in response to Nehal Dave
DAO Pattern - http://java.sun.com/blueprints/patterns/DAO.html
You should also consider using the MVC pattern instead of having your JSPs talk directly to your DB. JSP's should simply present data w/o needing to know where it came from.