Home Answers Viewqa JDBC unable to get datas from oracle database

 
 


raghulan
unable to get datas from oracle database
0 Answer(s)      8 months ago
Posted in : JDBC

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 Pages:
unable to get datas from oracle database
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...("jdbc:oracle:thin:@//172.25.50.247:1521/knits", "ADMIN", "ADMIN"); ps
java script unable to connect to oracle database and insert data
java script unable to connect to oracle database and insert data  ... is to insert data from jsp to oracle database 8, so i create a table in oracle... to run the jsp file from tomcat i get this error.. let me know what i am doing
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data.... If I use it also, unable to connect to backend oracle database. Let me... from oracle sql*plus as rajalakshmi and password by granting privilege from scott
how to get the values to dropdownlist from oracle database
how to get the values to dropdownlist from oracle database   <...("jdbc:oracle:thin:@192.168.149.95:1521:MOBIRAC1","SCOTT","SCOTT"); Statement... * from countryname"); while(rs.next()){ %> <option value="<
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
related retrieving value from oracle database
related retrieving value from oracle database  how we get the value from database in the given textbox
How to get data from Oracle database using JSP
How 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
get data in pop up window droplists and on selecting data in the same show a grid table with related datas
appear in the second drop down lists, this data again comes from the database...get data in pop up window droplists and on selecting data in the same show... down have country names which need to be fetched from data base(let it be country
Sql query from oracle
Sql 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
Struts2...problem in JSP..unable to get the values for menuTitle!!!
Struts2...problem in JSP..unable to get the values for menuTitle!!!  **Hello everyone... i'm trying to make a dynamic menu from database in struts2... Jsp is displaying the menuId from database but not the menuTitle...where as its
Dropdown code to retrieve result from oracle database
Dropdown 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
unable to connect database in java
unable 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
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 get data from class - Development process
Unable 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
How to get the data from the database (Oracle) in console or in ie using servlet or jsp as Front end
How to get the data from the database (Oracle) in console or in ie using... in the sense to get data from the database like oracle . I have created one jsp...","tiger"); ResultSet rs=ps.executeQuery("select from Table1"); if(rs.next
unable to retrive the data from mysql using servlet using jdbc driver
unable to retrive the data from mysql using servlet using jdbc driver ..., HttpServletResponse response) throws ServletException,IOException { // Get... to the database"); stmt = con.createStatement(); rs
store & retrive the image from oracle database
store & retrive the image from oracle database  how can i store the image path in tha database & fetch that image from oracle database
get information from database
get 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
error in uploading image from jsp to oracle 10g database
error in uploading image from jsp to oracle 10g database  ... try to insert into the image into the database i got the above error please advice how to get rid of error   JSP upload image in Mysql database
Oracle Database connectivity probem
Oracle 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
retrieving from oracle database using jsp combo box
retrieving 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 Connection to Oracle database
Java 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
Oracle 9i database problem
Oracle 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
Oracle Database error - JDBC
Oracle Database error   String query11 = "SELECT product_code, product_quantity, price FROM o"+orderid; ResultSet rs11... st=connection.createStatement(); ResultSet rs=st.executeQuery("select * from
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  //this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  //this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
unable to validate username and password from ms acess database
unable to validate username and password from ms acess database  this code is not working! please help me to find error. thanks. <%@ page... * from table1 where userid='"+user+"' and pwd='"+pwd+"'"); int i=0
Oracle - JDBC
Oracle fetch variables  i wanted to fetch variables from database using Oracle
Select tag to fetch data from oracle database
Select 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
jsp-oracle validation - JDBC
database SQL> select * from login; USERID PASSWORD...jsp-oracle validation  Dear friends, my validation not takes place.... Pl. as this code is very urgent and I tried a lot but unable to find out
Oracle Books
, functionality, and reliability of the Oracle database. The nearly 800 pages... Edge: "I enjoyed this book from the beginning 'til the end. The Oracle Edge... and CD-ROM package, exclusively from Oracle Press, covers all the material
Unable to understand Struts - Struts
Unable to understand Struts  I am studying in GNIIT from NIIT. Here... but I did'nt get successfull msg. it doesnat forwads on the success page... = "success"; /** * This is the action called from the Struts
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle.... Another important is that how to delete the Oracle version from the system.so... Panel>>Administrative Tools>>Data Sources in that i selected Oracle
About connection database oracle to java
About 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... be TNS .Another important is that how to delete the Oracle version from
About connection database oracle to java
About 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... be TNS .Another important is that how to delete the Oracle version from the system.so
About connection database oracle to java
About 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... be TNS .Another important is that how to delete the Oracle version from the system.so
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle... .Another important is that how to delete the Oracle version from the system.so... Panel>>Administrative Tools>>Data Sources in that i selected Oracle
Unable to call .jrxml file from jsp
Unable to call .jrxml file from jsp  Hi, I am doing web application... then it unable to access it.Error also not showing. I will show my code and its output... = null; try { database_connection db1=new database_connection
jsp page connectivity with oracle - SQL
jsp 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
How to get the data from the database using Servlet or JSP program
How to get the data from the database using Servlet or JSP program  ... from the database like oracle . I have created one jsp program like this <... the problem   Get data from database using servlet Retrieve data from
get values from Excel to database
get 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
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
Oracle Tutorial
Oracle Tutorial In this section we will discuss about the Oracle Database. This tutorial will describe you about the Oracle Database. This section will describe you the many aspects of Oracle such as, What is Oracle database, Oracle
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... barcode libraries or can i get download online all these libraries?? Please reply me
Loading combo box from oracle
Loading combo box from oracle  how can i load values into a combobox from oracle database when a value is selected in another combo box
unable to connect to server - JSP-Servlet
unable to connect to server  thank you for the program code for inserting and reteriving the image but i am unable to deploy these two programs...-application-server/tomcat/install-configure.shtml Here you will get step by step

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.