July 15, 2008 at 7:15 PM
Hi
<%@ page language="java" import="java.sql.*" %>
<html>
<head>
<title>Retrive value from database</title>
</head>
<body>
<table border="1" width="75%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<h2><font color="#FF0033">Retrive data from database</font></h2>
<form method="POST" >
<table border="1" width="100%" cellspacing="0" cellpadding="0" bgcolor="#CCFFCC">
<tr>
<td width="50%"><b>User id:</b></td>
<td width="50%"><b>Course Name</b></td>
<td width="50%"><b>Courese Fee</b></td>
<td width="50%"><b>Faculty Name</b></td></tr>
<%
Connection con = null;
String url = "jdbc:
mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,"amar","amar123");
try{
Statement st = con.createStatement();
String query = "SELECT id,coursename,couresefee,facultyname FROM student where id=id";
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
String coun=rs.getString(1);
String coun1=rs.getString(2);
%>
<tr>
<td width="50%"><%=coun%></td>
<td width="50%"><%=coun1%></td>
<td width="50%"><%=rs.getString("couresefee")%></td>
<td width="50%"><%=rs.getString("facultyname")%></td></tr>
<%}
out.println("<br/><a href=RetriveForm.jsp><b>Insert Data page</b></a>");
rs.close();
con.close();
}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}
%>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
---------------------------------------
Read for more information.
http://www.roseindia.net/jsp/Thanks
Related Tutorials/Questions & Answers:
retrieving from db - JSP-Servletretrieving from db hello'
I am trying to write my first application...: rst=stmt.executeQuery("select *
from books_details");
27: %>
28...; Hi
Retrive value
from database
Retrive data
from retrieving info from DB using struts?retrieving info
from DB using struts? Hi. I was looking info about
retrieving info
from a database using struts.
I need a .java that I suppose connects to a database and show the info on a jsp.
Somebody could help me
Advertisements
Retrieving attribute value from XMLRetrieving attribute value
from XML I have an XML as below to parse... snippet is as below:
DocumentBuilder
db = DocumentBuilderFactory.newInstance...://www.roseindia.net/xml/getting-text-values-
from-a-nodel.shtmlADS_TO_REPLACE_3
http
retrieving xml document from databaseretrieving xml document
from database Hi Guys,
I want to retrieve the xml document stored in the database on to a jsp page using jdbc/odbc connnection.Please help me in implementing this feature.
Thank You
Madhu
Retrieving specific data from excelRetrieving specific data
from excel Hello everyone, i have written a simple code to retrieve data
from excel sheet and working fine, the excel file... first sheet
from the workbook
HSSFSheet sheet = workbook.getSheetAt(0
Retrieving the Image from a database TableRetrieving the Image
from a database Table
Consider a case where we want... to retrieve the
image
from the database table. You can do it very easily after...
from the database table our java program need to make a connection
Retrieving Data from Database to fill Combo BoxRetrieving Data
from Database to fill Combo Box Sir,
I have a JSP Page with a combo box and a label. I have a database that has two fields id and an image. Now I want to fill the combo box with image and on selecting
retrieving of value from excel file - JSP-Servletretrieving of value
from excel file Dear sir,
Thanks for sending... this message to all the employees when i upload a file then it fetch a data
from that excel sheet i.e this matter will take a para meter values
from the excel
retrieving of value from excel file - JSP-Servletretrieving of value
from excel file Dear sir,
Thanks for sending... this message to all the employees when i upload a file then it fetch a data
from that excel sheet i.e this matter will take a para meter values
from the excel
retrieving of value from excel file - JSP-Servletretrieving of value
from excel file Dear sir,
Thanks for sending a code now i am getting a particular column value i.e EmailId column for snding a massmails,now i have to get a particular column values i.e Name(A),EL(B
Retrieving JTree structure from database Retrieving JTree structure
from database
This example shows how to
retrieving data
from... of
information
from which the user can make single or multiple selections. In list
You can
fat image from db fat image
from db <%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%
Blob image = null... = stmt.executeQuery("select image
from regimg where id ='45'");
if (rs.next
fat image from db fat image
from db <%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%
Blob image = null... = stmt.executeQuery("select image
from regimg where id ='45'");
if (rs.next
fat image from db fat image
from db <%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%
Blob image = null... = stmt.executeQuery("select image
from regimg where id ='45'");
if (rs.next
fat image from db fat image
from db <%@ page import="java.sql.*"%>
<%@ page import="java.io.*"%>
<%
Blob image = null... = stmt.executeQuery("select image
from regimg where id ='45'");
if (rs.next
Retrieving data from data base using jsp combo boxRetrieving data
from data base using jsp combo box Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one... of the server it has to display the process name
from database into the process name
how to check dates while retrieving data from databasehow to check dates while
retrieving data
from database i want to update database record based on delivery date i have tried this query but it wont work
b="update deliveryorder set prtnm='"+arr[1]+"',stn='"+arr[0]+"',sbston
same thing i want but from db..same thing i want but
from db.. http://www.roseindia.net/tutorial/javascript/dynamicCombo.html
same thing i want but
from db View Photo From Db MySqlView Photo
From Db MySql Good Morning Sir,
Please help me, I make a small code but i have a error. I want to make viewer photo
from database...();
ResultSet res = stat.executeQuery("select *
from kar where nik
retrieving from oracle database using jsp combo boxretrieving from oracle database using jsp combo box hi this is my code in this once i select the server type and version of the server the process name of the server has to display in the process name field
from the oracle
How to access data yearly from DB in C# ?How to access data yearly
from DB in C# ? how to access data yearly
from database in C#.
I have code but i m not able to retrieve data yearly
from DB table.
string date1 = dateTimePicker1.Value.Date.ToString("dd/MMM/yyyy
how to insert, retrieve data from,to db(code)....how to insert, retrieve data
from,to
db(code).... Hi.....
i ve... that data will b stored in
db(m using sybase).
2.also hw to retrieve the data
from db.
cn u plz tel me the code in detail.n i thk it shud b written in jdbc
how to insert, retrieve data from,to db(code)....how to insert, retrieve data
from,to
db(code).... Hi, i have created login page n in that a registration form also in jsp, my doubt is-when new user... will b stored in
db(m using sybase).
2.also hw to retrieve the data
from db. cn u
Retrieving Data From the XML file Retrieving Data
From the XML file
... is only geared towards showing how to construct a Java object
from an XML document.
By this example we are going to get the XML data
from the xml file in our