You can access database either directly from your JSP page or using a class
or bean.
Directly from your JSP page
<HTML>
<HEAD>
<TITLE> type_Document_Title_here </TITLE>
</HEAD>
<BODY>
<%@ page language="java" import="java.sql.*, java.util.*"%>
<%try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:YourDatabase",
"", "");
///Now you have the connection object so you can now create your sql
statement and execute that to get ResultSet object from your database.
}catch(Exception e)
{
e.printStackTrace();
}
%>
</BODY>
</HTML>
Same code can be copied to a separate java file and then you can instantiate
an object and class its methods to get database connections.
Hope this will help
regards
Y
----- Original Message -----
From: Diwakar Killamsetty <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 11, 2000 2:30 PM
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