Hi Diwakar,
I got this piece of info from a JSP faq.Hope it may be helpful to u.
-------------------------------------------------------------------
What are the important steps in using JDBC in JSP?
1) Instantiate an instance of the JDBC driver you're trying to use (jdbc-odbc
bridge name from memory so pls check):
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" ).newInstance();
This determines if the class is available and instantiates a new instance of
it, making it available for the next step.
2) Ask the DriverManager for a Connection object based on the JDBC URL you
are using:
Connection connDB = DriverManager.getConnection( "jdbc:odbc:MyDSN",
"username", "password" );
DriverManager searches through any registered drivers (instantiating a new
instance above is enough to register a driver with the DriverManager, as each
implementation is required to) and, based on
the JDBC URL you are using, returns the appropriate implementation of
Connection.
3) Create a Statement object to retrieve a ResultSet
Statement smentDB = connDB.createStatement();
ResultSet rsDB = connDB.executeQuery( "SELECT * FROM Foo" );
or
rsDB = connDB.executeUpdate( "UPDATE Foo SET Bar = NULL" );
4) Close down connections to free resources:
rsDB.close();
smentDB.close();
connDB.close();
---------------------------------------------------------------------------------
Regds
Rakesh.
Tamanna Kher wrote:
> simple using a class or a bean.
>
> Diwakar Killamsetty <[EMAIL PROTECTED]> on 07/11/2000 04:00:01 PM
>
> Please respond to A mailing list about Java Server Pages specification and
> reference <[EMAIL PROTECTED]>
>
> To: [EMAIL PROTECTED]
> cc: (bcc: Kher Tamanna-SWD-ITIL-UB/Itilmail)
>
> Subject: How to access database from JSP?
>
> Hi,
>
> How can I access database directly from JSP?
> Thanks in advance.
>
> regards,
>
> Diwakar
>
> Tel: +91-40-3308600, ext. 8547.
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets