ArrayDescriptor using ojdbc7

What is the replacement for the use of tables with ojdbc7. It shows as obsolete.

Java 1 1.7

Thank you

Database Oracle 12 c Enterprise Edition Release 12.1.0.2.0 - 64 bit Production0
PL/SQL Release 12.1.0.2.0 - Production0
CORE12.1.0.2.0Production0
AMT for Linux: Version 12.1.0.2.0 - Production0
NLSRTL Version 12.1.0.2.0 - Production0

Found the answer

Collection nak

Integer [] nakinfo = new Integer [nak.size ()];

nak.toArray (nakinfo);

java.sql.Array nakarray = ((OracleConnection) conn) .createARRAY ("T_NUMBER_ARRAY", nakinfo);

orclCallStmt.setObject(2,nakarray);

Tags: Java

Similar Questions

  • Using arrary associative as parameter and passing then to the place where the clause of the select statement

    Hello

    I have this scenario where I have to pass multiple values to a parameter of a procedure of monkey and then collect in another variable (the lines can be multiple).

    The parameter must be used in the where clause of the statement select here I create a sample table for the problem.

    Create table test_tab (number of trans_id, cmts varchar2 (50));

    insert into test_tab values (568890112115, ' wnlb-CMTS-11-04' ");

    insert into test_tab values (568890112115, ' wnlb-CMTS-11-04' ");

    insert into test_tab values (568890112115, ' wnlb-CMTS-11-01' ");

    insert into test_tab values (568890112115, ' wnlb-CMTS-11-01' ");

    insert into test_tab values (568890112115, ' wnlb-CMTS-11-01' ");

    insert into test_tab values (568890112115, ' wnlb-CMTS-12-02' ");

    insert into test_tab values (568890112115, ' wnlb-CMTS-12-02' ");

    This is so all cmts have same trans_id but different name

    This query gives the result as -

    Select the cmts, count (1)

    of test_tab

    where cmts ("wnlb-cmts-11-04','wnlb-cmts-11-01", "wnlb-CMTS-11-02'")

    and trans_id = 568890112115

    Cmts group;

    COUNTY OF CMTS

    WNLB-CMTS-11-04 2

    3 WNLB-CMTS-11-01

    Now, I want to use this query in a PLSQL block like where I can spend the CMTS collection and trans_id as a scalar variable and once again an OUTPUT parameter that holds the result of the query.

    I use OUT parameter because it will be called to the JAVA program.

    Here, I write a PACKAGE for it but it gives me compilation error!

    create or replace package CMTS_SUCCESS_FAILED_API

    is

    type t_item_name is table of index varchar2 (50) by pls_integer;

    TYPE t_cmts_count () IS RENDERING

    CMTS VARCHAR2 (30),

    number of NUMBER

    );

    type t_reseg_dtl is table of index t_cmts_count by pls_integer;

    procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl);

    end CMTS_SUCCESS_FAILED_API;

    /

    Now that I have created a different PACKAGE BODY, but none don't work!

    1.

    create or replace package CMTS_SUCCESS_FAILED_API

    is

    type t_item_name is table of index varchar2 (50) by pls_integer;

    TYPE t_cmts_count () IS RENDERING

    CMTS VARCHAR2 (30),

    number of NUMBER

    );

    type t_reseg_dtl is table of index t_cmts_count by pls_integer;

    procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl);

    end;

    /

    create or replace package CMTS_SUCCESS_FAILED_API body

    is

    procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl)

    is

    Start

    I'm in p_item_name.first... p_item_name. Last

    loop

    Select the cmts, count (1)

    bulk collect into p_reseg_dtl (i)

    of test_tab

    where cmts = p_item_name (i)

    and trans_id = p_trans_id

    Cmts group;

    end loop;

    for r in p_reseg_dtl.first... p_reseg_dtl. Last

    loop

    dbms_output.put_line (p_reseg_dtl (r). TRANSACTION_ID | » '|| p_reseg_dtl (r). JOB_STATUS | » '|| p_reseg_dtl (r). CMTS);

    end loop;

    end CMTS_SUCCESS_FAILED_RESEG_ORDR;

    end CMTS_SUCCESS_FAILED_API;

    While I run this procedure it is said TOO_MANY LINES.

    2.

    create or replace package CMTS_SUCCESS_FAILED_API body

    is

    procedure CMTS_SUCCESS_FAILED_RESEG_ORDR (p_item_name t_item_name, p_trans_id in numbers, p_reseg_dtl to t_reseg_dtl)

    is

    cursor c_dtl is

    Select the cmts, count (1)

    of test_tab

    where cmts = p_item_name < < error

    and trans_id = p_trans_id

    Cmts group;

    Start

    Open c_dtl;

    collect the fetch c_dtl in bulk in p_reseg_dtl;

    close c_dtl;

    -for i in p_item_name.first... p_item_name. Last

    -loop

    -end loop;

    end;

    end;

    THIS error GIVES BODY as EXPRESSION IS OF TYPE INCORRECT for where clause where I mark it as "BOLD".

    I think Miss me a small detail to add here, but I can't do even now it seems for me that I'm working on it since the morning and SQL are a little complex in real time who also write.


    I use-

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    Please suggest me!

    Until then I'm also working on this issue hope will find a solution.

    In the database (we show it with a standalone function, you should put it in a package):

    create or replace function CMTS_SUCCESS_FAILED_RESEG_ORDR (
      p_item_name IN SYS.DBMS_DEBUG_VC2COLL,
      p_trans_id IN number
    )
    return sys_refcursor is
      l_refcur sys_refcursor;
    begin
      open l_refcur for
        SELECT cmts , COUNT(*)
          FROM test_tab
        WHERE cmts member of p_item_name
           AND trans_id = p_trans_id
        GROUP BY cmts;
      return l_refcur;
    end CMTS_SUCCESS_FAILED_RESEG_ORDR;
    /
    

    In Java:

    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    
    import oracle.jdbc.OracleCallableStatement;
    import oracle.jdbc.OracleTypes;
    import oracle.jdbc.pool.OracleDataSource;
    import oracle.sql.ARRAY;
    import oracle.sql.ArrayDescriptor;
    
    public class SQLCollection {
    
        public static void main(String[] args) throws SQLException {
    
            System.out.println("Class SQLCollection started.");
    
            OracleDataSource ods = null;
            Connection conn = null;
            CallableStatement cs = null;
            ResultSet rset = null;
    
            try {
                ods = new OracleDataSource();
                String url = "jdbc:oracle:thin:@//127.0.0.1:1522/orcl.localdomain";
                ods.setURL(url);
                ods.setUser("stew");
                ods.setPassword("stew");
                conn = ods.getConnection();
                conn.setAutoCommit(false);
    
                ArrayDescriptor oracleVarchar2Collection =
                    ArrayDescriptor.createDescriptor("SYS.DBMS_DEBUG_VC2COLL", conn);
                String[] inset = new String[2];
                inset[0] = "wnlb-cmts-11-04";
                inset[1] = "wnlb-cmts-11-01";
                ARRAY ora_inset = new ARRAY(oracleVarchar2Collection, conn, inset);
    
                cs = conn.prepareCall("begin ? := CMTS_SUCCESS_FAILED_RESEG_ORDR(?, ?); end;");
                cs.registerOutParameter(1, OracleTypes.CURSOR);
                cs.setArray(2, ora_inset);
                cs.setBigDecimal(3, new BigDecimal("568890112115"));
                cs.execute();
    
                // Dump the cursor
                rset = ((OracleCallableStatement)cs).getCursor(1);
                while (rset.next())
                    System.out.println(rset.getString(1) + ": " + rset.getInt(2));
    
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                if (rset != null) {
                    rset.close();
                }
                if (cs != null) {
                    cs.close();
                }
                if (conn != null) {
                    conn.close();
                }
                System.out.println("Class SQLCollection ended.");
            }
        }
    }
    
  • ClassCastException in oracle.sql.ArrayDescriptor.createDescriptor

    Hi team,

    I'm getting a ClassCastException while creating an ArrayDescriptor in my web application.

    I get the connection of the DBCP Tomcat connection pool using jndi lookup.

    I use jar pilot ojdbc6.jar, 10g to Oracle server, server, Tomcat 7 and JDK 7.

    Please help me to get the object oracle.jdbc.OracleConnection of the connection that is returned to the pool.

    Here is the stack trace that I receive.

    30 sep 2013 01:30:44 error_jsp:82 - Exception ERROR:. com.sun.proxy$ Proxy4 cannot be cast to oracle.jdbc.OracleConnection

    java.lang.ClassCastException: com.sun.proxy. $Proxy4 cannot be cast to oracle.jdbc.OracleConnection

    at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:149)

    at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:115)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)

    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)

    to org.apache.coyote.AbstractProtocol$ AbstractConnectionHandler.process (AbstractProtocol.java:589)

    to org.apache.tomcat.util.net.JIoEndpoint$ SocketProcessor.run (JIoEndpoint.java:310)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    to java.util.concurrent.ThreadPoolExecutor$ Worker.run (ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:724)

    Better yet, use OracleConnection.createOracleArray (12.1) or OracleConnection.createARRAY (11.x). Unfortunately, you can't use the standard JDBC method java.sql.Connection.createArrayOf as Oracle is not and can not support. To access the Oracle methods try this:

    Table a = conn.unwrap (oracle.jdbc.OracleConnection.class) .createOracleArray (sqlTypeName);

    Douglas

  • How to use ExecuteWithParams to make a list as a parameter

    Hi all

    "I need to have a read-only view of SQL with the following script Select * from XXXX_Table where ID is in (: ID_LIST).

    So, for example, the script will be something like "Select * from XXXX_Table where ID is in ("d1","d2")". "


    How do I compose the parameter: the end of the sling ID_LIST? I try to use

    OperationBinding operationBinding = bindings.getOperationBinding("ExecuteWithParams");
    operationBinding.getParamsMap () .put ("ID_LIST", "" d1","d2"" "); ID_LIST has the expression (String) value in the view object

    It does not work. I also try to use operationBinding.getParamsMap () .put ("ID_LIST", an_arraylist); does not work either.


    It works fine if I entered a single ID, IE operationBinding.getParamsMap () .put ("ID_LIST", "d1"). But operationBinding.getParamsMap () .put ("ID_LIST", "d1, d2") does not work.


    I spend several hours trying all kinds of combination of settings composed, that none of them work and the types of parameters (String, Object, Array). I think the problem is the unique quoto...


    One had before soloved?

    The first thing you need is a type of nested in the database Table. I created a with:

    CREATE TYPE vc_arraytype AS TABLE OF VARCHAR2(4000);
    

    This allows you to pass to SQL tables. Now, in theory, you should now be able to do this in the where clause of the your view object query:

    WHERE myfield in CAST(:myArrayParameter AS vc_arraytype)
    

    All you have to do is specify the parameter named myArrayParameter as a java.sql.Array clause, and ADF should do the conversions properly. But from JDeveloper 10.1.3.5 it didn't work that way. I don't know if it works in 11g, because I'm not using it much yet.

    So instead, I do some of my own conversions to make it work:

        private Connection getCurrentConnection() throws SQLException {
            PreparedStatement st =
                getDBTransaction().createPreparedStatement("commit", 1);
            Connection conn = st.getConnection();
            st.close();
            return conn;
        }
    
        private synchronized void setupDescriptor(Connection conn) throws SQLException {
            descriptor = new ArrayDescriptor("COMMON.VC_ARRAYTYPE", conn);
        }
    
        private Array toArray(ArrayList theArray) {
    
            Array arr = null;
            try {
                Connection conn = getCurrentConnection();
                if (descriptor == null) {
                    setupDescriptor(conn);
                }
                arr = new Array(descriptor, conn, theArray.toArray());
            } catch (SQLException s) {
                s.printStackTrace();
            }
            return arr;
        }
    
  • Using the markup with iPad Pro

    I open a pdf file in apple mail and used the markup and saved. It is not in the project and seems gone. Help?

    Check your iBooks app.

  • I have a lg 4 k tv (40 "40UH630V TV LG ULTRA HD 4 K) with HDMI 2. 0 and if I buy apple tv 4 can be used with HDMI 2. 0 port or do I HDMI 3 port to use this? Please help me

    I have a lg 4 k tv (40 "40UH630V TV LG ULTRA HD 4 K) with HDMI 2. 0 and if I buy apple tv 4 can be used with HDMI 2. 0 port or do I HDMI 3 port to use this? Please help me

    You can use it with your TV.

  • Why is apple tv (4th Gen) using subnet different comcast

    I need to figure out if there is anything special/different regaurding how ATV (4th Gen) made the resolution DNS when wired to a Comcast cable modem only (no wifi and no router)?  I notice that my ATV selects a different subnet when ATV is set automatically resolve IP and DNS.  Example of my Dell PC Tower and Sony laptop automatically use a subnet of 255.255.255.0, but ATV uses the example below:

    67.166.208.26

    255.255.252.0

    router 67.166.208.1

    ATV works great just need to know why to solve network problems not related to my home office network and at home?

    Hello. You say there is no router, but I guess that the Comcast modem is also a router and DHCP server. Are you using IPv6? You use a static IP address?

  • Verification request uses the wrong place

    I can't connect my mac to iCloud after changing my password.  Request for verification on the phone uses the wrong place.  It is safe to accept access?

    What do you mean by 'place' in 'request for verification on the phone uses the wrong place?

    You use two factor authorization?

  • Why are the 'minor' photos in the new iMac with K5 of the retina (using photoshop)?

    In English

    Hello.

    I met a 'problem' with the new iMac (retina 5K, 27 ", at the end of 2015).

    When I edit pictures in Photoshop, I can't get the images blown up big enough and the fillings of slide show they do not rule out even at a size of 72 dpi and with dimensions of 3000 x 2000.

    What don't I understand?

    Help would be so nice, thank you in advance.

    By Bjarne.

    PA Dansk

    Hej.

    JEG er pa stodt and 'problem' med den nyeste iMac (retina 5K, 27 ', ultimo 2015).

    NAR jeg redigerer billeder I Photoshop kan jeg ikke fa billederne blaest stort nok op og ved diasshow fylder ikke skaermen ud ved en str pa 72 dpi library pa med og selv 3000 x 2000.

    Hvad er det jeg ikke forstar?

    Tants city limit his BRA, pa forhand tak.

    By Bjarne.

    What version of the operating system and Photos do you use? Exactly how do you get pictures of Photos in Photoshop?

    LN

  • Photos shared on iOS devices use data?

    I have created a number of shared albums in the Photos on my Mac and iOS devices.

    When other people visit then shared albums, what data are used to access?

    I invited a person to see a shared album which had mobile data off on their iOS device and no wifi. However, they were able to access a shared album which surprised me because I assume they would have need of mobile data or wifi.

    Shared albums are stored locally on the iOS devices. Photos downloads smaller and optimized versions pictures of an iPhone. iCloud, sharing photos - Apple Support

    Once shared, pictures taken with your standard devices, iOS devices or cameras have up to 2048 pixels on the long edge. Panoramic photos can be up to 5400 pixels wide.

  • Using quartiles in figures

    I'm trying to understand the first and third quartile among a long list of different values, using numbers. I already did once in Excel, but for some reason I can't get the same result in numbers. In Excel, my first quartile is 40%, but when I do it with the same exact values in numbers, I get 41%. When I try to find the third quartile, the result is 57% in Excel and 55% in number. I copied the list of values in Excel, so I do not know there is no error with the missing numbers or something like that. The list has 80 values in there, but that shouldn't really matter. Would be great if someone knew what happens with that!

    Maybe something is wrong?

    Maybe something is different?

    Ok.  Joking apart.  We cannot help if you do not provide the details (as data).  Paste a copy of the data (select data, copy, click in this forum, paste) and screenshots of the results in Excel.  After the formulas that you use in Excel and you use number.

  • The use of the battery has increased since the update to ios 10. Also, why can not disable the voice command. It's the most boring on the new update.

    The use of the battery has increased since the update to ios 10. Also, why can not disable the voice command. It's the most boring on the new update.

    Depending on what you mean by "voice command", either:

    Settings / general / accessibility / VoiceOver / OFF, or

    Settings / Siri / OFF

    As for your use of the battery, you can check what app pulls most of its use in the settings / battery.  A new version of the app is sometimes problematic, not necessarily iOS or iPhone.  If you see a unusual % of use of a particular application, or force-to leave it removal/reinstalling it or remove it until an update comes.  If anything seems unusual, it might be a problematic installation of iOS, in which case, you could backup your iPhone and restore it:

    Restore your iPhone, iPad or iPod touch from a backup - Apple Support

  • Cannot use the search feature on the App Store

    Hello

    I have a problem with the search feature in the App Store. This problem only occurs when connected with my Apple ID, everything in the App Store itself works very well. Only when it comes to the search I get an error "the App Store is temporarily unavailable. Try again later. I tried all methods I found online and on Apple's site, including: restarting the unit, check the time and date, iOS is updated, various wireless as well as the 4 G network, signing in and out of the account and App Store refresh method. Unfortunately, nothing has worked so far.

    I am currently using iPhone 5s device

    iOS 10.0.2

    Same thing here.

    But if I register the App Store, the search works very well.

    There is clearly something wrong with the App Store.

  • 8gig of ram will be enough to use windows?

    I'm about to buy a macbook pro. This is the model of 512 gigabytes, 3.1 GHz, 8 GB ram. I want to only install windows to play spintires and that would be it. If I install windows and steam then spin tires it will the macbook running slower?

    rotating the tires to the requirements

    CPU: 2.5 GHz Dual Core
    RAM: 4 GB

    If you install Windows using Boot Camp Windows wizard will use all your computer RAM, 8 GB, when you start in Windows. It's more than enough RAM for Windows and a spin the requirements that you have posted.

    If you boot into OS x, OSX will use all 8 GB of RAM.

  • Use the old MBP as disk hard wi - fi?

    Is it possible to use my MBP 2011 as an external hard drive access via wifi with my new MBP mid-2015?

    Otherwise, I can buy an external hard drive and transfer everything on it; How I linking to our wifi router, and I can buy a regular drive (LaCie is what I've always bought in the past).

    Thanks for any help.

    Get an external drive enclosure usb, remove it from the old computer and put the old drive in the case, connect the box/HDD to the usb port of your router. Then, connect to the drive using wifi to your router.

Maybe you are looking for

  • iCal will sync with google calendar after update

    After the update to El Capitan, the calendar on the macmini syncs with google calendar.  Are there previous events to google calendar but nothing new will come and nothing new on the mac mini will return to google. Found a few other posts about it, b

  • Can't turn on Bluetooth, iPhone 6

    IPhone MY wife 6a Bluetooth off, but in the settings, I tried to turn on Bluetooth, just to get the spinner. What I am missi

  • Safari not h264 support?

    Hello guys I have a question about the video streaming on Safari. H264 unsupported in my browser? I want to see my https://live.amaryllo.eu/amaryllolive.html security camera, but he says that this browser does not support H264 streams. Is there a wor

  • How an executable in Windows CE 6.0 license image?

    I installed Windows CE 6.0 Evaluation Edition on Windows 7 Professional. The IDE is VS2005. Now, I create a run-time image and I want the image of execution of the license. But I can't start the 'tools-> Platform Builder for CE 6.0-> license run-time

  • Synchronization of constantly & long term internet time servers

    I spent countless hours trying to surf the web and try to possible solutions to achieve this.  For some time, with the relatively recent launch of the Microsoft forum site, I see that many people seem to have this problem.  The final solution I see o