Hi,
please say what errors you get.
In any case, you have to result.next() before
accessing the fields.
ron
--- Sanjay Gomes <[EMAIL PROTECTED]> wrote:
> Hello All,
> I have written a simple JSP for connecting to a
> database and displaying a
> particular field in it.
> Can someone tell me whats wrong.
> I know that connecting through a bean is the most
> feasible but am trying out
> this simple JSP first
>
> <HTML>
> <BODY>
> <%@ page import="java.sql.*" %>
>
> <%! String dbURL="jdbc:odbc:bday";
> String dbCon="sun.jdbc.odbc.JdbcOdbcDriver";
> Connection con=null;
> ResultSet result;
> %>
> <%
> try{
> Class.forName(this.dbCon);
> con=DriverManager.getConnection(dbURL);
>
> Statement stmt=con.createStatement();
> result= stmt.executeQuery("Select * from bday ");
> }catch(Exception ex)
> {}
> %>
> <%=
> result.getString("Ename")
> %>
> <%con.close();
> %>
> </BODY>
> </HTML>
>
>
> TIA
> Sanjay
>
>
________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at
> http://www.hotmail.com
>
>
===========================================================================
> 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
__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/
===========================================================================
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