Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-30-2008, 10:54 AM
Java Tip's Avatar
Moderator
 
Join Date: Nov 2007
Posts: 1,691
Rep Power: 5
Java Tip will become famous soon enoughJava Tip will become famous soon enough
Default JSP - using connection cache
Code below shows how to use connection cache from JSP:

Note: myconnection contains the cache name to be used

Code:
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
  javax.sql.DataSource ds = (javax.sql.DataSource)
      ctx.lookup("java:comp/env/jdbc/myconnection");
  java.sql.Connection con = ds.getConnection();
  java.sql.PreparedStatement stmt = con.prepareStatement(sql);
  java.sql.ResultSet rs = stmt.executeQuery();

  while (rs.next()) {
     //do something
  }
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
clear cache Jadellll New To Java 0 03-20-2008 10:27 AM
BuffededImage cache tim New To Java 1 01-24-2008 01:00 AM
cache problem in jsp lpwing JavaServer Pages (JSP) and JSTL 4 01-15-2008 08:43 AM
how to restict cache fred JavaServer Pages (JSP) and JSTL 1 07-24-2007 02:56 AM
cache problem MichYer Java Applets 3 07-11-2007 10:13 AM


All times are GMT +2. The time now is 01:27 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org