jsp with database oracle
hai i am doing one program in jsp i want to check the jsp life cycle methods so wrote one program, in which i write jspInit() method and jspDestroy() methods. but i am getting error
i crate a table with the name employee
i am sending sample code to u. plz help me to fix this problem
<%@ page import ="java.sql.*" %>
<%@ page import ="java.util.*" %>
<%!
Connection con;
PreparedStatement ps;
public void jspInit()
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:online","system","manager");
ps=con.prepareStatement("insert into employees values(?,?,?)");
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void jspDestroy()
{
try
{
ps.close();
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
%>
<%
int eno = Integer.parseInt(request.getParameter("t1"));
String name=request.getParameter("t2");
float sal = Float.parseFloat(request.getParameter("t3"));
ps.setInt(1,eno);
ps.setString(2,name);
ps.setFloat(3,sal);
ps.executeUpdate();
%>
<%@ include file ="emp.html" %>
View Answers
February 9, 2011 at 1:38 PM
JSP with access database
To set up the DSN connection, follow these steps:
1)Go to the start<<Control Panel<<Administrative Tools<< data sources.
2)Click Add button and select the driver Microsoft Access Driver(*.mdb).
3)After selecting the driver, click finish button.
4)Then give Data Source Name and click ok button.
5)Your DSN will get created.
6) Restart your server and run your jsp code.
JSP code
<%@page import="java.sql.*"%>
<table border=1>
<tr><th>Name</th><th>Address</th></tr>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from data");
while(rs.next()){
%>
<tr><td><%=rs.getString("name")%></td><td><%=rs.getString("address")%></td></tr>
<%
}
rs.close();
st.close();
con.close();
}
catch(Exception e){}
%>
</table>
Related Tutorials/Questions & Answers:
oracle database backup using jsp oracle database backup using
jsp I want to take the backup of
oracle database.I want to write the code in
jsp ,so that when the page is loaded a backup of the
database is stored in one of my local drives.Is it possible to do
jsp with database oraclejsp with
database oracle hai i am doing one program in
jsp i want to check the
jsp life cycle methods so wrote one program, in which i write jspInit() method and jspDestroy() methods. but i am getting error
i crate a table
Advertisements
fetch record from oracle database using jsp-servlet?fetch record from
oracle database using
jsp-servlet? how can i fetch data from
oracle database by using
jsp-servlet. i'm using eclipse, tomcat server and
oracle database and creating
jsp pages and also using servlet
How to get data from Oracle database using JSP problem in
jsp in the sense to get data from the
database like
oracle . I have... data from the
database like
oracle), I have created one
jsp program like... in the sense to get data from the
database like
oracle . I have created one
jsp JSP-Oracle connectivityJSP-
Oracle connectivity I have created a "dynamic web project" mainly with
jsp files in eclipse and now, want to connect with
oracle 10g, so how can I proceed for the
database connection
retrieving from oracle database using jsp combo boxretrieving from
oracle database using
jsp combo box hi this is my... name of the server has to display in the process name field from the
oracle database please help on this i need code using servlets please help me .
<
java and oracle - JSP-Servlet to upload the resume of the employee and store it into
database and retrieve the same... data types in
oracle database. And I need to write the code in servlets and
jsp write excel file into the oracle databasewrite excel file into the
oracle database dear sir,
i need the
jsp code that reads the excel file and stores it into the
oracle database table..and also i need the code to connect
oracle database?
thank u in advance
Spring and Oracle DatabaseSpring and
Oracle Database I need example for Batch update process using
oracle database and spring framework with full explanation
java with Oracle Databasejava with
Oracle Database Hello
I have been encountering a problem regarding creating a table with Oracle.When i am creating new table in the
Database using
Oracle , it is giving error saying an errror occured incursive sql
Oracle Database connectivity probemOracle Database connectivity probem hi
Below is the code of
oracle database connectivity, when i compile it, it will show the error... also set the environment variable like that .;E:\
oracle\ora81\jdbc\lib
error oracle database connection?error
oracle database connection? hi now i am trying to connect
oracle database and also insert my data into table, but it's not working.. I created... in
oracle table. my table name is logininfoclient_sla. this is my coding
Oracle 9i database problemOracle 9i
database problem Hi Somebody has given the solution but i...
Oracle 9i in my laptop.and i got sql+ page ok.i have gone to control panel->odbc->in that i correctley configured DNS and TNS and tested the
Oracle jsp-oracle validation - JDBCjsp-
oracle validation Dear friends,
my validation not takes place....
---------------------------------------
logoutaction.jsp
---------------------------------------
oracle 10g
database
SQL> select * from login;
USERID PASSWORD
Oracle Database - Insert System TimeOracle Database - Insert System Time Hi I want to insert only system time dynamically using a statement but not a prepared statement into
Oracle Database please suggest me any code
jsp page connectivity with oracle - SQLjsp page connectivity with oracle I am unable to
database connectivity
jsp with
oracle.
Please send the code for solving problem.
thanks Hi Friend,
1)Import the packages:
2)Load the
oracle driver
Oracle Database error - JDBCOracle Database error String query11 = "SELECT product_code, product_quantity, price FROM o"+orderid;
ResultSet rs11 = stmt.executeQuery(query11);
while(rs11.next()){
product_code[j
Java Connection to Oracle databaseJava Connection to
Oracle database HI
I am ubable to connnect jdbc to
Oracle database.i had gone to control panel >>Administrative tool>>>Data source,in that forDNS name i typed
Oracle and in TNS i culdn't
Database Connectivity Withe OracleDatabase Connectivity Withe Oracle Develop a program to perform the
database driven operation like insert, Delete,
Update and select. To perform the above operations create one table named
Employee.
Field Name Field Type
EmpId
jsp database jsp database I want to retrive value in my
jsp page but i dont want show my
database query in my
jsp page. is there any other method to show value in my
jsp page using java class
About connection database oracle to javaAbout connection
database oracle to java Hi
I culdn't connect
oracle datebase to java.when i compile the program it is ok.but when i clicked...
Oracle and then i clicked add button.Then Dialog box came indicating DNS and TNS
About connection database oracle to javaAbout connection
database oracle to java **Hi
I culdn't connect
oracle datebase to java.when i compile the program it is ok.but when i clicked...
Oracle and then i clicked add button.Then Dialog box came indicating DNS and TNS
About connection database oracle to javaAbout connection
database oracle to java Hi
I culdn't connect
oracle datebase to java.when i compile the program it is ok.but when i clicked...
Oracle and then i clicked add button.Then Dialog box came indicating DNS and TNS
About connection database oracle to javaAbout connection
database oracle to java I culdn't connect
oracle... Panel>>Administrative Tools>>Data Sources in that i selected
Oracle... just typed DNS as
Oracle and for TNS i clicked on the list of TNS. But it has
About connection database oracle to javaAbout connection
database oracle to java I culdn't connect
oracle... Panel>>Administrative Tools>>Data Sources in that i selected
Oracle... just typed DNS as
Oracle and for TNS i clicked on the list of TNS .But it has
java and oracle - JSP-Servlet data (think as 50 records) in
database. Now i want to retrive the data from the
database(20 records at each time but should be different for each time... Mysql for this purpose. Try the following code:
Pagination of
JSP Java Barcode Program with Oracle database no and serial no of the item being scanned to
Oracle 10g
database. I dont have any...Java Barcode Program with
Oracle database Hi Everyone,
I need help to develop my new project, am going to do with barcode s/w, am very new
insert user session into other oracle database table insert user session into other
oracle database table hello
i am a doing my project in
jsp-servlet. i have doubt that when a user login to his... table. with user id i also want to insert date and current time in to
database