Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JDBC unable to get datas from oracle database

Have Programming Question? Ask it here!
 
 
 


raghulan
unable to get datas from oracle database
0 Answer(s)      a year and 10 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.

Advertisement
View Answers

Related Tutorials/Questions & Answers:
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
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="<
Advertisements
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 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
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 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
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
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
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
how to generate reports from oracle database using jsp and ajax code
how to generate reports from oracle database using jsp and ajax code  ... sales report data from oracle database to jsp page please any one know how to do... member Java programmer unable to do this task..so its burden on me to finish
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
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
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
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 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... i was using this code.... try { Driver d=(Driver)Class.forName
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
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database... be inserted into oracle database.. please help me sir...   hi friend..., in these examples MySQL is used as database system if you want to use the Oracle
Unable to store the image into database
Unable 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
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
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
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  //Customer Name: <select name="name"> <% try{ Class.forName...="select * from staff"; ResultSet rs=st.executeQuery(sql); while(rs.next
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 . <
how to get data from database into dropdownlist in jsp
how to get data from database into dropdownlist in jsp  Customer Name:<select name="name"> <% try{ Class.forName...=con.createStatement(); String sql="select * from staff"; ResultSet rs
how to get data from database into dropdownlist in jsp
how 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   
get data between date from msaccess database
get 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
storing csv into oracle database
storing csv into oracle database  i want jsp code for storing csv file into oracle database
File insertion into oracle database
File insertion into oracle database  How to Read and Insert a file (any format) into a Oracle database
JSP Get Data From Database
JSP 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... example which lets you understand to fetch data from database in JSP
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
Spring and Oracle Database
Spring and Oracle Database  I need example for Batch update process using oracle database and spring framework with full explanation
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 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
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
Need Solution to get vaues from sql database in java
Need 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
Want solution to get values for xml namespace tags from database in java
Want solution to get values for xml namespace tags from database in java ...:loc=" "/> now i need to get values from sql database for values in the blank field(" "). how do i get these values.. already connected database and created
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
Retrieving images from the oracle database using jsp and create that rretrieved image as hyperlink
Retrieving images from the oracle database using jsp and create that rretrieved image as hyperlink  I want to insert images into oracle database.I want to retrieve images using jsp and I want to display on the browser.The
How save,get picture from database in my jsp page?
How save,get picture from database in my jsp page?  How i save picture in db after browsing it,and also how i get it on my other jsp page
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
to get picture from ms access database by jsp-servlet....
to get picture from ms access database by jsp-servlet....  I have inserted a picture in ms access data base,,,how we can retrieve that picture by using jsp
 

 

 

DMCA.com