Hello,

for database access :

1) use Gefionsoftware (www.gefionsoftware.com) connection pool class. It
makes life easier
    this class (and a tutorial) is available at :
http://webdevelopersjournal.com/columns/connection_pool.html


2) here is somme example of code

<%@ page language="java" import="java.sql.*,DBConnectionManager" %>

<%!
DBConnectionManager connMgr = DBConnectionManager.getInstance();
%>
<html>
<head>
<title> .....[.....]
<%
Connection con = connMgr.getConnection("idb");
java.sql.Date dt = new java.sql.Date(new java.util.Date().getTime());
          if (con == null) {
          out.println("ARGHH.. this stuff doesn't work.. keep cool man");
          return;
                  }
          try {
               Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery ("SELECT * FROM INTRANEWS WHERE
SAISIE_DATE ='" + dt  + "' ORDER BY SAISIE_DATE DESC");

          while(rs.next()) {
                  %>
         [
<%= rs.getString("SAISIE_DATE")%> ] <a
href="/admin/jsp/newsaffiche.jsp?id=<%= rs.getString("idINTRANEWS")%>"
target="_blank"> <%= rs.getString("TITRE")%></a><br>
<%
   }
   stmt.close();
   rs.close();
    }

   catch (SQLException e) {
          out.println("Can't access this sucker !");
    }
   connMgr.freeConnection("idb", con);
%>





Le 15:23 03/02/2000 +0530, Geratayya_Patchipulusu a écrit:
>Hello,
>
>Can u please tell, how I can access Data Base?
>
>If possible please tell me all the possible ways to access Data base.
>
>Thanks in advance
>-Geratayya.

+------------------------------------------------+
| Luc Saint-Elie                                 |
| email : [EMAIL PROTECTED]                    |
+------------------------------------------------+
|  Java Server Side  Open Source technologies    |
|       http://www.interpasnet.com/JSS           |
|  Work in progress for the new version          |
|       http://jss.interpasnet.com               |
+------------------------------------------------+

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to