Passing a resultset

Hello,
I'm trying to build an application that returns a record set for evaluation.
I'm want to have a class file do the connection and then return the record set to my main program. How do I go about returning a resultset?

just do it.
public ResultSet myMethod() {
  ResultSet rs = ...
  return rs;
}

Similar Messages

  • Problem Generating a Report by passing a Resultset as a datasource

    I am having troubles generating a report using CR for Eclipse 2.0.
    I used the example that shows how do a simple select SQL query to the database and pass the resultset from the query to the report to generate a report from here: https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/201084dc-be66-2b10-64bf-dde4970c9b90
    I used a simple rpt file that simply shows the content of two columns from a table: TXN_TYPE_CD and TXN_STATUS_CD from a POLICY_TXN table.
    Using the code above, and just modifying it a bit to include my jdbc connection details as well as my select query, I was able to view the report which populated data from my database (Oracle 10g) at runtime of the application.  This test proved positive.
    However, the problem I am having is that I am trying to make this code into a Servlet for use in a Java EE application running on Websphere 6.1.0.17 using JVM 1.5.0_15  64-bit.  Instead of using the DHTML thick client, I export to PDF.  When I do this, the crystal report shows as a PDF, but the data is missing for some reason.  Only the headers for the two db columns are shown.  I don't see any startling differences between the code and am 100% positive that my resultset is being returned with data (I output the data returned in the result set as shown in the code).
    Here is the code I am using:
    public class CrystalReportGeneratorServlet_WOW extends Servlet {
         private static final long serialVersionUID = 768970549082466125L;
         protected HttpSession session;
         private final String EXPORT_FILE = "myExportedReport.pdf";
         private final String CUSTOM_PATH = "/custom/resource/crystalReport/";
         private String REPORT_NAME;
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws IOException, ServletException {
              Properties loParms = new Properties();
              ResultSet resultSet = null;
              //Obtain current JDBC Connection
              Connection loConn = AppEnvironment.getJDBCConnection();
              Statement statement = null;
              try {
                   REPORT_NAME = "Test.rpt";
                   //Open report
                   ReportClientDocument reportClientDoc = new ReportClientDocument();
                   reportClientDoc.open(SystemConfig.getAppHome() + CUSTOM_PATH + REPORT_NAME, 0);
                   //Create SQL query.    
                   String query = "SELECT \"POLICY_TXN\".\"TXN_TYPE_CD\", \"POLICY_TXN\".\"TXN_STATUS_CD\"" + "FROM   \"POLICY_TXN\"";
                   //Query database and obtain the Resultset that will be pushed into the report.  
                   statement = loConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   //Execute query and return result set.
                   resultSet = statement.executeQuery(query);
                   //Look up existing table in the report to set the datasource for and obtain its alias.  This table must
                   //have the same schema as the Resultset that is being pushed in at runtime.  The table could be created
                   //from a Field Definition File, a Command Object, or regular database table.  As long the Resultset
                   //schema has the same field names and types, then the Resultset can be used as the datasource for the table.
                   String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
                   /////TESTING: OUTPUT contents of resultSet
                   while (resultSet.next()) {
                        System.out.println("TXN_STATUS_CD = " + resultSet.getString("TXN_STATUS_CD"));
                        System.out.println("TXN_TYPE_CD = " + resultSet.getString("TXN_TYPE_CD"));
                   //Push the Java ResultSet into the report.  This will then be the datasource of the report.
                   DatabaseController dbc = reportClientDoc.getDatabaseController();
                   dbc.setDataSource(resultSet, tableAlias , "resultsetTable");
                   //Export to PDF
                   ExportToPDF(reportClientDoc, response);
              catch(ReportSDKException ex) {     
                   System.out.println(ex);
              catch(Exception ex) {
                   System.out.println(ex);               
              } finally {
                   try {
                        resultSet.close();
                   } catch (SQLException e) {
                             e.printStackTrace();
                        } finally {
                             AppEnvironment.returnStatement(statement);
                             AppEnvironment.returnConnection ( loConn ) ;
         private void ExportToPDF(ReportClientDocument rcd, HttpServletResponse response)
              try {
                   ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)rcd.getPrintOutputController().export(ReportExportFormat.PDF);
                   rcd.close();
                   writeToBrowser(byteArrayInputStream, response, "application/pdf", EXPORT_FILE);
              catch(ReportSDKException ex) {
                   System.out.println(ex);
              catch(Exception ex) {
                   System.out.println(ex);
         * Utility method that demonstrates how to write an input stream to the server's local file system.
         private void writeToBrowser(ByteArrayInputStream byteArrayInputStream, HttpServletResponse response, String mimetype, String exportFile) throws Exception {
              //Create a byte[] the same size as the exported ByteArrayInputStream.
              byte[] buffer = new byte[byteArrayInputStream.available()];
              int bytesRead = 0;
              try{
                   //Set response headers to indicate mime type and inline file.
                   response.setHeader("Content-disposition", "inline;filename=" + exportFile);
                   response.setContentType(mimetype);
                   //Stream the byte array to the client.
                   while((bytesRead = byteArrayInputStream.read(buffer)) != -1) {
                   response.getOutputStream().write(buffer, 0, bytesRead);
                   //Flush and close the output stream.
                   response.getOutputStream().flush();
                   response.getOutputStream().close();
              } catch (Exception e){
                        e.printStackTrace();
         public static Servlet getInstance()
            return new CrystalReportGeneratorServlet_WOW();
    Any help would greatly be appreciated.

    Actually Uzair I came across this thread in trying to find a resolution to my problem.  I was wondering if you were able to resolve this issue as it appears as though I may have the same problem.
    Thanks.

  • Passing a resultset to a method

    Hi all,
    I want to pass a resultset object that is scrollable and updateable to a method. THe problem is that, the resultset object in the other method is not scrollable or updateable anymore.
    Eg.
    Statement stat = null;
    ResultSet rs = null;
    stat = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATEABLE);
    rs = executeQuery("SELECT * from table");
    rs.absolute(5); // when i use this, it works fine here, but it won't if i pass rs to another method
    method2(rs);
    // end of this method
    method2(ResultSet rs) {
    absolute(5); //this is where i am told that ResultSet is readonly and not updateable
    OFFCOURSE, ignore the syntax errors and stuff. I would greatly appreciate your help. I really need to figure this out otherwise i would have to rewirte a huge part of my code. Thank you very much

    warnerja is only partially right, it is true that database driver sometimes doesn't support updateable resultset, but my problem was solved by following this link
    http://www.oracle.com/forums/message.jsp?id=396810&pgm=otn&uid=1024413365365 (you have to register with oracle for that)
    for anybody who can't access the above page, the solution is
    instead of doing (SELECT * from abc), do (SELECT abc.* from abc)
    that should solve your problem if its the same as mine.
    HOWEVER, if i have multiple tables and if i do the following as above
    SELECT abc.*, zzz.channel, zzz.channel2, xyz.field1
    FROM abc, zzz, xyz
    the resultset remains readonly, i dont' know why
    ANY IDEAS???????

  • Passing of ResultSet to Stored Procedure(Oracle 8i)  from Java

    My requirement is such that I want to send a resultset to a stored procedure(In oracle8i). Through Java API's.
    The input parameter to the PLSQL is a ref cursor.
    I am trying to send the resultSet using CallableStatement of java but it is throwing an Inavlid column type error.
    So firstly is it possible to send a resultset to Oracle through java. If yes, then please suggest me as to how it can be done?

    Rajeev,
    I remember seeing something on Oracle's MetaLink Web site, saying that this is not supported. Sorry, but I can't give you any more details -- I don't remember (and I'm too lazy to look :-)
    I also think that I found that MetaLink article via a posting to one of these (i.e. Oracle) forums. Perhaps a search of the forum archives will help?
    Good Luck,
    Avi.

  • Passing ResultSet from one function to another

    Hi friends,
    Greetings.
    I am a beginner in Java.
    I am doing an exercise using jdbc:odbc driver where i have to query the database in one function and pass the ResultSet to another function.
    Let function1 be
    ResultSet select(String sel) // sel is the id of what is to be selected { Resultset rs= //coding return rs; }
    Let function2 be
    function2 { String id="abc"; ResultSet rs1=select(id); //code to print rs1 }
    Is my code correct? i get a NullPointerException always.
    Please help
    Regards.

    rampalli_aravind wrote:
    Thanks a ton for the reply!
    Well,
    how do i pass the query Results?
    Actually i have a database in the server and i am the client.
    Client sends the id to the server. Server processes. finds the id and returns the name and other details using SQL statement:
    select * from table1 where id="abc";Server should return these details back to the client.
    IF no such id exists then server should send the client the following result:
    //print that the given id does not exist and these are the ids and names in table1
    select * from table1;How can i do it using jdbc odbc driver?
    Thank you in anticipation to your reply!
    Regardssee my reply to your other post.
    write a server side component that opens the connection to the database, loads the ResultSet into a data structure, closes the ResultSet, and returns the data structure to the client.
    the client should not be dealing directly with the database.
    %

  • Passing Resultsets to JSP

    Hello,
    I want to know how to represent the results of a databse search via a JSP. Initially, I had all of the databse code(example shown below) in the JSP just to get it working. I now want to move the code into a JavaBean (I know there are numerous other ways but as I am still learning I just want to use a Worker Bean). Whilst the code was in the JSP it was easy to display the data using rs.next() etc etc, but now the code is in the bean how do I pass a resultset back to the JSP. Do I use getProperty some how?
    Any help is appreciated
    Cheers
    Mitch
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection dbaCon = DriverManager.getConnection
    ("jdbc:odbc:MileEnd", "", "");
    String template = "UPDATE PlayerInfo SET Block = ? WHERE LastName = ? and FirstName = ? and password = ?";
    PreparedStatement pstmt = dbaCon.prepareStatement(template);
    pstmt.setBoolean(1, state);
    pstmt.setString(2, lastName);
    pstmt.setString(3, firstName);
    pstmt.setString(4, password);
    pstmt.executeUpdate();
    if (pstmt != null)
    pstmt.close();
    if (dbaCon != null)
    dbaCon.close();
    %>

    Your example will not generate any ResultSet, it gives you an int value saying that, how many rows have been updated.
    int rowsUpdated=pstmt.executeUpdate();
    return rowsUpdated;
    Suppose if you have a query like 'select a,b,c from table_name where some_condition', then you will get a ResultSet. Instead of returning the ResultSet as it is to the jsp, it is better to put them in an array or Vector or some collection object and return that object. So that you can immediately close the resultset and release the db resources.
    ResultSet rs=st.executeQuery();
    Vector v = new Vector();
    while(rs.next())
    String str[]=new String[3];
    str[0]=rs.getString("a"); //or str[0]=rs.getString(1);
    str[1]=rs.getString("b");
    str[2]=rs.getString("c");
    v.add(str);
    // close all the database resources and then return the vector.
    return v;
    In your jsp, you can get this vector and display the results.
    for(int i=0;i<v.size();i++)
    String str[]=(String[])v.elementAt(i);
    // display str[0],str[1] and str[2]
    Hope this helps.
    Sudha

  • Problems passing Resultset to SubReport

    Hello Everybody,
    I have a very simple Problem but I can not fix it. I have a Report which contains a Subreport. The Subreport is nearly the same like the Mainreport, I´m also passing Parameters to the Subreport. This works fine.
    But if I try to pass a ResultSet, the ReportViewer ask for Username an Password of the Database. The Subreport contains further all Datasets of the Database and not the custombuild in the Mainapplication.
    Does anybody know why this happend?
    Thanks a lot.
    Markus

    Please define "Fails". Error? Behavior? Symptom?
    - Ludek

  • Need help Take out the null values from the ResultSet and Create a XML file

    hi,
    I wrote something which connects to Database and gets the ResultSet. From that ResultSet I am creating
    a XML file. IN my program these are the main two classes Frame1 and ResultSetToXML. ResultSetToXML which
    takes ResultSet & Boolean value in its constructor. I am passing the ResultSet and Boolean value
    from Frame1 class. I am passing the boolean value to get the null values from the ResultSet and then add those
    null values to XML File. When i run the program it works alright and adds the null and not null values to
    the file. But when i pass the boolean value to take out the null values it would not take it out and adds
    the null and not null values.
    Please look at the code i am posing. I am showing step by step where its not adding the null values.
    Any help is always appreciated.
    Thanks in advance.
    ============================================================================
    Frame1 Class
    ============
    public class Frame1 extends JFrame{
    private JPanel contentPane;
    private XQuery xQuery1 = new XQuery();
    private XYLayout xYLayout1 = new XYLayout();
    public Document doc;
    private JButton jButton2 = new JButton();
    private Connection con;
    private Statement stmt;
    private ResultSetToXML rstx;
    //Construct the frame
    public Frame1() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
    jbInit();
    catch(Exception e) {
    e.printStackTrace();
    //Component initialization
    private void jbInit() throws Exception {
    //setIconImage(Toolkit.getDefaultToolkit().createImage(Frame1.class.getResource("[Your Icon]")));
    contentPane = (JPanel) this.getContentPane();
    xQuery1.setSql("");
    xQuery1.setUrl("jdbc:odbc:SCANODBC");
    xQuery1.setUserName("SYSDBA");
    xQuery1.setPassword("masterkey");
    xQuery1.setDriver("sun.jdbc.odbc.JdbcOdbcDriver");
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(400, 300));
    this.setTitle("Frame Title");
    xQuery1.setSql("Select * from Pinfo where pid=2 or pid=4");
    jButton2.setText("Get XML from DB");
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(java.lang.ClassNotFoundException ex) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(ex.getMessage());
    try {
    con = DriverManager.getConnection("jdbc:odbc:SCANODBC","SYSDBA", "masterkey");
    stmt = con.createStatement();
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    jButton2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(ActionEvent e) {
    jButton2_actionPerformed(e);
    contentPane.add(jButton2, new XYConstraints(126, 113, -1, -1));
    //Overridden so we can exit when window is closed
    protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
    System.exit(0);
    void jButton2_actionPerformed(ActionEvent e) {
    try{
    OutputStream out;
    XMLOutputter outputter;
    Element root;
    org.jdom.Document doc;
    root = new Element("PINFO");
    String query = "SELECT * FROM PINFO WHERE PID=2 OR PID=4";
    ResultSet rs = stmt.executeQuery(query);
    /*===========This is where i am passing the ResultSet and boolean=======
    ===========value to either add the null or not null values in the file======*/
    rstx = new ResultSetToXML(rs,true);
    } //end of try
    catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    ======================================================================================
    ResultSetToXML class
    ====================
    public class ResultSetToXML {
    private OutputStream out;
    private Element root;
    private XMLOutputter outputter;
    private Document doc;
    // Constructor
    public ResultSetToXML(ResultSet rs, boolean checkifnull){
    try{
    String tagname="";
    String tagvalue="";
    root = new Element("pinfo");
    while (rs.next()){
    Element users = new Element("Record");
    for(int i=1;i<=rs.getMetaData().getColumnCount(); ++i){
    tagname= rs.getMetaData().getColumnName(i);
    tagvalue=rs.getString(i);
    System.out.println(tagname);
    System.out.println(tagvalue);
    /*============if the boolean value is false it adds the null and not
    null value to the file =====================*/
    /*============else it checks if the value is null or the length is
    less than 0 and does the else clause in the if(checkifnull)===*/
    if(checkifnull){ 
    if((tagvalue == null) || tagvalue.length() < 0 ){
    users.addContent((new Element(tagname).setText(tagvalue)));
    else{
    users.addContent((new Element(tagname).setText(tagvalue)));
    else{
    users.addContent((new Element(tagname).setText(tagvalue)));
    root.addContent(users);
    out=new FileOutputStream("c:/XMLFile.xml");
    doc = new Document(root);
    outputter = new XMLOutputter();
    outputter.output(doc,out);
    catch(IOException ioe){
    System.out.println(ioe);
    catch(SQLException sqle){

    Can someone please help me with this problem
    Thanks.

  • RMI & JDBC ResultSet

    I am developing a project
    The basic archeiecture is like this:
    a reporting tool
    a virtualDB
    a real DB
    the reporting tool request for data from virtualDB, the virtualDB actually fetch the result for it.
    The virtualDB is a remote object using RMI which can be called in the reporting tool(stub)
    the virtualDB is connecting to the real DB through JDBC-ODBC driver.
    Now comes the problem, when the virtualDB has the ResultSet which is return by JDBC-ODBC. I cannot pass the ResultSet from remote site to my reporting tool, at run time, it will throw NotSerializable Exception, I guess this is because the JDBC-ODBC ResultSet does not implement that interface.
    So is there any way I can solve this problem to allow the reporting tool(client) receive the ResultSet that VirtualDB has got???
    Thanks in advance, any comment would be a great help for me!!!

    I can think of two ways:
    I can unpack the resultset at the remote site, and repack them into a new ResultSet which implements the Serializble interface. However, in the case I still dont know how to let me client receive the new ResultSet, quite lost...
    Another way, write all datas into XML, and pass the XML from remote site to reporting tool. It can work, but I want it to be efficient. This way is not efficient enough for me, I guess, and I do not want the overhead of creating XML.

  • How to get # of rows in SQL Query ResultSet

    I need to get the # of rows in a sql query resultset so I can create arrays of the size of the # or rows returned. This is how I do it so far. Is there a better way without running the query twice?
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery(query);
    while (rs.next())
         i++;     
    aid = new int;
    i=0;
    rs = stmt.executeQuery(query);
    while (rs.next())
         aid[i] = rs.getInt(1);
    Theres actually a few more arrays but for this I just used one to show what I was doing. Notice stmt.executeQuery needed to be called twice, once to get the count to set the size of the array and once to get the values.

    nope - there's no easy way.
    the right thing to do is to iterate through the ResultSet, load its contents into a List of Objects or some other data structure, and close it out right away. You can get the count of rows while you do it. return the contents in the object or data structure for clients to use. you should never be passing a ResultSet around.
    why do you need to know, anyway?
    %

  • Can we pass temporary result set to the  procedure?

    Hi,
    The result set is stored in a temporary storage. Can we pass that resultset to the procedure?
    Thanks and regards
    Gowtham Sen.

    I'm still unclear just what this result set is... Is is a table or a cursor or something else?
    If you imply the physical result set of a SQL query, there is no such thing in Oracle. Oracle does not create and store a result set in memory containing the rows of the SQL SELECT. Creating such sets in memory does not scale. A single SELECT on such a database can kill the performance of the entire database by exhasuting all memory with a single large physical result set.
    Oracle "results" live in the database cache (residing in the SGA). Rows (as data blocks) are paged into and out of this case as demand dictates. When PL/SQL code, for example, fetches a row, the SQL engine grabs the row from the db cache (SGA) and copies it to the PGA (the private memory area of the PL/SQL process). The row also may not yet exist in the db cache - in which case it needs a physical read from disk to get the data block containing that row into the db cache (after which it is copied to the PGA).
    A PL/SQL process can do a bulk fetch - e.g. fetch a 100 rows from the SQL query/cursor at a time. In that case, a 100 rows are copied from the SGA db cache to the PGA.
    At no time is there are single large unique and dedicated memory struct in the SGA that contains the complete "result set" of a SQL query.
    Once you have fetched that row, that is it. Deal is done. You cannot reverse the cursor and fetch the row again. After you have fetched the last row in that cursor, you cannot pass that cursor to another process - the cursor is now empty. That other process cannot rewind the cursor and start fetching from the 1st row again. You will need to pass the SQL to that process in order for it to create its own cursor - also keeping in mind that in between the rows can have changed and that this other process could now see different results with its cursor.
    If you want to create such a physical temporary result set that is consistent and re-usable, you can use a temporary table - and insert the results of the SELECT into this temp table for further processing. This temp table is session specific and is auto destroyed when the session terminates.
    A comment though - it sounds like you're approaching the date warehouse processing (scrubbing, transformation and loading of data) as a row-by-row process.
    That is a flawed approach. Row-by-row processing does not scale. One should deal with data sets. Especially when the volumes are large. One should also attempt to perform minimal passes through a data set. Processing a bunch of rows, then passing that rows to another process to do some processing on the same rows.. this means multiple passes through the same data. That is very inefficient performance and resource wise.

  • Returning resultset to a list

    I am trying to return my resultset to a List of Integers, but the example i am following uses a list of doubles. I have been getting on ok with with this untill i came to this point
    while (rs.next()) { int result = rs.getInteger(1); topTimes.add(result); }
    The getInteger method requires a system property as a parameter. What is a system property?

    I actually made a silly error, which is why i was being returned with the wrong values. I had the result field set to text instead of number. Thats just about me done with this problem now, after about 2 months! The final thing is one error i am being returned on the command line after i receive the results. I have done everything in one method as i have other quiries in this class.
    public void getFastest() 
    String SELECT_TOP_TIMES =
    "select TOP 3 r.result " +
    "from tblResults as r " +
    "where r.Event_ID = " +
    "(select e.ID " +
    "from tblEvent as e " +
    "where e.Event_Name = '100M Run') " +
    "and r.Round_ID = " +
    "(select ro.ID " +
    "from tblRound as ro " +
    "where ro.Round_Number = 'Round_1') " +
    "order by r.result";
    PreparedStatement ps = null;
    ResultSet rs = null;
    List<Integer> topTimes = new ArrayList<Integer>();
    try
    con = DatabaseUtils.connect(DRIVER, URL); 
    ps = con.prepareStatement(SELECT_TOP_TIMES);
    rs = ps.executeQuery();
    while (rs.next())
    int result = rs.getInt(1);
    topTimes.add(result);
    System.out.println(topTimes);
    catch(Exception e)
    System.out.println(e);
    DatabaseUtils.rollback(con);
    e.printStackTrace();
    finally
    DatabaseUtils.close(ps);
    DatabaseUtils.close(rs);
    DatabaseUtils.close(con);
    }But with it set like this, i get returned this message in my command prompt
    [3, 4, 32]
    java.sql.SQLException: ResultSet is closed
            at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(JdbcOdbcResultSet.java:6646
            at sun.jdbc.odbc.JdbcOdbcResultSet.clearWarnings(JdbcOdbcResultSet.java:
    1765)
            at sun.jdbc.odbc.JdbcOdbcResultSet.close(JdbcOdbcResultSet.java:1468)
            at DatabaseUtils.close(DatabaseUtils.java:41)
            at DatabaseSQL.getFastest(DatabaseSQL.java:143)
            at Meet.exit_actionPerformed(Meet.java:440)
            at Meet.access$600(Meet.java:9)
            at Meet$7.actionPerformed(Meet.java:183)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
    95)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6041)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5806)
            at java.awt.Container.processEvent(Container.java:2058)
            at java.awt.Component.dispatchEventImpl(Component.java:4413)
            at java.awt.Container.dispatchEventImpl(Container.java:2116)
            at java.awt.Component.dispatchEvent(Component.java:4243)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
            at java.awt.Container.dispatchEventImpl(Container.java:2102)
            at java.awt.Window.dispatchEventImpl(Window.java:2440)
            at java.awt.Component.dispatchEvent(Component.java:4243)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
    ad.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
    java:183)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
    java:177)
            at java.awt.Dialog$1.run(Dialog.java:1045)
            at java.awt.Dialog$3.run(Dialog.java:1097)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.awt.Dialog.show(Dialog.java:1095)
            at java.awt.Component.show(Component.java:1422)
            at java.awt.Component.setVisible(Component.java:1375)
            at java.awt.Window.setVisible(Window.java:806)
            at java.awt.Dialog.setVisible(Dialog.java:985)
            at CreateAtlDatabase.CreateAtlDatabase_actionPerformed(CreateAtlDatabase
    .java:110)
            at CreateAtlDatabase.access$000(CreateAtlDatabase.java:8)
            at CreateAtlDatabase$1.actionPerformed(CreateAtlDatabase.java:67)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
    95)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:236)
            at java.awt.Component.processMouseEvent(Component.java:6041)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
            at java.awt.Component.processEvent(Component.java:5806)
            at java.awt.Container.processEvent(Container.java:2058)
            at java.awt.Component.dispatchEventImpl(Component.java:4413)
            at java.awt.Container.dispatchEventImpl(Container.java:2116)
            at java.awt.Component.dispatchEvent(Component.java:4243)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322
            at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
            at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
            at java.awt.Container.dispatchEventImpl(Container.java:2102)
            at java.awt.Window.dispatchEventImpl(Window.java:2440)
            at java.awt.Component.dispatchEvent(Component.java:4243)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
    ad.java:273)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
    java:183)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:173)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
            at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
            at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)Do i need to set up the List in its own method and then pass the resultset to this method?

  • Passing objects between Servlets and JSP

    Hi,
    I have passed a ResultSet from a Servlet to JSP using RequestDispatcher forward(). I can access the ResultSet in the JSP page. How can I now pass this ResultSet into another JSP page once the form has been submitted?
    Thanks in advance.

    You should never passing expensive resources like ResultSet around like that. This indicate an open DB connection somewhere while it should already be closed at this stage.
    Read on about the DAO pattern and make use of servlets and beans.

  • Generate XML from a ResultSet

    Hi,
    I try to generate an XML DOM with XSU using the constructor OracleXMLQuery(java.sql.Connection conn,
    java.sql.ResultSet rset)
    When I pass a resultset object made by a classic statement, it's OK
    But when I pass a resultset made by a callable statement :
    ResultSet rs = (ResultSet)callStmt.getArray(7)).getResultSet(); it's not ok
    The first implementation of ResultSet is OracleResultSetImpl, the second implementation is ArrayDataResultSet.
    I think the XSU expect an OracleResultSetImpl Implementation of the resultset.
    What can I do ?
    Thank you

    Hi,
    Which Database Server you are using ? If you are using SQL Server 2000, you can directly call save method() on resultset object & save into XML file.
    Else you can traverse through resultset using while loop & append the values to string with whatever node names you want, then after you can write that string into the XML file.
    Try this out.
    Ajay.

  • PLEASE HELP!!!  Problem with Java and SQLServer Text data type

    Hi there,
    I have a java app. that reads from an MS SQLServer database. Originally, all long text fields were declared as NVARCHAR(200). The program worked fine.
    Someone then advised that I change all long text fields to the TEXT data type. The program now crashes out with the following Exception:
    "java.sql.SQLException: [JRun][SQLServer JDBC Driver]This ResultSet can not re-read row data for column 25."
    Basically, I have a method that retrieves a resulset and iterates through it. The resultset is passed to another method during each iteration. In the example below, the 'specialNote' field used to be NVARCHAR(200). The code worked fine. Then when it was changed to TEXT, the program no longer works with the above Exception thrown.
    Anyone know any special way SQLServer TEXT data types need to be handled?
    Thanks for any advice!
    The code looks something like this in functionality:
    <CODE>
    public void method1 (Connection conn)
    Resultset rs = conn.createStatement().executeQuery("SELECT * FROM ProductBB");
    while (rs.next())
    method2(rs);
    public void method2 (ResultSet rs)
    String str = rs.getString("specialNote");
    </CODE>

    Hi JWoods,
    Thanks for the suggestion. I originally had the code do what you suggested, ie, get the resultset then retrieve the data all within the same method. The data is then used to set properties in an object.
    When I had to create another method that also retrieved a resultset but using a different primary key, then also use the returned data to set the properties in the same type of object, I didn't want to repeat the setter code. That's why I decided to pass the resultsets to the same method that did the property setting.
    Unfortunately, it stopped working with the data type change.
    Any other thoughts?

Maybe you are looking for

  • Linksys WAP54G connecting to CISCO ACS via LEAP

    I understand that Linksys WAP54G support WPA and 802.1x authentication. Will a cisco compatible client card get connected to the WAP54G via LEAP authentication to a Cisco ACS server ? Connection scenario:- Cisco compatible client card <-WPA/LEAP-> WA

  • Export of report data in XLS file

    Hi, I need to analyze and manipulate reports output (pdf or html css) in XLS fomat. any idea how can i do it? Thanks Vishal

  • IS MBA DEGREE  MANDATORY TO BE A SAP CRM CONSULTANT

    HI, I was bit confused is MBA degree mandatory to become a SAP CONSULTANT. Can we become a SAP CONSULTANT with B.Tech. IF we can become is there any differences between an MBA  as a consultant  and B.Tech graduate as a consultant. Thanks in advance.

  • What's with the lame Win8 look, and inability to move the address bar?

    Ok. In previous version of Firefox, I had my layout like this. Perfectly usable, very small "top/chrome space" so that when I use it on a widescreen monitor I don't have to scroll to get past the top inch of the website (why oh why do PC makers think

  • Help on Decision making required

    Hi, We've an intranet based application running on weblogic (both a/s ans w/s) and we would like to introduce another module to this application and give this module alone the internet access -- internally this module shares lot of resources with the