Passing Hints Using JDBC

We are experiencing a problem w/ a query we are passing into Oracle 9i using Hibernate. The query returns quickly ( a few seconds) if you run it in SQL Plus (it only needs to return a few hundred rows) but hangs if it is passed through the JDBC connection. The developers wrote the query using the /*Rule*/ hint which is now deprecated. If you remove the hing in SQL Plus, it suddenly takes several minutes to return. Is the JDBC driver (which uses OCI I believe) be stripping out the hint before it passes it to the database because it's deprecated?

It's very common that different sessions have different execution plans for the query of the same text.
1. As pointed out in the previous reply, check out the execution plan of both queries and post the results if you need help in analyze the result.
2. Check if the JDBC session has modified parameters and/or diagnostic events.
http://dioncho.wordpress.com/2009/07/18/spying-on-the-other-session/
==================================
Dion Cho - Oracle Performance Storyteller
http://dioncho.wordpress.com (english)
http://ukja.tistory.com (korean)
http://dioncho.blogspot.com (japanese)
==================================

Similar Messages

  • Passing XMLType Data into oracle stored procedure using JDBC

    Hi Friends,
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.
    Following are the environment details
    JDK Version: 1.6
    Oracle: 10g
    Server: Tomcat 6.x
    Thanks in Advance

    user4898687 wrote:
    I have requirement where my oracle stored procedure accepts XML file as an input. This XML File is generated in runtime using java, I need to pass that xml file using JDBC to oracle stored procedure. Please let me know the fesibile solution for this problem.As stated - no.
    A 'file' is a file system entity. There is no way to pass a 'file' anywhere. Not PL/SQL. Not java.
    Now you can pass a file path (a string) in java and to PL/SQL.
    Or you can pass xml data (a string) in java and to PL/SQL. For PL/SQL you could use eithe a varchar2, if the xml is rather small, or a blob/clob.

  • Help: Connecting Tomcat to CA-IDMS Using JDBC Type 4 Drivers (JNDI)

    Hi there,
    I have a rather interesting / complex problem......creating a connection to CA-IDMS from Tomcat using JDBC type 4 drivers (CA provide the type 4 driver).
    We have a zSeries 9 IBM mainframe running CA-IDMS r16.1, and I need to connect to the IDMS from Tomcat (running on Linux) using the JDBC Type 4 drivers provided by CA.
    At this stage I am struggling with the actual setup and configuration of Tomcat’s server.xml and web.xml files. These are the files where the JDBC configuration is set (I think). I have to setup the CA-IDMS part of the configuration, but that is a different problem. Basically there is a TCP/IP listener on the IDMS, waiting for incoming connections from the JDBC type 4 driver.
    I set up a Tomcat to MySQL connection using MySQL Connector / J, which is a similar kind of process to what I am trying to achieve with IDMS. MySQL connector / J came with a jar file which is placed in Tomcat’s lib folder, and then the JDBC setup for the web application is created in Tomcat's server.xml and web.xml files. You can then connect to the MySQL database using JSP and the configured JDBC driver / connection. The CA-IDMS Server comes with an idmsjdbc.jar file, which I think is the JDBC typr 4 driver. I think it needs to be placed in the Tomcat /lib folder, but I don’t know how to set up the configuration.
    There is a JDBC DriverManager which allows JDBC drivers to connect to CA-IDMS. The DriverManager recognises the following syntax:
    jdbc:idms://hostname:port/database
    This allows the JDBC driver running within Tomcat to connect to the IDMS which is running on the IDM mainframe. CA IDMS r16 supports direct connections from the Type 4 JDBC driver to the Central Version on IDMS. "hostname" is the DNS name or IP address of the machine where the CV is running, and "port" is the IP port that was specified for the listener PTERM (setup on the IDMS side).
    There is a caidms.properties file for the JDBC driver, which is used to specify user ID, password, and optional accounting information. It can also be used to specify physical connection information, allowing an application to connect to a CA-IDMS database without requiring the definition of an ODBC style data source. However, I don’t know where to place this file within the Tomcat setup.
    There is also an IdmsDataSource class. I don’t know where to configure this or how to set it up; the CA-IDMS Server manual states the following:
    This class implements the JDBC DataSource interface. It is used with an application server (Tomcat) providing Java Naming and Directory Interface (JNDI) naming service to establish a connection to a CA IDMS database. IdmsDataSource properties conform to the Java Beans naming conventions and are implicitly defined by public “setter” and “getter” methods. For example, the “description” property, which is required for all DataSource implementations, is set using the setDescription(String) method. The application server may use the java.lang.reflection methods to discover DataSource properties and provide an interface to set them, or may simply require that they are defined in some configuration file. IdmsDataSource properties are used to specify the connection parameters. These properties are the equivalent of the DriverPropertyInfo attributes described in the previous section and can be used to completely define the parameters needed to connect to a database. Like a URL, an IdmsDataSource object can also reference an “ODBC” style data source name, where the connection parameters are defined in the configuration file on Linux.
    Is there anyone that can try to point me in the right direction to setting up the JDBC connection? I am totally new to Java and so the instructions are not making much sense at the moment. Any help, hints, tips…..anything will be greatly appreciated as I have just hit a brick wall here. I can't find much to do with setting up the CA-IDMS Server JDBC type 4 driver online either....if anyone can point me to some resources that would also be extremely useful.
    Kind regards
    Jp

    You say you've managed to get the JDBC driver working
    in an application but not in a JSP. You also say that
    the error you get is
    "com.microsoft.jdbc.sqlserver.SQLServerDriver".
    I'd be willing to bet that the exception that you have
    got is a ClassNotFoundException. I.E. your application
    server hasn't found the JDBC driver classes. The
    application server probably doesn't use your current
    CLASSPATH to look for classes. It will be setup within
    the application server in some way and you'll need to
    check your app server documentation to see how it is
    done.
    Try replacing
    e.printStackTrace();with
    e.printStackTrace(out);to get a full stack trace of your error.
    ColTried it. Got this error when I tried to run the JSP.
    Incompatible type for method. Can't convert javax.servlet.jsp.JspWriter to java.io.PrintWriter.
              e.printStackTrace(out);
    I'm currently using Apache Tomcat 4.0.3 as my JSP/Servlet Container.
    I'm also using Type 4 MS SQL Server 2000 JDBC driver version 2.0 on my NT4.0 Server.
    Do I need to set my JDBC driver in my container? if so, how do I do that?

  • How to use JDBC Connection Pools in a standalone application?

    Hi, there,
    I have a question about how to use JDBC Connection Pools in an application. I know well about connection pool itself, but I am not quite sure how to keep the pool management object alive all the time to avoid being destroyed by garbage collection.
    for example, at the website: http://www.developer.com/java/other/article.php/626291, there is a simple connection pool implementation. there are three classes:JDBCConnection, the application's gateway to the database; JDBCConnectionImpl, the real class/object to provide connection; and JDBCPool, the management class to manage connection pool composed by JDBCConnectionImpl. JDBCPool is designed by Singleton pattern to make sure only one instance. supposing there is only one client to use connection for many times, I guess it's ok because this client first needs instantiate JDBCPool and JDBCConnectionImpl and then will hold the reference to JDBCPool all the time. but how about many clients want to use this JDBCPool? supposing client1 finishes using JDBCPool and quits, then JDBCPool will be destroyed by garbage collection since there is no reference to it, also all the connections of JDBCConnectionImpl in this pool will be destroyed too. that means the next client needs recreate pool and connections! so my question is that if there is a way to keep pool management instance alive all the time to provide connection to any client at any time. I guess maybe I can set the pool management class as daemon thread to solve this problem, but I am not quite sure. besides, there is some other problems about daemon thread, for example, how to make sure there is only one daemon instance? how to quit it gracefully? because once the whole application quits, the daemon thread also quits by force. in that case, all the connections in the pool won't get chance to close.
    I know there is another solution by JNDI if we develop servlet application. Tomcat provides an easy way to setup JNDI database pooling source that is available to JSP and Servlet. but how about a standalone application? I mean there is no JNDI service provider. it seems a good solution to combine Commons DBCP with JNID or Apache's Naming (http://jakarta.apache.org/commons/dbcp/index.html). but still, I don't know how to keep pool management instance alive all the time. once we create a JNDI enviroment or naming, if it will save in the memory automatically all the time? or we must implement it as a daemon thread?
    any hint will be great apprieciated!
    Sam

    To my knoledge the pool management instance stays alive as long as the pool is alive. What you have to figure out is how to keep a reference to it if you need to later access it.

  • To run a report from command line, when using jdbc-odbc bridge

    Hi,
    How to run a report from command line, when using jdbc-odbc bridge?
    Usually with tns, we do by "rwrun module=<> userid=<user>/<passwd>@tns".
    with odbc, we do by "rwrun module=<> userid=<user>/<passwd>@odbc:DSN"
    Please specify, what is command line arguments for jdbc-odbc bridge driver?
    Environment : Oracle 9i Report Builder on WinNT
    Database : Sybase
    Regards,
    Ramanan

    Hello Ramanan,
    Report Builder : connect JDBC Query in Report Builder is to through Connection Dialog in JDBC Query Editor. User can use a Sign on parameter (can use, default : P_JDBCPDS or can create new) to connect to JDBC Data Source. Connection once made will be mentioned and will be reused through out Reports Builder.
    JDBC PDS allows user to connect one or more same or different kind of databases.
    While running report through runtime or Server, user can pass the sign on parameter(connection string) value, like any other user parameter.
    Syntax for connection string : <username>/<password>@databaseURL . The syntax of database part of connection string depend on the type of JDBC Driver used to connect to Data Source while designing the JDBC Query. databaseURL refer to the location of the database and its format depend on the JDBCPDS river selected in design time while creating the JDBC Query.
    rwrun eg :
    rwrun report=jdbc_odbc.rdf destype=file desname=output.html desformat=html P_JDBCPDS=scott/tiger@database
    Server eg :
    http://server.com:8888/servlet/RWServlet?server=MyReportServer+report=jdbc_odbc.rdf+destype=cache+desformat=html+P_JDBCPDS=scott/tiger@database
    http :
    Please see ORACLE_HOME/reports/conf/jdbcpds.conf for more information.
    With Regards
    Reports Team

  • How to insert an image file as blob using JDBC Statement

    Hi,
    I'm new on java.
    I want the code to insert an image file in Oracle database whose data type is blob.
    i want to use JDBC statement not the prepared statement.
    Please help me out.

    user8739226 wrote:
    thanks for the solution.
    I want to ask one thing
    let say i've created a method in a bean in which i'm passing three parameters.
    One is tablename as String, Second is Name of tablefields as Object, Third is Values as Object
    Like:
    public synchronized int insert(String table,Object[] fields, Object[] values)Ah now we're getting somewhere. I was trying to come up with a situation where using a regular Statement over PreparedStatement would be viable and came up with practically nothing.
    In the method body i'm accessing the table fields and values and combining them into the insert sql query.
    how can i do this using preparedstatment.
    how do i come to know here in this bean that this value is int or string or date at runtime to use setInt, setString, setdate or setBlob respectively.That's your problem. Bad design. You want to make some sort of universal insert method that can insert anything anywhere. But it doesn't really make sense, because whenever you're trying to insert something, you know exactly what you want to insert and where. You could use a PreparedStatement at that point (although encapsulate it in its own method). Now you're trying to create your own poorly designed framework over JDBC that doesn't solve problems, only increases them.
    Above was the only reason i saw, i was using statement instead of preparedstatment as statement was looking easy in this situation.
    please, give me the solution of above using preparedstatment.No, rather you should reconsider your design. What advantage does your insert() method give you over, let's say using a regular PreparedStatement. Granted, you can put your connection opening and other boilerplate code in the method. But if that's your only problem, then your insert method isn't gonna be much use. You could always switch to JPA for example and work with that.

  • Problem in back to back interface calls using JDBC adpater

    Hi,
    I am facing a problem while using the JDBC adapter from XI to oracle for back to back iterface calls.
    as my scenario is as follows i am doing synchronus call with the first interface which is working fine, immediately after the synchronus call i am doing a asynchronus call which is showing as successfull in XI but it is not at all reaching to oracle side as it is supposed to update a table in oracle using a stored procedure.
    any idea what could be the problem?
    Shravan

    Hi Shravan,
    It would be helpful if you could tell us the error thrown
    by your JDBC adapter in the <b>RWB--> ADAPTER MONITORING</b>.
    Also, if possible can you give us the message being passed to your JDBC adapter.
    meanwhile, just check your JDBC adapter document format against the formats in this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    For execution of a stored procedure using JDBC adapter, make sure that the action attribute is
    <b>EXECUTE</b> and the table name provided is the name of the STORED PROCEDURE.
    Regards,
    Bhavesh

  • Can't execute Oracle Stored Procedure using JDBC

    Hi all,
    I'm fairly new to JDBC and Oracle, so pardon my ignorance/lack of knowledge in this subject matter. I am trying to call a stored procedure named get_countries that has no parameters using JDBC. I do this by executing the following lines of code:
    CallableStatement cs = con.prepareCall("{call get_countries}");
    ResultSet rs = cs.executeQuery();But I get the following exception thrown:
    Exception in thread "main" java.sql.SQLException: ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GET_COUNTRIES'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    at oracle.jdbc.driver.DatabaseError.throwSqlException(_DatabaseError.java:112_)
    at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:331_)
    at oracle.jdbc.driver.T4CTTIoer.processError(_T4CTTIoer.java:288_)
    at oracle.jdbc.driver.T4C8Oall.receive(_T4C8Oall.java:745_)
    at oracle.jdbc.driver.T4CCallableStatement.doOall8(_T4CCallableStatement.java:218_)
    at oracle.jdbc.driver.T4CCallableStatement.executeForRows(_T4CCallableStatement.java:969_)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(_OracleStatement.java:1190_)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(_OraclePreparedStatement.java:3370_)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(_OraclePreparedStatement.java:3415_)
    at JDBCTest.main(_JDBCTest.java:44_)
    This makes no sense to me because there are no parameters that I need to pass. So I'm guessing this is something that I don't know about JDBC or about Oracle. I've searched Google for the past hour and a half and still haven't found anything that explains what might be the problem. I've also been following this guide ([http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html]) and I'm doing it exactly the same way, but for some reason it works for them.
    Anyone know what I'm doing wrong?
    Thanks for your help in advance. I really appreciate it!

    I went to a few forums and asked the same question. The boys down at Oracle Community Forums shed some light on this subject and, with their help, I was able to figure it out. Here is the thread for those who want to read: [My Thread @ Oracle Community Forums|http://forums.oracle.com/forums/thread.jspa?messageID=2721348?].
    THE SOLUTION
    cs = con.prepareCall("{ call get_countries(?) }");
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    ResultSet rs = ((OracleCallableStatement) cs).getCursor(1);

  • NCHAR issue with oracle database using JDBC adapter

    Hi,
    We have a requirement to develop an XI interface from FTP server(File adapter) to oracle database using JDBC adapter. In the oracle database table few fields are of type NCHAR/NVARCHAR. when we try to insert the character(A,B,c..) values into oracle table fields of type NCHAR/NVARCHAR, we are getting the following error message in the JDBC adapter audit log. IF we pass the numeric value to the same field, then we are able to insert the records successfully.
    Unable to execute statement for table or stored procedure. 'IPCSDD_DOWNLOAD_PROCESS' (Structure 'StatementName1') due to java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error JDBC message processing failed; reason Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    2010-10-19 22:29:59 Error MP: Exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'IPCSDD_DOWNLOAD_PROCESS' (structure 'StatementName1'): java.sql.SQLException: ORA-00904: "P": invalid identifier
    Please find the system information below.
    Oracle version- 10.2.4
    XI version - 3.0/ service pack 19
    JDBC driver- oracle.jdbc.driver.OracleDriver
    Please suggest.
    Thanks,
    Venkata
    Edited by: Venkata Narayana  Eepuri on Oct 21, 2010 12:10 AM

    Dear Venkata Narayana,
    Concerning the error, kindly go through the following note :
    731 - Collective note: ORA-00904
    follow the recommendations mentioned in that and please check if that helps.
    Best Regards
    Nishwanth

  • Creating a point geometry with coordinate transformation using JDBC

    If I execute the following SQL statement using a tool such as TOAD then I get a correct value for the point in the oracle column.
    INSERT INTO node (id, position) VALUES (53, SDO_CS.TRANSFORM(SDO_GEOMETRY(2001, 26910, SDO_POINT_TYPE(489535.0, 5457841.0, NULL), NULL, NULL), 4269))
    Point geometry:
    (2001, 4269, (-123.143865452971, 49.2732377100255, ), , )
    If I execute the same statement using JDBC in a Statement or PreparedStatement the Point in the oracle column has 0,0 for the coordinates.
    Point: geometry
    (2001, 4269, (0, 0, ), , )
    In both cases the SQL is exactly the same.
    my JDBC code is
    String insertSql = "INSERT INTO node (id, position) VALUES (" + id
    + ", SDO_CS.TRANSFORM(SDO_GEOMETRY(2001, " + geometrySrid
    + ", SDO_POINT_TYPE(" + coordinate2d.x + ", " + coordinate2d.y
    + ", NULL), NULL, NULL), " + srid + "))";
    Statement insertStatement = connection.createStatement();
    try {
    insertStatement.execute(insertSql);
    } finally {
    JdbcUtils.closeStatement(insertStatement);
    connection.commit();
    Any ideas why this is happening?
    I've tried to do the coordinate transformation in a separate call and pass in the STRUCT returned from that, using JGeometry to create a STRUCT for the value, using a WKT geometry and none of these approaches seem to work

    Paul,
    I have seen this work using JGeometry and STRUCT objects with PreparedStatements. Here's some sample code that seems to work just fine:
    ResultSet rs = null;
    try {
    PreparedStatement ps =
    getConn().prepareStatement("select SDO_CS.TRANSFORM(?, ?) from dual");
    /* constucts JGeometry objects using simple points (doubles) and SRID
    * Per the Javadoc, JGeometry objects can be constructed using the same
    * notation and signature as SDO_GEOMETRY objects -
    * JGeometry(int gtype, int srid, double x, double y, double z, int[] elemInfo, double[] ordinates) */
    JGeometry j_geom1 = new JGeometry(-122.4, 37.8, 8265);
    int newSRID = 4269;
    //convert JGeometry instances to DB STRUCT
    STRUCT obj1 = JGeometry.store(j_geom1, getConn());
    ps.setObject(1, obj1);
    ps.setInt(2, newSRID);
    rs = ps.executeQuery();
    while (rs.next()) {
    //System.out.println(rs.getString(1));
    STRUCT st = (oracle.sql.STRUCT) rs.getObject(1);
    JGeometry j_geom = JGeometry.load(st);
    System.out.println(j_geom);
    ps.close();
    rs.close();
    conn.close();
    } catch (Exception e) {
    System.err.print(e);
    Hope this helps.
    -Justin

  • Using JDBC with Oracle

    I have just completed compiling and running a simple UI through a java command line interface, however part of my program is running into a problem. I have to connect to Oracle through JDBC, but the server I am not on does not have the oracle drivers. I have copied them over (in tar as distributed) but I have never had to extern any thing like this. I am running on a standard linux bash prompt and need to know what to do to actually change everything so my program can run the database connectivity.
    Simply put, is there a way to compile so the byte code never needs the .jar, and if not how about making my program see the jar which is in my root folder (not root on the server, but my user root folder)
    I hope that was enough info, if not I'll do my best to provide more.

    Hmm, maybe I'm not quite making sense.
    Let's say I want to run my program on my neighbor's machine (A) to connect to an Oracle database on my machine (B). My neighbor has Java version 1.4.2, and my machine has Java version 1.4.2 also. My oracle database is running Oracle 8i (8.1.6.0.0) my machine. Let us also assume that my neighbor, while desiring a program to connect to my database, wants everything to be included in a single directory and no global system settings to be permananty changed. He doesn't mind if I change setting for the current session if need be.
    Now, I make the Java program on my machine and it works just fine. Since I have Oracle installed on my machine the command "java dbConnect" has no problem running. Now I take the program over to my neighbor's computer with the following files in the current program directory (not the java installation directory):
    dbConnect
    ojdbc14.jar
    This I hope would allow me to run the program since I thought (in error) that the program would probably be able to find the ojdbc14.jar since it is in the directory of the dbConnect program. Unfortunately it runs correctly, then fails to load the oracle driver.
    So now here is my real question. I want to be able to have my neighbor run my application, so what do I do to run the application dbConnect.java on their computer?
    I have tried the following, however it gives an exception in the thread when I run this
    javac dbConnect.java
    java -classpath ./ojdbc14.jar dbConnect
    Exception in thread "main" java.lang.NoClassDefFoundError: dbConnect.The program right now is simply a test to see if I can load the driver and make a connection, and it works on my system, so there should be no problems:
    import java.io.*;
    import java.sql.*;
    public class dbConnect
        //Create an input stream for reading data from the user
        private static BufferedReader stdin =
            new BufferedReader(new InputStreamReader(System.in));
        public static void main(String[] args)
            try{
                //>Load the Oracle JDBC Drivers
                try
                    Class.forName("oracle.jdbc.driver.OracleDriver");
                catch(Exception e)
                    System.out.println("Failed to load Oracle driver.");
                    System.exit(0);
                //>Get username, password, and url for Oracle DB connection.
                String user, pass, url;
                System.out.println("Please enter your username: ");
                user = stdin.readLine();
                System.out.println("Please enter your password: ");
                pass = stdin.readLine();
                url = "jdbc:oracle:thin:@somewhere:1521:csl";
                Connection conn = null;
                Statement stmt = null;
                //>Successfully connect to the Oracle database using JDBC and CSLab account.
                try
                    conn = DriverManager.getConnection(url, user, pass);
                    System.out.println("Connection made!");
                catch(Exception e)
                    System.out.println("Incorrect login information.");
                    System.exit(0);
            }catch(Exception e){
                System.out.println("Exception in main program.  Terminating process.");
    }

  • HELP: collection as in parameter of SP using jdbc

    Hi, everyone:
    i'm trying to pass an array of int value to a stored_procedure using jdbc, but i cannot figure out how to write the exact code.
    i always get the same exception: java.sql.SQLException: invalid name schema.
    i have searched this section and found some examle(Call a procedure/function with an array as argument i tried that example code, but it cannot work too, the same exception.
    here is my jdbc code:
    String driver = "oracle.jdbc.driver.OracleDriver";
    String strUrl = "jdbc:oracle:thin:@127.0.0.1:1521:test";
    Connection conn = null;
    Class.forName(driver);
    conn = DriverManager.getConnection(strUrl, "zzuliTV", "123456");
    CallableStatement proc = null;
    proc = conn.prepareCall("{ call TEST_TABLE_INT_PARAM(?,?) }");
    int elements[] = { 1, 2, 3, 4 };
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TEST_PACKAGE.ID_TABLE", conn);
    //ARRAY aArray = new ARRAY(desc, conn, elements);
    //proc.setInt(1,-1);
    //proc.setArray(2, aArray);
    //proc.execute();
    proc.close();
    conn.close();
    pl/sql code:
    create or replace
    PACKAGE TEST_PACKAGE AS
    type ID_TABLE is table of number(10,0);
    END TEST_PACKAGE;
    in the jdbc code, the statement "ArrayDescriptor desc = ArrayDescriptor.createDescriptor("TEST_PACKAGE.ID_TABLE", conn);" caused the exception.
    i have tried the code "ArrayDescriptor.createDescriptor("ID_TABLE", conn);" or written the pl/sql nested table globally or written an varray instead, but all failed, always the same exception.
    i use oracle 11g.
    Could anyone help me, thanks a lot.

    The error might be caused by your collection being defined inside of "TEST_PACKAGE", which I presume is a PL/SQL package.
    JDBC does not support Object nor Collection types defined inside packages.
    So, your attempt to globally define your "ID_TABLE" is the correct way to go.
    create type id_table as table of integer;
    or
    create type id_table as varray(#) of integer;
    Both are valid global definitions. I think that you said that you tried this unsuccessfully.
    You may want to try rewriting your elements declaration as follows.
    int elements\[] = new int\[]{1, 2, 3, 4};
    However, your declaration is probably fine. Another suggestion is to use CallableState.setObject() instead of setInt() and setArray().
    proc.setObject(1, new Integer(-1));
    proc.setObject(2, aArray);
    Also note that for 11g, the driver class is "oracle.jdbc.OracleDriver"
    Only other thing I can think of is to make sure the collection is defined in your schema or, if another, you have permission to it.
    That's all I can think of. Here is a link that describes using collections with JDBC. You may find it useful.
    http://st-doc.us.oracle.com/11/111/java.111/b31224/oraarr.htm#g1072333

  • How to use JDBC to connect informix database

    Dear all,
    I want my client application to connect informix database by using JDBC. The JDBC driver has been installed successfully in the client computer (Win2000). The informix 5.0 resides the a Unix server named "dbserver". The following is my java program.
    ========================
    import java.sql.*;
    import java.awt.event.*;
    public class Application1 {
    public static void main(String[] args) {
    Connection conn;
    try
    Class.forName("com.informix.jdbc.IfxDriver");
    catch (Exception e)
    System.out.println("Error "+e.getmessage());
    e.printStackTrace();
    return;
    System.out.println("It is ok");
    try
    conn = DriverManager.getConnection("jdbc:informix-sqli://dbserver:1526:INFORMIXSERVER=dbserver;username=test;password=******");
    catch (SQLException e)
    System.out.println("ERROR ."+e.getMessage());
    e.printStackTrace();
    return;
    System.out.println("All is fine");
    ===========================
    However, the error appears mentioning "Attempt to connect to database server (dbserver) failed." I don't know what the problem is because my informix database server is exactly "dbserver".
    Kindly need help from you guys. Thanks in advance.
    Kevin

    Hi,
    Plz try this (instead of 'username' use 'user') ...
    DriverManager.getConnection("jdbc:informix-sqli://dbserer:1526:INFORMIXSERVER=dbserver;user=test;password=*****");
    or this (pass the username and password as params)....
    DriverManager.getConnection( "jdbc:informix-sqli://dbserer:1526:INFORMIXSERVER=dbserver" , "test" , "*****" );
    Hope this helps
    ssa.
    >
    I want my client application to connect informix
    database by using JDBC. The JDBC driver has been
    installed successfully in the client computer
    (Win2000). The informix 5.0 resides the a Unix server
    named "dbserver". The following is my java program.
    ========================
    import java.sql.*;
    import java.awt.event.*;
    public class Application1 {
    public static void main(String[] args) {
    Connection conn;
    try
    Class.forName("com.informix.jdbc.IfxDriver");
    catch (Exception e)
    System.out.println("Error "+e.getmessage());
    e.printStackTrace();
    return;
    System.out.println("It is ok");
    try
    conn =
    onn =
    DriverManager.getConnection("jdbc:informix-sqli://dbser
    er:1526:INFORMIXSERVER=dbserver;username=test;password=
    catch (SQLException e)
    System.out.println("ERROR ."+e.getMessage());
    e.printStackTrace();
    return;
    System.out.println("All is fine");
    ===========================
    However, the error appears mentioning "Attempt to
    connect to database server (dbserver) failed." I don't
    know what the problem is because my informix database
    server is exactly "dbserver".
    Kindly need help from you guys. Thanks in advance.
    Kevin

  • Should pass hints to each and every query

    The platform is Oralce 10g on Linux platform.
    My manager has asked me to pass hints to each and every query. The reason is that according to him on client side data is updated so frequently that statistics shall become stale, due to which the plan of optimizer shall not be correct.
    I want to know is this correct approach or should we ask the client to gather statistics after each hour? Currently they are gathering statistics once in a day.
    Moazzam

    I agree with Paul... hints are the last resort, and are typically used for determining where there's a problem in the database design or query design so that you can then fix that, not something to be used as a permanent fix. The exception is of course things like the APPEND hint and a couple of others, but optimiser hints should be avoided. It suggests that you as a developer know better than oracle how to access the data stored in the datafiles and how that data is going to grow and change over time.
    If you have a problem with stale stats, perhaps look at running stats more often as one option, but certainly before you start adding hints to everything you should be determining if there actually is a problem and targeting those areas that have problems, not just a blanket change to everything.
    Your manager is wrong, simple as that.

  • Set target fileds from source fields using JDBC lookUp

    hello :
    advance thanks for reading below and i am new to java
    how to  to set the two taget fileds T1 and T2 from source field S1 using jdbc look up .Here is the code and its giving syntax error . set T1 to approver1 and T2 to approver2
    I copied the code from blog 2219 
    How to map to two target fileds ??
    Is something wrong with the query ?
    /people/siva.maranani/blog/2005/08/23/lookup146s-in-xi-made-simpler
    >>>>>>>>I defined Argument a(i am passing S1)  Result result
    >>>Here is the code :
      //write your code here
    String Query = " ";
    Channel channel = null;
    DataBaseAccessor accessor = null;
    DataBaseResult resultSet = null;
    // Build the Query String
    Query = "Select (approver1,approver2)  from  Emp where loginid = ' " + a[0] + " ' '';
    try{
    //Determine a channel, as created in the Configuration
    channel = LookupService.getChannel("SQL99","jdbc_cc1");
    //Get a system accessor for the channel. As the call is being made to an DB, an //DatabaseAccessor is obtained.
    accessor = LookupService.getDataBaseAccessor(channel);
    //Execute Query and get the values in resultset
    resultSet = accessor.execute(Query);
    for(Iterator rows = resultSet.getRows();rows.hasNext();){
    Map rowMap = (Map)rows.next();
    result.addValue((String)rowMap.get("(approver1"));
    //result.addValue((String)rowMap.get("approver2"));
    catch(Exception ex){
    result.addValue(ex.getMessage())
    finally{
    try{
    if (accessor!=null) accessor.close();
    catch(Exception e){
    result.addValue(e.getMessage())
    thankyou sdn:

    hi kumar,
    every statment in java should end with a semicolon... and 2 catch statments in the code given in blog(that you mentioned) are with missing semicolons at the end of the statments... just include semicolons at the end of these 2 catch staments and your code should work properly without any syntax error...
    catch(Exception ex){
    result.addValue(ex.getMessage());
    finally{
    try{
    if (accessor!=null) accessor.close();
    catch(Exception e){
    result.addValue(e.getMessage());
    Regards,
    JP

Maybe you are looking for

  • Problems setting up testing server CS5 with existing PhP site copied to hard drive

    A couple of years ago I dabbled in CS3 & PhP, but haven't touched it since 2009.  I still have WAMP loaded on my machines.  I'm now in a work situation where I was asked to see if I could make some simple copy updates to sites written in PhP.  I copi

  • Can I create a web page without .Mac Account?

    Hi all, Quick question: Is there any way to create a gallery for the web using iPhoto if you don't want or have a .Mac account? I have my own domain and hosting and I'd like to simply have iPhoto build the site, which I can upload to my own server. I

  • How do i get a replacement fan for my imac

    my CPU fan has recently gotten too loud for my confort and i want to replace it. Everytine I go to the Apple service request form and fill out all the answers, I get to a part where it states and there are no billable parts and gives me a number. I c

  • SQL 2012 SqlAgent wont start

    Hi, I'm testing a new install of SQL server2012, and the SQLAgent will no longer start. Build = Microsoft SQL Server 2012 (SP1) - 11.0.3000.0 (X64)  Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)

  • Assembly Order

    What is assembly order? Assembly order is created / released,what kind of changes in sales order will update the assembly order? for ex: quantity change