unable to get datas from oracle database
Dear Sir,
I am again struck in my project..
i want to display data from oracle database but i get this error when i run the jsp file in tomcat, I post my code below.. kindly let me know what i am wrong!! kindly help me in this.
out.jsp
<%@ page session="false"%>
<%@ page import="java.io.*" import="java.sql.*"%>
<%try {
Connection con=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@//172.25.50.247:1521/knits", "ADMIN", "ADMIN");
ps=con.prepareStatement("select * from departments");
ResultSet rs= ps.executeQuery();
while(rs.next())
{
out.println(rs.getInt(name));
out.println(rs.getString(id));
} } catch(Exception e) {}
rs.close();
ps.close();
con.close(); %>
Error from apache tomcat
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 9 in the jsp file: /jsp/test/form.jsp
Duplicate local variable con
6: Class.forName("oracle.jdbc.driver.OracleDriver");
7:
8: Connection
9: con=DriverManager.getConnection("jdbc:oracle:thin:@//172.25.50.247:1521/knits", "ADMIN", "ADMIN");
10:
11: ps=con.prepareStatement("select * from departments");
12: ResultSet rs= ps.executeQuery();
An error occurred at line: 11 in the jsp file: /jsp/test/form.jsp
ps cannot be resolved to a variable
8: Connection
9: con=DriverManager.getConnection("jdbc:oracle:thin:@//172.25.50.247:1521/knits", "ADMIN", "ADMIN");
10:
11: ps=con.prepareStatement("select * from departments");
12: ResultSet rs= ps.executeQuery();
13: while(rs.next())
14: {
An error occurred at line: 12 in the jsp file: /jsp/test/form.jsp
ps cannot be resolved
9: con=DriverManager.getConnection("jdbc:oracle:thin:@//172.25.50.247:1521/knits", "ADMIN", "ADMIN");
10:
11: ps=con.prepareStatement("select * from departments");
12: ResultSet rs= ps.executeQuery();
13: while(rs.next())
14: {
15: out.println(rs.getInt(name));
An error occurred at line: 15 in the jsp file: /jsp/test/form.jsp
name cannot be resolved to a variable
12: ResultSet rs= ps.executeQuery();
13: while(rs.next())
14: {
15: out.println(rs.getInt(name));
16: out.println(rs.getString(id));
17: } } catch(Exception e) {}
18: rs.close();
An error occurred at line: 16 in the jsp file: /jsp/test/form.jsp
id cannot be resolved to a variable
13: while(rs.next())
14: {
15: out.println(rs.getInt(name));
16: out.println(rs.getString(id));
17: } } catch(Exception e) {}
18: rs.close();
19: ps.close();
An error occurred at line: 18 in the jsp file: /jsp/test/form.jsp
rs cannot be resolved
15: out.println(rs.getInt(name));
16: out.println(rs.getString(id));
17: } } catch(Exception e) {}
18: rs.close();
19: ps.close();
20: con.close(); %>
An error occurred at line: 19 in the jsp file: /jsp/test/form.jsp
ps cannot be resolved
16: out.println(rs.getString(id));
17: } } catch(Exception e) {}
18: rs.close();
19: ps.close();
20: con.close(); %>
An error occurred at line: 20 in the jsp file: /jsp/test/form.jsp
con cannot be resolved
17: } } catch(Exception e) {}
18: rs.close();
19: ps.close();
20: con.close(); %>
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.35 logs.
View Answers
Related Tutorials/Questions & Answers:
unable to get datas from oracle databaseunable to
get datas from oracle database Dear Sir,
I am again struck in my project..
i want to display data
from oracle database but i
get...("jdbc:
oracle:thin:@//172.25.50.247:1521/knits", "ADMIN", "ADMIN");
ps
Advertisements
How to get data from Oracle database using JSPHow to
get data
from Oracle database using JSP hello i have a simple problem in jsp in the sense to
get data
from the
database like
oracle . I have... in the sense to
get data
from the
database like
oracle . I have created one jsp
Unable to get data from class - Development processUnable to
get data
from class I
get this code
from the internet which read
from comm port of the computer & modify is as below:-
package COM... the getWeight() function
from this ComControl class when i click the Jbutton2
Dropdown code to retrieve result from oracle databaseDropdown code to retrieve result
from oracle database Hi Friends,
I... retrieve the result
from Oracle database.We have procedures created already.Just... that will retrieve values
from the
database into dropdown. As the user choose any option
get information from databaseget information
from database
get information
from database
Please visit the following links:
http://www.roseindia.net/sql/mysql-table/mysql-php-select.shtml
http://www.roseindia.net/sql/mysql-example/select
Select tag to fetch data from oracle databaseSelect tag to fetch data
from oracle database I created a select box...
oracle database.Similarly when address will be selected by the user
from... of a student and when regnno is selected
from the drop down list by a user
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
get values from Excel to databaseget values
from Excel to database hi i want to insert values
from Excel file into database.Whatever field and contents are there in excel file that should go to
database which exists. am using SQL Server management studio
unable to connect database in javaunable to connect
database in java Hello Everyone! i was trying to connect
database with my application by using java but i am
unable to connect... button.
4)Then give Data Source Name and click ok button.
5)Your DSN will
get Sql query from oracleSql query
from oracle Please help me that I want to
get the table names form the existing
database who does it having eid coloumn
plz provide me query in
oracle database unable to connect database in javaunable to connect
database in java Hello Everyone! i was trying to connect
database with my application by using java but i am
unable to connect...
i was using this code....
try
{
Driver d=(Driver)Class.forName
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 .
<
unable to insert data into database unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to insert data into database unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to insert data into database unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
unable to insert data into database unable to insert data into
database hello.i have a problem... the eid based on ename and the other is inserting data into
database based... = Database.getConnection();
ps1=con.prepareStatement("select eid
from employee
Unable to store the image into databaseUnable to store the image into database Hello,
I have created below program and program is throwing FileNotFound exception when I pressed the submit...);
}
Hi,
Please check the thread How to Insert image into
database how to get data from database into dropdownlist in jsphow to
get data
from database into dropdownlist in jsp Can anybody tell me what is the problem in this code as i am not able to fetch the data
from... tutorial go through the link JSP
Get Data Into Dropdown list
From Database
JSP Get Data From DatabaseJSP
Get Data
From Database
In this section we will discuss about how to
get data
from database using
JSP.
To
get data
from database to a JSP page we... giving a simple example which lets you understand to fetch data
from database get data between date from msaccess databaseget data between date
from msaccess database here is my code,
i want to
get data between date using jsp with msaccess.i stored date into
database in string.when i got output it displayed before month data
Spring and Oracle DatabaseSpring and
Oracle Database I need example for Batch update process using
oracle database and spring framework with full explanation
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
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
Need Solution to get vaues from sql database in javaNeed Solution to
get vaues
from sql
database in java hi I have... need to
get values
from sql
database for values in the blank field(" "). how do i... file. please provide me solution to
get values for xml tags
from database 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