Fetching Data From A Database |
|
| |
| |
This JSP source code is about fetching data from a database .... |
| |
|
| |
<%@ page import="java.sql.*" %>
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>
<HTML>
<HEAD>
<TITLE>Fetching Data From a Database</TITLE>
</HEAD>
<BODY>
<H1>Database Lookup</H1>
<FORM ACTION="self.jsp" METHOD="POST">
Please enter the ID of the publisher you want to find:
<BR>
<INPUT TYPE="TEXT" NAME="id">
<BR>
<INPUT TYPE="SUBMIT" value="Submit">
</FORM>
<H1>Fetching Data From a Database</H1>
<%
"jdbc:odbc:data","userName","password");
Statement statement = connection. createStatement();
String id = request. getParameter("id");
statement.executeQuery("select * from tableName where id = '" id "'") ;
if(!resultset.next()) {
out.println("Sorry,could not find that publisher. "
"Please <A HREF='tryAgain.html'>try again</A>.");
} else {
%>
<TABLE BORDER="1">
<TR>
<TH>ID</TH>
<TH>Name</TH>
<TH>City</TH>
<TH>State</TH>
<TH>Country</TH>
</TR>
<TR>
<TD> <%= resultset.getString(1) %> </TD>
<TD> <%= resultset.getString(2) %> </TD>
<TD> <%= resultset.getString(3) %> </TD>
<TD> <%= resultset.getString(4) %> </TD>
<TD> <%= resultset.getString(5) %> </TD>
</TR>
</TABLE>
<BR>
<%
}
%>
</BODY>
</HTML>
|
|
| |
|
|
| |
Date entered :
23rd Jan 2007
Rating : No Rating
Accessed :
2116
Submitted by :
javabill |
|
|
| |
|
|
| |
| |
|
Click each image to add this page to each site. |
|
|
| |
| |
|
| |
|
|
No comment available at the moment.Be the first one to make a comment
|
|
|
| |
|
|
Database error: Invalid SQL: select FLOOR( AVG(b.rating)) as avg_rating,a.sourcecode_id sourcecode_id ,title,description,author,category_id,skill_level,reference,reference_mail,reference_url,a.user_id user_id,date_entered,source,accessed,dev_id,file_url,total_comments,instruction,registered,authorised,fld_deletemark,fld_code_version,fld_searchkeyword,fld_code_status,category_id from tbl_sourcecode a LEFT JOIN tbl_sourcecodecomment b ON a.sourcecode_id = b.sourcecode_id LEFT JOIN tbl_codecategory c ON a.category_id = c.fld_categoryID where a.fld_deletemark = 'N' AND a.fld_enable_disable= 'Y' AND a.authorised='Y' AND c.fld_groupIDFK='4' AND a.sourcecode_id!='804' GROUP BY a.sourcecode_id order by a.sourcecode_id DESC limit 0, 5
MySQL Error: 1030 (Got error 122 from storage engine)
Session halted.
Warning: Unknown(): write failed: Disk quota exceeded (122) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/tmp) in Unknown on line 0
| |