Java Certification, Programming, JavaBean and Object Oriented Reference Books
How to Connect Database Through JSP

How to connect the database in jsp?

<form name='toolscode' target="cond_desc" action="conddesc.jsp"> <%
 Connection con= null;
 Statement stmt = null;
 ResultSet res=null;
  con = DriverManager.getConnection("jdbc:odbc:nncea","ceatest","test");
  stmt = con.createStatement();
  //res = stmt.executeQuery ("SELECT DISTINCT ORDITEMORDCODE from CEAORDITEMS WHERE PRINCIPALNAME= '" + principal_name2 + "';");  %>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="73">
      <td nowrap bgcolor="#C6E2FF"  class="heading" width="150" height="20" align="center">
    <span style="background-color: #C6E2FF; font-weight:700">
                <font size="2" face="Sylfaen">Condition Name</font></span><font face="Sylfaen" size="2">&nbsp;
      <td width="150" bgcolor="#C6E2FF" height="51" align="center">
        <p style="margin-top: 3; margin-bottom: 3" align="center">
              <span style="background-color: #C6E2FF; font-weight:700">
     <font face="Sylfaen" size="1" color="#FFFFFF">
      <SELECT NAME ="Condi_Name" Target = "conddesc.jsp" style="border: 1px solid #8AB0FF" onChange='submit()'>
    res = stmt.executeQuery ("SELECT DISTINCT ltrim(rtrim(CONDITIONNAME)) from CEATEMPSTORE;");
 <% }  // end try
  catch(Exception ex)
    System.err.print("...: " + ex.toString());
   }//end catch
  %> </form>

Java Tips by : Sowjanya Devi Uddaraju

Quick Links:
Do you have a Java Question?

Best Regards,
Java Programming Hints and Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.