Result set of One db to another DB

Dear All,
Need your help.
I am posting my sample class below
public static java.sql.ResultSet getData(String dbConnectStr,String dbuserID,String dbpwd,String query) throws Exception
// Obtain default connection
// Query all columns from the EMP table
ResultSet rset = null;
Connection conn = null;
try
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
conn = (OracleConnection)DriverManager.getConnection("jdbc:oracle:thin:@"+dbConnectStr,dbuserID,dbpwd);
((OracleConnection)conn).setCreateStatementAsRefCursor(true);
stat.execute("alter session set NLS_DATE_FORMAT='DD-Mon-RRRR HH:MI:SS'");*/
System.out.println(query);
Statement stmt = conn.createStatement();
rset = stmt.executeQuery(query);
System.out.println("returning");
catch (SQLException e)
e.printStackTrace();
// Return the ResultSet (as a REF CURSOR)
return rset;
################################## My Function in Oracle DB
FUNCTION DB_CALL(dbConnectStr VARCHAR2,dbuserID VARCHAR2,dbpwd VARCHAR2,query VARCHAR2) return axsbcstatement.CUR is language java name 'com.axs.logc.OracleDeployProcedure.getData(java.lang.String,java.lang.String,java.lang.String,java.lang.String) return java.sql.Resultset' ;
########################### My Procedure Where i am calling this function
PROCEDURE INSERT_call (inward_dbConnectStr VARCHAR2,inward_dbuserID VARCHAR2,inward_dbpwd VARCHAR2,query VARCHAR2,updateCnt out number) as
up_cnt number(6) :=0;
db_cur axsbcstatement.inward_cur;
ENTRY_NMBR_field dummy_table.Entry_Nmbr%type;
SNDR_NAME_field dummy_table.Sndr_Name%type;
SNDR_ADDRSS_field dummy_table.Sndr_Addrss%type;
RCVR_NAME_field dummy_table.Rcvr_Name%type;
REMARKS_field dummy_table.Remarks%type;
TRAN_AMNT_field dummy_table.Tran_Amnt%type;
TRAN_DATE_field dummy_table.Tran_Date%type;
BATCH_TRANID_field dummy_table.Batch_Tranid%type;
BATCH_TIME_field dummy_table.Batch_Time%type;
BEGIN
db_cur := INWARD_DB_CALL(inward_dbConnectStr,inward_dbuserID ,inward_dbpwd ,query);
loop
fetch db_cur into ENTRY_NMBR_field,TRAN_ID_field,SNDR_NAME_field,SNDR_ADDRSS_field,RCVR_NAME_field,REMARKS_field,TRAN_DATE_field,BNFCRY_field,BATCH_TRANID_field,BATCH_TIME_field;
EXIT WHEN db_cur%NOTFOUND;
begin
select ENTRY_NMBR INTO ENTRY_NMBR_field from dummy_table where ENTRY_NMBR = entry_nmbr_field and TRAN_ID = TRAN_ID_field;
if SQL%found then
dbms_output.put_line('Data Found in table ');
end if;
Exception
when no_data_found then
insert into dummy_table values(ENTRY_NMBR_field,TRAN_ID_field,SNDR_NAME_field,SNDR_ADDRSS_field,RCVR_NAME_field,REMARKS_field,TRAN_DATE_field,BNFCRY_field,BATCH_TRANID_field,BATCH_TIME_field);
up_cnt := up_cnt+1;
end;
end loop;
close db_cur;
updateCnt := up_cnt;
Exception
when others then
dbms_output.put_line(' - ' || SQLCODE|| ' ' ||SQLERRM);
END INSERT_call;
I am getting "ORA-00932: inconsistent datatypes: expected a return value that is a java.sql.ResultSet got a java.sql.ResultSet that can not be used as a REF CURSOR" this error while executing the procedure...
i have tried so many things but not able to solve this problem..
Apart from this If someone suggest me ...........
I am having two different database.with same table structure .
i have to take data from db1 and insert into the db2 on incremental basis (some checks required while inserting into the db2)
Regards .
Salil

Just modify your procedure like this
CREATE OR REPLACE PROCEDURE insert_call (
   inward_dbconnectstr         VARCHAR2,
   inward_dbuserid             VARCHAR2,
   inward_dbpwd                VARCHAR2,
   QUERY                       VARCHAR2,
   updatecnt             OUT   NUMBER
AS
   up_cnt               NUMBER (6)                      := 0;
   db_cur               axsbcstatement.inward_cur;
--   entry_nmbr_field     dummy_table.entry_nmbr%TYPE;
--   sndr_name_field      dummy_table.sndr_name%TYPE;
--   sndr_addrss_field    dummy_table.sndr_addrss%TYPE;
--   rcvr_name_field      dummy_table.rcvr_name%TYPE;
--   remarks_field        dummy_table.remarks%TYPE;
--   tran_amnt_field      dummy_table.tran_amnt%TYPE;
--   tran_date_field      dummy_table.tran_date%TYPE;
--   batch_tranid_field   dummy_table.batch_tranid%TYPE;
--   batch_time_field     dummy_table.batch_time%TYPE;
   all_rec              dummy_table.%ROWTYPE;
BEGIN
   db_cur := inward_db_call (inward_dbconnectstr, inward_dbuserid, inward_dbpwd, QUERY);
   LOOP
      FETCH db_cur
       INTO all_rec;
      EXIT WHEN db_cur%NOTFOUND;
      BEGIN
         SELECT entry_nmbr
           INTO entry_nmbr_field
           FROM dummy_table
          WHERE entry_nmbr = all_rec.entry_nmbr AND tran_id = all_rec.tran_id;
         IF SQL%FOUND
         THEN
            DBMS_OUTPUT.put_line ('Data Found in table ');
         END IF;
      EXCEPTION
         WHEN NO_DATA_FOUND
         THEN
            INSERT INTO dummy_table
                 VALUES (all_rec.entry_nmbr, all_rec.tran_id, all_rec.sndr_name, all_rec.sndr_addrss, all_rec.rcvr_name, all_rec.remarks, all_rec.tran_date,
                         all_rec.bnfcry, all_rec.batch_tranid, all_rec.batch_time);
            up_cnt := up_cnt + 1;
      END;
   END LOOP;
   CLOSE db_cur;
   updatecnt := up_cnt;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (' - ' || SQLCODE || ' ' || SQLERRM);
END insert_call;Regards,
Mahesh Kaila

Similar Messages

  • Stepping through a query result set, replacing one string with another.

    I want to write a function that replaces the occurance of a string with another different string.  I need it to be a CF fuction that is callable from another CF function.  I want to "hand" this function an SQL statement (a string) like this:   (Please note, don't bother commenting that "there are eaiser ways to write this SQL..., I've made this simple example to get to the point where I need help.  I have to use a "sub_optimal" SQL syntax just to demonstrate the situation)
    Here is the string I want to pass to the function:
    SELECT
      [VERYLONGTABLENAME].FIRST_NAME,
      [VERYLONGTABLENAME].LAST_NAME,
      [VERYLONGTABLENAME].ADDRESSS
    FROM
      LONGTABLENAME [VERYLONGTABLENAME]
    Here is the contents of the ABRV table:
    TBL_NM,  ABRV    <!--- Header row--->
    VERYLONGTABLENAME, VLTN
    SOMEWHATLONGTALBENAME, SLTN
    MYTABLENAME, MTN
    ATABLENAME, ATN
    The function will return the original string, but with the abreviations in place of the long table names, example:
    SELECT
      VLTN.FIRST_NAME,
      VLTN.LAST_NAME,
      VLTN.ADDRESSS
    FROM
      LONGTABLENAME VLTN
    Notice that only the table names surrounded by brackets and that match a value in the ABRV table have been replaced.  The LONGTABLENAME immediately following the FROM is left as is.
    Now, here is my dum amatuer attempt at writing said function:  Please look at the comment lines for where I need help.
          <cffunction name="AbrvTblNms" output="false" access="remote" returntype="string" >
            <cfargument name="txt" type="string" required="true" />
            <cfset var qAbrvs="">  <!--- variable to hold the query results --->
            <cfset var output_str="#txt#">  <!--- I'm creating a local variable so I can manipulate the data handed in by the TXT parameter.  Is this necessary or can I just use the txt parameter? --->
            <cfquery name="qAbrvs" datasource="cfBAA_odbc" result="rsltAbrvs">
                SELECT TBL_NM, ABRV FROM BAA_TBL_ABRV ORDER BY 1
            </cfquery>
         <!--- I'm assuming that at this point the query has run and there are records in the result set --->
        <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
        <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
        </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
            <!--- The chunck below is a parital listing from my Delphi Object Pascal function that does the same thing
                   I need to know how to write this part in CF9
          while not Eof do
            begin
              s := StringReplace(s, '[' +FieldByName('TBL_NM').AsString + ']', FieldByName('ABRV').AsString, [rfReplaceAll]);
              Next;
            end;
            --->
        <cfreturn output_txt>
        </cffunction>
    I'm mainly struggling with syntax here.  I know what I want to happen, I know how to make it happen in another programming language, just not CF9.  Thanks for any help you can provide.

    RedOctober57 wrote:...
    Thanks for any help you can provide.
    One:
    <cfset var output_str="#txt#">  <!--- I'm creating a local
    variable so I can manipulate the data handed in by the TXT parameter.
    Is this necessary or can I just use the txt parameter? --->
    No you do not need to create a local variable that is a copy of the arguments variable as the arguments scope is already local to the function, but you do not properly reference the arguments scope, so you leave yourself open to using a 'txt' variable in another scope.  Thus the better practice would be to reference "arguments.txt" where you need to.
    Two:
    I know what I want to happen, I know how to make it happen in another programming language, just not CF9.
    Then a better start would be to descirbe what you want to happen and give a simple example in the other programming language.  Most of us are muti-lingual and can parse out clear and clean code in just about any syntax.
    Three:
    <cfloop index="idx_str" list="#qAbrvs#">      <!--- Is this correct?  I think not. --->
    I think you want to be looping over your "qAbrvs" record set returned by your earlier query, maybe.
    <cfloop query="qAbrvs">
    Four:
    <cfset output_str = Replace(output_str, "#idx_str#", )  <!--- Is this correct?  I think not. --->
    Continuing on that assumption I would guess you want to replace each instance of the long string with the short string form that record set.
    <cfset output_str = Replace(output_str,qAbrs.TBLNM,qAbrs.ABRV,"ALL")>
    Five:
    </cfloop>               <!--- What am I looping on?  What is the index? How do I do the string replacement? --->
    If this is true, then you are looping over the record set of tablenames and abreviations that you want to replace in the string.

  • Not able to access the result set from one member function to another

    Im new to jdbc
    I have declared a connection object , a result set object and statement object in one member function and i am not able to access these in another member function. But both are in the same class
    Kindly help
    Thanks
    Shasi

    Kindly refrain from double-posting:
    http://forum.java.sun.com/thread.jspa?threadID=700659&tstart=0
    - Saish

  • Copy Form Setting from one user to another

    Hi,
    I am using 2005A.
    How to copy form setting (rows and UDFs at header) from one user to another user?
    Thanks

    Hi Ming Ming On,
    I found a note couple of years ago.
    I can't remember the note number, and I attach the note here.
    Solution
    The following queries enables you to set preferences for one user and copy those to another user who is supposed to have the same preferences.
    Explanation for the queries variables:
    dest - Company database name
    sourcid - Represents the user ID from whom the preferences will be copied.
    destid - Represents the user ID to whom the preferences will be copied.
    How to get the user ID?
    From SAP Business One query interface or from the SQL Query Analyzer, run the query as follows:
    1. SELECT T0.U_NAME, USERID FROM OUSR T0 FOR BROWSE
    2. From the query's results, identify both the sourcid and the destid.
    3. In order to copy the preferences from sourcid to destid, run the query as follows:
    a) Replace the text dest with the company database name.
    b) Replace the text sourceid with the user ID from which the preferences will be copied.
    c) Replace the text destid with the user ID to which the preferences will be copied.
    d) Use dest, if exists (select 1 from sysobjects where name = 'temp_dev_sup')
    e) Begin - drop table temp_dev_sup
    f) End - select * into temp_dev_sup from cprf where usersign='sourcid'
    Deleting a certain user:
    Delete from cprf where usersign='destid'
    Update userid in temporary table:
    1. Update temp_dev_sup
    2. Set usersign='destid'where usersign='sourcid'
    Insert preferces into CPRF table
    1. Insert into cprf
    2. Select "" from temp_dev_sup where usersign='destid*'
    &#50696;&#51228;)
    1. Use TEST_MONAMI
    2. drop table temp_dev_sup
    3. Delete from cprf where usersign='2'
    4. select * into temp_dev_sup from cprf where usersign='1'
    5. Update temp_dev_sup
        Set usersign='2'where usersign='1'
    6.  Insert into cprf
         Select * from temp_dev_sup where usersign='2'

  • Saving volume setting from one computer to another...

    Hi...
    My friend and I have identical iPods and we exchange tunes between one another's computers. We'd like the volume setting adjustments made by us in iTunes to be consisent on either iPod. But when we transfer the music files from one computer to the other, the volume settings always goes back to the normal setting.
    Is there any way to save the volume settings made in iTunes, from one computer to another?
    Thanks for you time!
    RCJ
    G3, G4, G3 iBook   Mac OS X (10.4.7)  

    Which directories do you mean? The socket-$hostname, tmp-$hostname etc. shouldn't be of any importance and can be left behind. Important for akonadi are the .local/akonadi and .config/akonadi folders. What kind of errors exactly do you get?

  • How should i use the two results sets in one single report data region?

    Hi frnz,
     I have to create a report using the below condition...
    Here my given data  set query gives you the two result sets ,so how should i use that two result sets information in single report....when i accessing that data set query it will take the values off the first result set not for the second result set.
    without using sub report and look up functionality..... if possible
    is there any way to achieve this.....Please let me know..
    Thanks!

    You cant get both resultsets in SSRS. SSRS dataset will only take the first resultset
    you need to either create them as separate queries or merge them into a single resultset and return with ad additional hardcoded field which indicates resultset (ie resultset1,resultset2 etc)
    Then inside SSRS report you can filter on the field to fetch individual resultsets at required places. While merging you need to make sure metadata of two resultsets are made consistent ie number of columns and correcponding column data types should be same.
    In absence of required number of columns just put some placeholders using NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Photosho CS Problem - Can't drag a layer set from one document to another one

    I have two documents open
    On the source document, i want to drag a layer set from this document to a new one, but its not letting me
    What would cause this.
    My structure for the source document is
    >Set 1 Layer Set
         >layer
         > Adjustment Layer
         >background
    Background
    Structure of the target document
    >Named Layer Set
         > Where I want to insert the Layer Set from source document
         >layer
         > Adjustment Layer
         >background
    Background

    No error message is given. I just can't drag it into the spot I want to drag the layer set to (its not an individual layer, its a layer set)
    Basically, this is all I can do (have to do a correction on how the layers and layer sets work, missing one level from the original post):
    I've attached images as well to illustrate
    On my target document, I want to have the layer set go where the red text is:
    >Content Layer Set
         >Named Layer Set
              > Where I want to insert the Layer Set from source document (Set 1)
              >layer
              > Adjustment Layer
              >background
    Background
    right now, I can only drag the layer set to this position:
    >Content Layer Set
          > This is where the Set 1 from the source document can go, I can't drag it into the layer set below
         >Named Layer Set
              >layer
              > Adjustment Layer
              >background
    Background
    First Image I attached shows the Set 1 Layer Set, above the layer set I want to drag it into
    Second Image I attached shows what happens when I try to drag the layer set into the named layer set; it comes up with the "no symbol"
    No Error message is given

  • How to transfer/ copy data and setting from one iPhone to another

    Hi,
    I recently cracked the screen on my 3G iPhone and a have fortunately managed to convince the insurance company to pay for a new one.
    I'd like to be able to transfer all my contacts, apps aand setting to the new phone. Only problem is I have to give back the old phone to get the new one.
    Any advice much appreciated, and thanks in advance to anyone who spend time to help

    The iPhone is designed to be synced with the supported applications on your computer for contact info, calendar events, and bookmarks. To transfer iTunes content and photos from your computer to your iPhone requires syncing with iTunes. Photos captured by your iPhone should be imported by your computer as with any other camera. The imported photos can be transferred back to your iPhone via the iTunes sync process.
    iTunes also creates and maintains a backup of your iPhone that includes data such as most iPhone settings, email account settings, SMS messages, notes, recent calls, call favorites, 3rd party app settings and data created and stored by 3rd party apps, contact info, and photos captured by your iPhone - but not a good idea to depend on the backup only for the last 2. Sync contact info with a supported application on your computer and import photos that were captured by your iPhone before giving up your iPhone. You can restore your new iPhone from your existing iPhone's backup followed by a sync.

  • Simple Query Result set as a %age of another result set

    Dear All,
    Query A is returning 3 key figures only (nothing in the rows) but with a filter on Customer in the free characteristics.
    Query B is returning the same key figures still with customer in the free characteristics but without a filter.
    I need query C to put the corresponding key figures from A over B and return a percentage.
    This needs to be done in the query and cannot be done in update rules.
    Can anyone help...?
    I of course will award as many points as I can to the first solution!
    Many thanks in advance,
    Stuart Humphrey

    If I understand correctly, then a customer exit is the way to go...
    One last question and I will post points as solved.
    In the web template I can set the variables so that their population is not forced and so prevent the user from having to select anything. 
    The variable can then be populated by the customer exit but when coding the customer exit, can I reference the free characteristics in the query and the values that are restricting them?
    I could then use those same restrictions to reduce the data set before obtaining the top 20 values (and hence the required list of 20 customers).
    Many thanks again....

  • Copying KDE setting from one computer to another

    I would like to copy my application and KDE settings to another computer (both running Arch with the same software and hardware). I am not sure what to do with ~/.config, ~/.local, and ~/.kde4 since they have subdirectories with names that match my the hostname of machine "A". If I naively copy everything, I get all sorts of errors/warning when logging in and trying to open my email/calendar/akonadi. How do you copy settings?

    Which directories do you mean? The socket-$hostname, tmp-$hostname etc. shouldn't be of any importance and can be left behind. Important for akonadi are the .local/akonadi and .config/akonadi folders. What kind of errors exactly do you get?

  • How to return two XML result sets using the function

    Hi Experts,
    Thanks.

    So that I want to return two XML result sets if the query returns more than 50,000 records.
    One XML result set with 50,000 and another XML result set with remaining records.
    How to incorporate this in my function.
    Have the function return a collection of CLOB then.
    DBMS_XMLGEN can handle pagination so it's easy to adapt your existing code.
    Here's an example fetching data in batches of max. 3 rows each, using a pipelined function :
    SQL> create or replace type clob_array is table of clob;
      2  /
    Type created
    SQL>
    SQL> create or replace function genXmlRowset (p_deptno in number) return clob_array pipelined
      2  is
      3    ctx    dbms_xmlgen.ctxHandle;
      4    doc    clob;
      5  begin
      6 
      7    ctx := dbms_xmlgen.newContext('SELECT empno, ename FROM scott.emp WHERE deptno = :1');
      8    dbms_xmlgen.setBindValue(ctx, '1', p_deptno);
      9    dbms_xmlgen.setMaxRows(ctx, 3);
    10 
    11    loop
    12 
    13      doc := dbms_xmlgen.getXML(ctx);
    14      exit when dbms_xmlgen.getNumRowsProcessed(ctx) = 0;
    15      pipe row (doc);
    16 
    17    end loop;
    18 
    19    dbms_xmlgen.closeContext(ctx);
    20 
    21    return;
    22 
    23  end;
    24  /
    Function created
    SQL> set long 5000
    SQL> select * from table(genXmlRowset(30));
    COLUMN_VALUE
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7499</EMPNO>
      <ENAME>ALLEN</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7521</EMPNO>
      <ENAME>WARD</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7654</EMPNO>
      <ENAME>MARTIN</ENAME>
    </ROW>
    </ROWSET>
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <EMPNO>7698</EMPNO>
      <ENAME>BLAKE</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7844</EMPNO>
      <ENAME>TURNER</ENAME>
    </ROW>
    <ROW>
      <EMPNO>7900</EMPNO>
      <ENAME>JAMES</ENAME>
    </ROW>
    </ROWSET>
    SQL>
    (and don't forget to use bind variables in your query)

  • Please help - Scrollable result set in sql server 2000

    Hi can some one please help me. I'm trying to create scrollable result set in sql server 2000, but i just can't get it to work. I've been trying to do this for the past 12 hours. I want to go home, but I can't till I get this going! please help!!! My crap code is as follows:
    package transact;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.JInternalFrame;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class DummyFrame extends Dummy
    protected String name, surname;
    protected Connection conn;
    protected CallableStatement cstatement;
    public DummyFrame()
    createFrame();
    private void createFrame()
    try
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    conn = DriverManager.getConnection(
    "jdbc:microsoft:sqlserver://server:1433;" +
    "user=user;password=pwd;DatabaseName=Northwind");
    catch (Exception e)
    e.getMessage();
    populateFields();
    menuAction();
    show();
    private void menuAction()
    btncontacts.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    getRecords();
    populateFields();
    btncontacts.setText("NEXT");
    btnkeywords.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    // transaction.getRecords();
    nextRecord();
    populateFields();
    btncontacts.setText("NEXT");
    protected void nextRecord()
    try
    // CallableStatement cstatement = null;
    cstatement = conn.prepareCall(
    "{call Employee_Selection}", ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = cstatement.executeQuery();
    while (rs.next())
    surname = rs.getString("Lastname");
    cstatement.getMoreResults();
    catch (Exception e)
    e.getMessage();
    protected void getRecords()
    try
    CallableStatement cstatement = null;
    cstatement = conn.prepareCall(
    "{call Employee_Selection}", ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = cstatement.executeQuery();
    while (rs.next())
    surname = rs.getString("Lastname");
    name = rs.getString("Firstname");
    rs.first();
    // call stored procedure
    catch (Exception e)
    e.getMessage();
    // populate the fields;
    private void populateFields()
    txtfirstname.setText(name);
    txtsurname.setText(surname);
    }

    ummm ok i think the logic in your code is kinda screwy...
    here is what your should be doing.
    create the gui.
    get the resultset...
    have code that looks like this for nextRecord...
    protected void displayNextRecord(){
      // we do not call next here because we already called it last time
      surname = rs.getString("Lastname");
      name = rs.getString("Firstname");
      populateFields();
      if(!rs.next(){
        btncontacts.setEnabled(false);// i'm not sure what btncontacts is but we want to disable next becuase there are no more records...
    // in your intitalization code you need to do this...
    // you old stuff ending with...
    ResultSet rs = cstatement.executeQuery();
    // the new stuff...
    if(rs.first()){
      displayNextRecord();
    }else{
      btncontacts.setEnabled(false);//the result set is empty
    }ok the real problem you are having is that you are trying to display one record at a time but you are scrolling
    through the entire result set using while(rs.next()... what you
    want to do is create the result set once and scroll through
    it one item at a time with your gui.
    the example method i have given displays the data from the current
    row in your gui. then it advances the result set forward one row if possible. this method assumes that the result set will always
    be positioned on a valid row thus the need for calling
    rs.first() before we originally call displayNextRecord()
    well i hope you find this helpful.

  • Help with streaming result sets and prepared statements

    hi all
    I create a callable statement that is capable of streaming.
    statement = myConn2.prepareCall("{call graphProc(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}",java.sql.ResultSet.TYPE_FORWARD_ONLY,
    java.sql.ResultSet.CONCUR_READ_ONLY);
    statementOne.setFetchSize(Integer.MIN_VALUE);
    the class that contains the query is instantiated 6 times the first class streams the results beautifully and then when the second
    rs = DatabaseConnect.statementOne.executeQuery();
    is executed I get the following error
    java.sql.SQLException: Can not use streaming results with multiple result statements
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
    at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:1370)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1688)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3031)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:943)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1049)
    at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:589)
    the 6 instances are not threaded and the result set is closed before the next query executes is there a solution to this problem it would be greatly appreciated
    thanks a lot
    Brian

    Database resources should have the narrowed scope
    possible. I don't think it's a good idea to use a
    ResultSet in a UI to generate a graph. Load the data
    into an object or data structure inside the method
    that's doing the query and close the ResultSet in a
    finally block. Use the data structure to generate
    the graph.
    It's an example of MVC and layering.
    Ok that is my bad for not elaborating on the finer points sorry, the results are not directly streamed into the graphs from the result set. and are processed in another object and then plotted from there.
    with regards to your statement in the beginning I would like to ask if you think it at least a viable option to create six connections. with that said would you be able to give estimated users using the six connections under full usage.
    just a few thoughts that I want to
    bounce off you if you don't mind. Closing the
    statement would defeat the object of of having a
    callable statement How so? I don't agree with that.
    %again I apologise I assumed that since callable statements inherit from prepared statements that they would have the pre compiled sql statement functionality of prepared statements,well If you consider in the example I'm about to give maybe you will see my point at least with regards to this.
    The statement that I create uses a connection and is created statically at the start of the program, every time I make a call the same statement and thus connection is used, creating a new connection each time takes up time and resources. and as you know every second counts
    thanks for your thoughts
    Brian.

  • Combining result set of two services into one result set

    Hi,
    I have a model where I am getting one result set (6 Fields) from BI query and another result set (3 Fields which gives real time values) from OLTP system. I want to show the output of these two result sets into single result set (7 Fields). I have a common field in both the result sets as key field.
    I tried this using UNION operator but I am not able to set the Key fields and also in the table view of UNION operator I am getting any field to be added to table.
    Can anyone help me to solve this problem?
    Any help is appreciated.
    Regards,
    Amit

    Hi Amit,
    in this case, you have to use the combine-operator. However, this operator needs a key-field in each of these sets. E.g. Combine set (<u>customer-id</u>, order-id, week, delivery-state) with set (<u>customer-id</u>, city, client-class).
    The combine operator might not be available when compiling to webdynpro, I did not check that.
    Best Regards, Benni

  • How to pass one row of a result set to a cffunction?

    I can pass the entire result set of a query to a cffunction,
    but the function only needs one row.
    The code below is a syntax error, where "3" is array index
    notation for the third row of the result set.
    What is the correct way to pass one row of a result set to a
    cffunction?
    Thank you.

    iirc, cf does not allow one to reference and access a row of
    a resultset
    like that.
    you will have to create a structure/array that holds the data
    from
    specific query row and pass that to your function. looping
    over
    queryname.columnlist list will make it easier and not
    specific to any
    particular query. make it into another function that accepts
    a query and
    row number as arguments and returns a struct/array of that
    row data (or
    automatically passes it to another function).
    sample code for creating a structure of specific query row
    data:
    <cfset rowstruct = {}>
    <cfloop list="#queryname.columnlist#" index="col">
    <cfset rowstruct[col] = queryname[col][somerownumber]>
    </cfloop>
    <cfdump var="#rowstruct#">
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

Maybe you are looking for

  • Apache Bridge HTTP POST problems on large file upload

    I have a problem uploading files larger than quarter a mega, the jsp page does a POSTto a servlet which reads the input stream and writes to a file. Configuration: Apache webserver 1.3.12 connected to the Weblogic 5.1 application server via the bridg

  • SQLServer connection in Connection Navigator doesn't display any tables ...

    I connect to a SQLServer DB using the steps described in the help and I can query tables just fine, but when I click on the Tables or Views, I see nothing. I can start up a SQL worksheet and get data from the database just fine. I can also connect us

  • My exchange account sent email does not show in mail

    I am running a 2007 MS Exchange account and I want to use Mail as my mail software, all the incoming mail appears but my sent messages do not - does anybody have any ideas for a fix for this problem?

  • How to add new column in screen painter

    Hi          I have try to add new column on existing screen and test screen in se51, the column is added in position correctly. But when I run program call this screen, the added column is placed as the last column. Please help. Thanks

  • MRP Based Excise

    Dear All, In our organization we have below billing process (MRP Based Excise). Excise duty is calculated on MRP(-)30% Abatment. Can any one help me how to configured the scinerio in a pricing procedure because the Excise is calculated on the base pr