Retrieving data from oracle database and displaying using servlets

//DataRetrieving.class file
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class DataRetrieving extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)throws
ServletException, IOException{ 
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("A program for connecting oracle database");
try
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL", "scott","tiger");
Statement stmt = con.createStatement();
ResultSet r = stmt.executeQuery ("SELECT ename,job,sal,comm,deptno FROM emp");
while ( r.next() )
     String bar = r.getString("ename");
     String bar1 = r.getString("job");
     float bar2 = r.getInt("sal");
     float bar3 = r.getInt("comm");
     int bar4 = r.getInt("deptno");
     //out.println(r.getString(0)+" "+r.getString("ename"));
     out.println("hi");
     out.println(bar1);
r.close();
stmt.close();
con.close();
catch (Exception e)
out.println("ERROR : " + e);
//web.xml file
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"> -->
<web-app>
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>DataRetrieving</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/DataRetrieval</url-pattern>
</servlet-mapping>
</web-app>
while running the servlet , i am unable to retrieve the data
The error message i am getting is
A program for connecting oracle database
ERROR : java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
after running the servlet.
what could be the problem?

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class myserv extends HttpServlet
public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
res.setContentType("text/html");
PrintWriter pw=res.getwriter();
pw.println("Connecting data base");
     try
     Class.forName("oracle.jdbc.driver.OracleDriver");
     Connection con=Drivermanager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","tiger");
     Stamtenet st=con.createStament();
     Resultset rs=con.executeQurey("select * from emp");
     while(rs.next())
     rs.getInt("empno")+" "+rs.getDouble("sal"));
     }catch(Exception e)
}

Similar Messages

  • Retrieve data from SQL database and put into a table

    Hi all, i encountered this error while trying to create a table in 1 of my panels:
    C:\Documents and Settings\L311c01\Desktop\FYPJ Java2\RFIDLogistics.java:25:{color:#ff0000} cannot find symbol
    symbol : class ResultSetTable
    {color}location: class jdbc_bible.part2.RFIDLogistics
    private static ResultSetTable model = new ResultSetTable();
    ^
    C:\Documents and Settings\L311c01\Desktop\FYPJ Java2\RFIDLogistics.java:25: {color:#ff0000}cannot find symbol
    symbol : class ResultSetTable
    {color}location: class jdbc_bible.part2.RFIDLogistics
    private static ResultSetTable model = new ResultSetTable();
    I understand that " cannot find symbol class ResultSetTable means that i need to import something which has this ResultSetTable. I suppose my imports are sufficient and i think the error is with the package that i included.
    This package was taken from an example in a book named java database programming bible, so i assumed it is reliable and i use it for my insert statement, which had a DataInserter.
    Could someone plz help me with this? Thanks alot in advance.
    Here are the codes:
    {color:#ff0000}package jdbc_bible.part2;{color}
    import java.sql.*;
    import javax.swing.*;
    import java.util.Vector;
    import javax.swing.table.AbstractTableModel;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.io.*;
    import java.util.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import javax.swing.border.*;
    import sun.jdbc.odbc.JdbcOdbcDriver;
    public class RFIDLogistics extends JFrame{
    //Components
    // public SimpleClock clock;
    private static JTable jt;
    private static ResultSetTable model = new ResultSetTable();
    some codes
    {color:#ff0000}try
    {{color}
    {color:#ff0000} DataInserter inserter = new DataInserter();
    String SQLCommand = "INSERT INTO " + flstr + " (Item_ID,Location_ID) VALUES ('"+Item_ID1+"','"+Location_ID1+"')";
    String SQLCommand2 = "UPDATE Location SET Item_ID = '"+Item_ID1+"' WHERE Location_ID = '"+Location_ID1+"'";
    inserter.execute(SQLCommand);
    inserter.execute(SQLCommand2);
    {color} JOptionPane.showMessageDialog(null, "Successful!");
    catch(ClassNotFoundException f)
    f.printStackTrace();
    catch(SQLException f)
    f.printStackTrace();
    some codes
    public JPanel rightPanel() {
    JPanel rightPanel = new JPanel();
    rightPanel.setLayout(new BoxLayout(rightPanel, BoxLayout.Y_AXIS));
    //Forklift title Panel
    JPanel panel6 = new JPanel();
    panel6.setBorder(new TitledBorder(""));
    panel6.setPreferredSize(new Dimension(192,33));
    panel6.add(forkliftDetails);
    //Forklift 1 Panel
    {color:#ff0000} JPanel panel7 = new JPanel();
    panel7.setBorder(new TitledBorder("Forklift 1"));
    panel7.setPreferredSize(new Dimension(192,120));{color}
    {color:#ff0000} String query = "SELECT * FROM Forklift1";
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:RFID Logistics");
    PreparedStatement pstmt = con.prepareStatement(query);
    ResultSet rs= pstmt.executeQuery();
    // display the data in jtable
    jt = new JTable();
    model.setResultSet(rs);
    jt.setModel(model);
    catch(ClassNotFoundException sqle){
    System.out.println(sqle);
    }catch(SQLException sqle){
    System.out.println(sqle);
    panel7.add(itemDetail1);
    itemDetail1TextField.setEditable(false);
    panel7.add(itemDetail1TextField);
    panel7.add(locationDetail1);
    locationDetail1TextField.setEditable(false);
    panel7.add(locationDetail1TextField);
    panel7.add(jt);
    {color}..
    //Main Method
    public static void main(String args[]) {
    RFIDLogistics app = new RFIDLogistics();
    app.setFrame();
    app.setResizable(false);
    app.setDefaultCloseOperation(EXIT_ON_CLOSE);
    app.setSize(1024,676);
    app.setLocation(0,60);
    app.setVisible(true);
    If you would like to try if my table can extract, here are the sample codes, just change ur database name which is highlighted in green, and the table name in blue.
    Codes:
    import java.sql.*;
    import javax.swing.*;
    import java.util.Vector;
    import javax.swing.table.AbstractTableModel;
    import java.awt.*;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.io.*;
    import java.util.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import javax.swing.border.*;
    import sun.jdbc.odbc.JdbcOdbcDriver;
    public class sample1{
    private static JFrame frm;
    private static JTable jt;
    private static ResultSetTable model = new ResultSetTable();
    public static void main(String args[]){
    String query = "SELECT * FROM {color:#00ccff}Forklift1{color}";
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:{color:#00ff00}RFID Logistics{color}");
    PreparedStatement pstmt = con.prepareStatement(query);
    ResultSet rs= pstmt.executeQuery();
    // display the data in jtable
    jt = new JTable();
    model.setResultSet(rs);
    jt.setModel(model);
    frm = new JFrame("Sample");
    frm.setSize(400,400);
    frm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frm.add(jt);
    frm.setVisible(true);
    }catch(ClassNotFoundException sqle){
    System.out.println(sqle);
    }catch(SQLException sqle){
    System.out.println(sqle);
    Could someone plz help me with this? Thanks alot in advance.

    public JTable populateTable()
      String[] colNames = new String[] {"ID","NAME","SURNAME"};
      return new JTable(getSQLData(), colNames);
    public Object[][] getSQLData()
      stmt = conn.createStatement();
      ResultSet rs = stmt.executeQuery("SELECT [ID], [NAME], [SURNAME] FROM [USERS]");
      Object[][[] out = new Object[rs.getFetchSize()][3];//Not sure on getFetchSize but it should work
      int i = 0;
      while(rs.next())
        out[0] = rs.getInt(1);
    out[i][1] = rs.getString(2);
    out[i++][2] = rs.getString(3);
    return out;
    The above code will create a JTable with the data retrieved from the DB                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to retrieve records from a database and display it in a jsp page.Help!!

    Hello everyone ! im very new to this forum.Please help me to solve my problem
    First i ll explain what is my requirement or needed.
    Actually in my web page i have text box to enter start date and end date
    and one list box to select the month .If user select or enter the dates in text box
    accordingly the data from ms access database has to display in a jsp page.
    Im using jsp and beans.
    I tried returning ResultSet from bean but i get nothing display in my web page
    instead it goes to error page (ErrorPage.jsp) which i handle in the jsp.
    I tried many things but nothing work out please help me to attain a perfect
    solution. I tried with my bean individually to check whether the result set has
    values but i got NullPointerException . But the values which i passed or
    available in the database.
    I dint get any reply for my last post please reply atleast to this.
    i get the date in the jsp page is by this way
    int Year=Integer.parseInt(request.getParameter("year"));
    int Month=Integer.parseInt(request.getParameter("month"));
    int Day=Integer.parseInt(request.getParameter("day"));
    String startdate=Day+"/"+Month+"/"+Year;
    int Year1=Integer.parseInt(request.getParameter("year1"));
    int Month1=Integer.parseInt(request.getParameter("month1"));
    int Day1=Integer.parseInt(request.getParameter("day1"));
    String enddate=Day1+"/"+Month1+"/"+Year1;But this to check my bean whether it return any result!
    public void databaseConnection(String MTName,String startDate,String endDate)
    try
             java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
            java.sql.Date sqlFromDate=new java.sql.Date(fromDate.getTime());
            java.sql.Date sqlTillDate=new java.sql.Date(tillDate.getTime());
              String query1="select MTName,Date,MTLineCount from Main where MTName='"+MTName+"'  and Date between '"+sqlFromDate+"' and '"+sqlTillDate+"' " ;
            System.out.println(query1);
              Class.forName(driver);
             DriverManager.getConnection(url);
             preparedStatement=connection.prepareStatement(query1);
             preparedStatement.setString(1,"MTName");
              preparedStatement.setDate(2,sqlFromDate);
              preparedStatement.setDate(3,sqlTillDate);
              resultSet=preparedStatement.executeQuery();           
               while(resultSet.next())
                        System.out.println(resultSet.getString(1));
                        System.out.println(resultSet.getDate(2));
                        System.out.println(resultSet.getInt(3));
            catch (Exception e)
             e.printStackTrace();
    I Passed value from my main method is like thisl
    databaseConnection("prasu","1/12/2005","31/12/2005");Please provide solutions or provide some sample codes!
    Help!
    Thanks in advance for replies

    Thanks for ur reply Mr.Rajasekhar
    I tried as u said,
    i tried without converting to sql date ,but still i din't get any results
    java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
              String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"'  and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
            System.out.println(query1);
    //From main method
    databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
    ---------- java ----------
    select MTName,Date,MTLineCount from linecountdetails where mtname='prasu'  and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
    java.lang.NullPointerException
    null
    null
    java.lang.NullPointerException
    Output completed (4 sec consumed) - Normal TerminationThanks
    Prasanna.B

  • Extract data from Oracle Database and store it into a CSV file format

    Hello.
    I'm trying to export a table from an Oracle Database into CSV file format with any Oracle adaptor and store it into a HDFS system.
    How could I do it?
    Thanks in advance!

    Xavi wrote:
    HI Charles. Could I use.. Oracle Data Integrator Application Adapter for Hadoop? For this purpose?
    Thanks in advancePerhaps. I have to confess that I am not familiar enough with ODI to know if that is within its capabilities.
    You might see if there is a forum for ODI and post your question to that.
    Charles Lamb

  • Help in retrieveing Blob from Oracle db and display it on a web page

    I am using Sun Studio creator2 and this is what I want to achieve:
    When I click on "Load" button, the image is displayed on the web page(the application is a web application)
    I have dropped the "image" object from the pallette
    Having the database image displayed in the image field, when I enter the image ?Id? and click on the ?Load? button.
    Here is my piece of code:
    public String loadButton_action() {
    HttpServletRequest request = null;
    HttpServletResponse response = null;
    String connectionURL = "jdbc:oracle:thin:@//localhost:1521/cdecentre1";;
    /*declare a resultSet that works as a table resulted by execute a specified
    sql query. */
    ResultSet rs = null;
    // Declare statement.
    PreparedStatement psmnt = null;
    // declare InputStream object to store binary stream of given image.
    InputStream sImage;
    Connection connection = null;
    String driverName = "oracle.jdbc.driver.OracleDriver";
    String dbName = "cdecentre1";
    String userName = "christian";
    String password = "cc";
    String theid = (String)idField.getValue(); //reading the image id
    try{
    Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    connection = DriverManager.getConnection(connectionURL, userName, password);
    /* prepareStatement() is used for create statement object that is
    used for sending sql statements to the specified database. */
    psmnt = connection.prepareStatement("SELECT image FROM CHRISTIAN.PICTURES WHERE id = ?");
    psmnt.setString(1, theid);
    rs = psmnt.executeQuery();
    if(rs.next()) {
    byte[] bytearray = new byte[1048576];
    int size=0;
    sImage = rs.getBinaryStream(1);
    //response.reset();
    response.setContentType("image/jpeg");
    while((size=sImage.read(bytearray))!= -1 ){
    response.getOutputStream().write(bytearray,0,size);
    rs.close();
    psmnt.close();
    connection.close(); } }
    } catch(Exception ex){
    System.out.println("error :"+ex);
    return null; }
    At the moment, when I click on the ?Load? button, the image is not present in the image field.
    I am only obtaining a message inside the message component.
    What should I do to have the image displayed in on the web page?
    Your help will be highly appreciated.

    A comprehensive dissertation from Javaworld: http://www.javaworld.com/javaworld/jw-05-2000/jw-0505-servlets.html
    Published 05/05/2000, ergo Java 1.0/1 era... still a valid explanation of the problem and the fundamental solution, but take the code (esp ImageIO) from here
    http://blog.codebeach.com/2008/02/creating-images-in-java-servlet.html
       1. package com.codebeach.servlet; 
       2.  
       3. import java.io.*; 
       4. import javax.servlet.*; 
       5. import javax.servlet.http.*; 
       6. import java.awt.*; 
       7. import java.awt.image.*; 
       8. import javax.imageio.*; 
       9.  
      10. public class ImageServlet extends HttpServlet 
      11. { 
      12.     public void doGet(HttpServletRequest req, HttpServletResponse res) 
      13.     { 
      14.         //Set the mime type of the image 
      15.         res.setContentType("image/jpeg"); 
      16.  
      17.         try 
      18.         { 
      19.             Create an image 200 x 200 
      20.             BufferedImage bufferedImage = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); 
      21.  
      22.             //Draw an oval 
      23.             Graphics g = bufferedImage.getGraphics(); 
      24.             g.setColor(Color.blue); 
      25.             g.fillOval(0, 0, 199,199); 
      26.  
      27.             Free graphic resources 
      28.             g.dispose(); 
      29.  
      30.             //Write the image as a jpg 
      31.             ImageIO.write(bufferedImage, "jpg", res.getOutputStream()); 
                        ////////////// NICE !!!! //////////////
      32.         } 
      33.         catch (IOException ioe) 
      34.         { 
      35.            e.printStackTrace();
      36.         } 
      37.     } 
      38. }  Edited by: corlettk on 19/01/2009 23:22 ~~ {color:#FF0000}Never{color} eat an exception!

  • How to fetch the image file from oracle database and display it.

    hi... i've inserted the image file into the oracle database... now i want to retreive it and want to display it... can anybody help me... pls

    not a big deal dude... i fetched the image from database and saved it into my local hard disk.. but when tried to open it,ends up with no preview... dont know what d prob is... any idea... i've inserted the image as bytes n trying to fetch it as binary stream.. is that the problem... here im giving my insertion and retireving code.. jus go through it...
    Insertion code:_
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package PMS;
    import java.io.File;
    import java.io.FileInputStream;
    import java.sql.Blob;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    public class Browse_java
    static Connection con=null;
    public static void main(String args[])
    try{
    System.out.println("(browse.java) just entered in to the class");
    con = new PMS.DbConnection().getConnection();
    System.out.println("(browse.java) connection string is"+con);
    PreparedStatement ps = con.prepareStatement("INSERT INTO img_exp VALUES(?,?)");
    System.out.println("(browse.java) prepare statement object is"+ps);
    File file =new File("E:/vanabojanalu-/DSC02095.JPG");
    FileInputStream fs = new FileInputStream(file);
    System.out.println("lenth of file"+file.length());
    byte blob[]=new byte[(byte)file.length()];
    System.out.println("lenth of file"+blob.length);
    fs.read(blob);
    ps.setString(1,"E:/vanabojanalu-/DSC02095.JPG");
    ps.setBytes(2, blob);
    // ps.setBinaryStream(2, fs,(int)file.length());
    System.out.println("(browse.java)length of picture is"+fs.available());
    int i = ps.executeUpdate();
    System.out.println("image inserted successfully"+i);
    catch(Exception e)
    e.printStackTrace();
    finally
    try {
    con.close();
    } catch (SQLException ex) {
    ex.printStackTrace();
    and Retrieving code is:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package PMS;
    import java.beans.Statement;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jdbc.OracleResultSet;
    * @author Administrator
    public class view_image2 extends HttpServlet {
    * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
    * @param request servlet request
    * @param response servlet response
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("image/jpeg");
    //PrintWriter out = response.getWriter();
    try
    javax.servlet.http.HttpServletResponse res=null;;
    int returnValue = 0;
    Connection con = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    InputStream in = null;
    OutputStream os = null;
    Blob blob = null;
    //String text;
    //text=request.getParameter("text");
    //Class.forName("com.mysql.jdbc.Driver");
    con=new PMS.DbConnection().getConnection();
    System.out.println("jus entered the class");
    //String query = "SELECT B_IMAGE FROM img_exp where VC_IMG_PATH=?";
    //conn.setAutoCommit(false);
    PreparedStatement pst = con.prepareStatement("select b_image from img_exp where vc_img_path=?");
    System.out.println("before executing the query");
    pst.setString(1,"C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
    rs = pst.executeQuery();
    //System.out.println("status of result set is"+rs.next());
    System.out.println("finished writing the query");
    int i=1;
    if(rs.next())
    System.out.println("in rs") ;
    byte[] byte_image=rs.getBytes(1);
    // byte blob_byte[]= new byte[(byte)blob.length()];
    //System.out.println("length of byte is"+blob_byte);
    //String len1 = (Oracle.sql.blob)rs.getString(1);
    //System.out.println("value of string is"+len1);
    //int len = len1.length();
    //byte [] b = new byte[len];
    //in = rs.getBinaryStream(1);
    int index = in.read(byte_image, 0, byte_image.length);
    System.out.println("value of in and index are"+in+" "+index);
    FileOutputStream outImej = new FileOutputStream("C://"+i+".JPG");
    //FileOutputStream fos = new FileOutputStream (imgFileName);
    BufferedOutputStream bos = new BufferedOutputStream (outImej);
    //byte [] byte_array = new byte [blob_byte.length]; //assuming 512k size; you can vary
    //this size depending upon avlBytes
    //int bytes_read = in.read(blob_byte);
    bos.write(index);
    /*while (index != -1)
    outImej.write(blob_byte, 0, index);
    index = in.read(blob_byte, 0, blob_byte.length);
    //System.out.println("==========================");
    //System.out.println(index);
    //System.out.println(outImej);
    //System.out.println("==========================");
    /*ServletOutputStream sout = response.getOutputStream(outImej);
              for(int n = 0; n < blob_byte.length; n++) {
                   sout.write(blob_byte[n]);
              sout.flush();
              sout.close();*/
    outImej.close();
    //i++;
    else
    returnValue = 1;
    catch(Exception e)
    System.out.println("SQLEXCEPTION : " +e);
    finally {
    //out.close();
    // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
    * Handles the HTTP <code>GET</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    * Handles the HTTP <code>POST</code> method.
    * @param request servlet request
    * @param response servlet response
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    * Returns a short description of the servlet.
    public String getServletInfo() {
    return "Short description";
    // </editor-fold>
    }

  • How to extract image from oracle database and display at html page

    Could you help me how to make the image to display. i manage to extract the data but the data is in Blob so i need to convert it so make it display at html page.

    Thanks for ur reply Mr.Rajasekhar
    I tried as u said,
    i tried without converting to sql date ,but still i din't get any results
    java.text.SimpleDateFormat dateFormat=new java.text.SimpleDateFormat("dd/MM/yyyy");
             java.util.Date fromDate=dateFormat.parse(startDate);
            java.util.Date tillDate=dateFormat.parse(endDate);          
              String query1="select MTName,Date,MTLineCount from linecountdetails where mtname='"+MTName+"'  and Date >='"+fromDate+"' and Date <='"+tillDate+"' " ;
            System.out.println(query1);
    //From main method
    databaseConnection("prasu","1/12/2005","31/12/2005");I got the output as
    ---------- java ----------
    select MTName,Date,MTLineCount from linecountdetails where mtname='prasu'  and Date >='Thu Dec 01 00:00:00 GMT+05:30 2005' and Date <='Sat Dec 31 00:00:00 GMT+05:30 2005'
    java.lang.NullPointerException
    null
    null
    java.lang.NullPointerException
    Output completed (4 sec consumed) - Normal TerminationThanks
    Prasanna.B

  • Performance Issue: Retrieving records from Oracle Database

    While retrieving data from Oracle database we are facing performance issues.
    The query is returning 890 records and while displaying it on the jsp page, the page is taking almost 18 minutes for displaying records.
    I have observed that cpu usage is 100% while processing the request.
    Could any one advise what are the methods at DB end or Java end we can think of to avoid such issues.
    Thanks
    R.

    passion_for_java wrote:
    Will it make any difference if I select columns instead of ls.*
    possibly, especially if there's a lot or data being returned.
    Less data over the wire means a faster response,
    You may also want to look at your database, is that outer join really needed? Does it perform? Are your indexes good?
    A bad index (or a missing one) can kill query performance (we've seen performance of queries drop from seconds to hours when indexes got corrupted).
    A missing index can cause full table scans, which of course kill performance if the table is large.

  • SOS!!!!----Error for Loading data from Oracle 11g to Essbase using ODI

    Hi all.
    I want to load data from oracle database to essbase using ODI.
    I configure successfully the physical and logical Hyperion essbase on Topology Manager, and got the ESSBASE structure of BASIC app DEMO.
    The problem is.
    1. When I try view data right click on the essbase table,
    va.sql.SQLException: Driver must be specified
         at com.sunopsis.sql.SnpsConnection.a(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java)
         at com.sunopsis.sql.SnpsConnection.testConnection(SnpsConnection.java)
         at com.sunopsis.graphical.frame.b.jc.bE(jc.java)
         at com.sunopsis.graphical.frame.bo.bA(bo.java)
         at com.sunopsis.graphical.frame.b.ja.dl(ja.java)
         at com.sunopsis.graphical.frame.b.ja.<init>(ja.java)
         at com.sunopsis.graphical.frame.b.jc.<init>(jc.java)
    I got answer from Oracle Supporter It's ok, just omit it. Then the second problem appear.
    2. I create an interface between oracle database and essbase, click the option "staging area deffirent from target"(meaning the staging is created at oracle database), and using IKM SQL to Hyperion Essbase(metadata), execute this interface
    org.apache.bsf.BSFException: exception from Jython:
    Traceback (innermost last):
    File "<string>", line 61, in ?
    com.hyperion.odi.essbase.ODIEssbaseException: Invalid value specified [RULES_FILE] for Load option [null]
         at com.hyperion.odi.essbase.ODIEssbaseMetaWriter.validateLoadOptions(Unknown Source)
         at com.hyperion.odi.essbase.AbstractEssbaseWriter.beginLoad(Unknown Source)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java)
         at org.python.core.PyMethod.__call__(PyMethod.java)
         at org.python.core.PyObject.__call__(PyObject.java)
         at org.python.core.PyInstance.invoke(PyInstance.java)
         at org.python.pycode._pyx1.f$0(<string>:61)
         at org.python.pycode._pyx1.call_function(<string>)
         at org.python.core.PyTableCode.call(PyTableCode.java)
         at org.python.core.PyCode.call(PyCode.java)
         at org.python.core.Py.runCode(Py.java)
         at org.python.core.Py.exec(Py.java)
    I'm very confused by it. Anybody give me a solution or related docs.
    Ethan.

    Hi ethan.....
    U always need a driver to be present inside ur <ODI installation directory>\drivers folder.....for both the target and the source......Because ojdbc14.jar is the driver for oracle already present inside the drivers folder ....we don't have to do anything for it.....But for Essbase ...you need a driver......If u haven't already done this.....try this.....
    Hope it helps...
    Regards
    Susane

  • Walkthrough: Displaying Data from Oracle database in a Windows application.

    This article is intended to illustrate one of the most common business scenarios such as displaying data from Oracle database on a form in a Windows application using DataSet objects and .NET Framework Data Provider for Oracle.
    You can read more at http://www.c-sharpcorner.com/UploadFile/john_charles/WalkthroughDisplayingDataOracleWindowsapplication05242007142059PM/WalkthroughDisplayingDataOracleWindowsapplication.aspx
    Enjoy my article.

    hi,
    this is the code :
    public class TableBean {
    Connection con ;
    Statement ps;
    ResultSet rs;
    private List perInfoAll = new ArrayList();
    public List getperInfoAll() {
    int i = 0;
    try
    con = DriverManager.getConnection("url","root","root");
    ps = con.createStatement();
    rs = ps.executeQuery("select * from user");
    while(rs.next()){
    System.out.println(rs.getString(1));
    perInfoAll.add(i,new perInfo(rs.getString(1),rs.getString(2),rs.getString(3)));
    i++;
    catch (Exception e)
    System.out.println("Error Data : " + e.getMessage());
    return perInfoAll;
    public class perInfo {
    String uname;
    String firstName;
    String lastName;
    public perInfo(String firstName,String lastName,String uname) {
    this.uname = uname;
    this.firstName = firstName;
    this.lastName = lastName;
    public String getUname() {
    return uname;
    public String getFirstName() {
    return firstName;
    public String getLastName() {
    return lastName;
    ADF table code:
    <af:table value="#{tableBean.perInfoAll}" var="row"
    binding="#{backing_Display.table1}" id="table1">
    <af:column sortable="false" headerText=""
    align="start">
    <af:outputText value="#{row.firstName"/>//---> Jdeveloper 11g doesn't allow me to use this.. it says firstName is an unknown property..
    </af:column>
    </af:table>
    Please tell me is this the way to do it.. or is it a must to use the DataCollection from the data controls panel...
    Thanks...

  • Failed to retrieve data from the database using Crystal Reports XI R2

    I am using Crystal reports XI R2 and using the Universal Web Connector (connecting to Coghead).  When I put some some of the fields from the database and run Preview I get "Failed to retrieve data from the database." .   Where is this message coming from and how can I track down what the issue is?

    Hi Jamie,
    When you are trying to Browse Data of a field it is not poping up any window menas, it is unable to interact with database and get the data from database.
    Try to create a new report using ODBC with Xtreem Sample Database.  If you get the data in your report without any error then your connector is not working / unable to pull the data into your report.
    You can find the supported platforms document in below link
    http://support.businessobjects.com/documentation/supported_platforms/xi_release2/default.asp
    Thanks,
    Sastry

  • Retrieve data from BAPI, FM and Insert in WAS Database

    Hello All.
    I need to retrieve data from SAP in WedDynpro project using BAPI, FM and create tables in WAS Database to Insert.
    I have created the front ends in WedDynpro project to acces data using BAPI and FM. Its works fine.
    How to create these table in WebDynpro project to insert the data come from SAP (BAPI - FM) ?
    I created the tables in dictionary.
    --> Create a new project --> project type Dictionary Project --> Create Tables.
    How can insert the data from the BAPI in tables created in dictionary?
    Best Regards.
    Taylor

    Hi Taylor,
    I think you have opened two threads for the same question. Please, close this thread.
    Regards,
    Gopal.

  • Want to see on screen data from oracle database using php

    I am struggling on the problem of echoing data from Oracle database (9i) to the screen for viewing. For ex. the data has records from various cities. when a particular city is inputted as prompt, all the records for the that city from the table should appear through PHP. Can someone help me?

    Thank you very much for giving the link. I tried and it is working. Only, I am still struggling with trying to get many fields from the database on the screen for viewing. Ex. a prompt to ask which country and which month. If I give India and December it must give all the data pertaining to India for December. This AJAX was very useful, as it gave lot of tips, but my basic query to see the data thru PHP from my database is still unsolved. Any help??
    Jacob
    Thanks once again for the help.

  • How to retrieve data from catsdb table and convert into xml using BAPI

    How to retrieve data from catsdb table and convert into xml using BAPI
    Points will be rewarded,
    Thank you,
    Regards,
    Jagrut BharatKumar Shukla

    Hi,
    This is not your requirment but u can try this :
    CREATE OR REPLACE DIRECTORY text_file AS 'D:\TEXT_FILE\';
    GRANT READ ON DIRECTORY text_file TO fah;
    GRANT WRITE ON DIRECTORY text_file TO fah;
    DROP TABLE load_a;
    CREATE TABLE load_a
    (a1 varchar2(20),
    a2 varchar2(200))
    ORGANIZATION EXTERNAL
    (TYPE ORACLE_LOADER
    DEFAULT DIRECTORY text_file
    ACCESS PARAMETERS
    (FIELDS TERMINATED BY ','
    LOCATION ('data.txt')
    select * from load_a;
    CREATE TABLE A AS select * from load_a;
    SELECT * FROM A
    Regards
    Faheem Latif

  • FETCH DATA FROM ORACLE DATABASE USING Web Dynpro

    I want to fetch data from ORACLE database using Web Dynpro.How can I do this?

    1) Are you sure that you get no results? It sounds like you are having name resolution issues, which would imply that you should be getting an ORA-00942 error indicating that the table doesn't exist (or that you don't have access to the table). If you are not seeing this error, I would tend to suspect an overzealous exception handler.
    2) What database account owns the table? What database account is your ASP.Net application using to connect? Assuming these two accounts are different, your application would either have to
    - Explicitly prefix the table name with the schema name
    - Have a public or private synonym that maps the table name to the fully qualified identifier schema_name.table_name
    - Issue the command ALTER SESSION SET CURRENT_SCHEMA = <<schema name>> in each session, in which case all queries in the session would use the specified schema name as the default if no schema name is prefixed.
    Justin

Maybe you are looking for

  • Crash in "Export" from SQL Developer  Version 2.1.1.64

    Hi, Did a quick search and didn't find anything on this forum about this problem: any help appreciated and thus Thanks in advance. I was using a slightly older version of Developer to dump out a file (via Tools->Database Export) when the blooming thi

  • How to achieve an SMS is sent instead of e-mail

    How to achieve an SMS is sent instead of e-mail. I know how to send mail and how to configure it in scot. But  we would like to alert people via SMS. How to achieve that? Thank you in advance

  • Input help in Adobe Flex

    Last days I have been following some video tutorials on flex and web dynpro, but I can 't seem to find anything on input help. Is there a way to implement input help in Flex? I want the user to still be able to search the values like in a default sea

  • Oracle Database12c R1 installation.

    Stops at 87%, in Oracle Database Configuration Assistant, log: INFO: Found associated job INFO: Starting 'Oracle Database Configuration Assistant' INFO: Starting 'Oracle Database Configuration Assistant' INFO: Executing DBCA INFO: Command C:\Windows\

  • Clear FEHLER table in cluster B2

    Hello experts, My client asked me to clear all the old messages before January 2009 in table FEHLER. Have you any suggestion how to do it without changing pcr's in the schema. Thanks, Meir.