Prepared stmt

How does 'Like' keyword work in prepared statement. It is not working when I am trying to use the following statements....
squery = "SELECT COUNT(*) As COUNT FROM table_name WHERE RTRIM(LTRIM(column1)) LIKE ?";
pstmt = con.prepareStatement(sQuery)
pstmt.setString(1,"xyx");
pstmt.executeQuery();
And I am trying to search for records having the value of "xyz" for the column "column1" in table "table_name".
I am getting 0 records eventhough there are records in database....
And I am not getting any exception.
Can someone help me on this?

squery = "SELECT COUNT(*) As COUNT FROM table_name
WHERE RTRIM(LTRIM(column1)) LIKE ?";
pstmt = con.prepareStatement(sQuery)
pstmt.executeQuery();
pstmt.setString(1,"xyx");If you want columns with the exact value of "xyz" then you should use = , not like.
WHERE RTRIM(LTRIM(column1)) = ?;To learn more about LIKE and wildcards take a look here http://fluffycat.com/sql/sql-like.html
Col

Similar Messages

  • Equivalent of a prepared stmt (with mapping table to a java class) ?

    Hi,
    We can fire raw-sql using SQLCall(). Do we have something similar to make and use prep stmts ?
    If we have mapped tables to some java classes, this cud be done with the use of toplink 'Query' classes.
    But if I dont have anything mapped and want to use the raw-sql kinda method, is it possible to make and use a prep stmt in toplink ?
    Thanks,
    Krishna

    Hi Donald, You are right...I was actually looking for something to use JDBC code directly for these parts. So is there a way to get a java.sql.Connection out of the TopLink session and then fire prepared statements (JDBC code) using that connection ?
    Can we do something like this... (do let me know if this is not the right way to do it at all...or if it is not possible at all)
    ConnectionPool oCP = RuntimeServices.getConnectionPools().elementAt(0); // plz ignore that i assumed pools are returned as Vector
    java.sql.Connection oCon = oCP.getDatabaseLogin().connect(prop); // is it necessary to give prop (since I got it from existing conn pools that are already setup in the server session)
    Thanks,
    Krishna

  • Jdbc2Odbc, Prepared Stmts and Batches... just don't work together.

    Hi.
    this throws a NegativeArraySizeException on executeBatch:
    con.setAutoCommit(false);
    PreparedStatement p=con.prepareStatement("insert test_date(txt) values(?)");
    p.setString(1, "das");
    p.addBatch();
    p.setString(1, "sss");
    p.addBatch();
    p.executeBatch();
    con.commit();
    p.close();
    con.close();
    this does too:
    con.setAutoCommit(false);
    PreparedStatement p=con.prepareStatement("insert test_date(txt) values(?)");
    p.setString(1, "das");
    p.addBatch();
    p.executeBatch();
    con.commit();
    p.close();
    con.close();
    this works fine:
    con.setAutoCommit(false);
    PreparedStatement p=con.prepareStatement("insert test_date(txt) values(?)");
    p.setString(1, "das");
    p.addBatch();
    p.executeUpdate();
    con.commit();
    p.close();
    con.close();
    to make things worse, this does not throw any Exception, but instead of a 5, I get 144595456 in the table!!!:
    con.setAutoCommit(false);
    PreparedStatement p=con.prepareStatement("insert test_date(l) values(?)");
    p.setInt(1, 5);
    p.addBatch();
    p.executeBatch();
    con.commit();
    p.close();
    con.close();
    could someone recode Jdbc2Odbc?? :))
    nikolas/

    Hi,
    As far as I know, this is a bug in the JDBC-ODBC bridge. I used to get the same error and I used a native driver to get around this problem. My database was DB2, and I used a native driver for DB2. One more thing, the JDBC-ODBC bridge is very slow and you will notice the difference once you use the native driver.
    There is a batch file usejdbc2.bat which directs the driver to use the jdbc 2.0 specs explicitly. I ran that before actually using the native driver. In the case of a DB2 driver it should be in the directory Sqllib\java12. But I am not sure about the other drivers.
    Hope this helps and best wishes,
    Nish

  • Are 'prepared' SQL stmts cached by WL finders?

    I'm using WL6.0 to deploy entity beans. I'm using a particular finder
    method on the home interface quite a bit to lookup the entity beans. It
    looks like Optimizeit is reporting that a lot of time is spent in parsing
    the SQL stmt over and over. The finder uses EJB-QL. Can't these SQL
    queries be prepared once and then cached?
    56.19% - 15390 ms - weblogic.db.oci.OciCursor.execAndFetch()
    28.21% - 7727 ms - weblogic.db.oci.OciCursor.parse()
    0.96% - 264 ms - java.lang.String.getChars()
    0.89% - 245 ms - weblogic.db.oci.OciCursor.arrayFetch()
    0.74% - 203 ms - java.lang.reflect.Constructor.newInstance()
    thanks,
    greg.

    WLS does have a prepared statement cache. I know it's in 6.1, but I can't
    remember if it made 6.0 or not.
    I believe there's a tuneable on the connection pool or the data source to
    increase the cache size. You might consider increasing it.
    Also I would consider the number of db round-trips you make as the first
    order. Reducing that will give a much bigger boost than caching the
    prepared stmt.
    -- Rob
    Gregory Chan wrote:
    I'm using WL6.0 to deploy entity beans. I'm using a particular finder
    method on the home interface quite a bit to lookup the entity beans. It
    looks like Optimizeit is reporting that a lot of time is spent in parsing
    the SQL stmt over and over. The finder uses EJB-QL. Can't these SQL
    queries be prepared once and then cached?
    56.19% - 15390 ms - weblogic.db.oci.OciCursor.execAndFetch()
    28.21% - 7727 ms - weblogic.db.oci.OciCursor.parse()
    0.96% - 264 ms - java.lang.String.getChars()
    0.89% - 245 ms - weblogic.db.oci.OciCursor.arrayFetch()
    0.74% - 203 ms - java.lang.reflect.Constructor.newInstance()
    thanks,
    greg.

  • High memory usage on JDBC 10.2.0.1.0 driver on Prepared/Callable Statements

    We are observing high memory usage for each callable/prepared stmt, using 10.2.0.1.0 JDBC Driver. The char[] in oracle/jdbc/driver/T4CVarcharAccessor was alloted 64K to 320K and grows with usage. This problem is worse with 10.1.0.2. driver which was alloted 720K byte of memory for each stmt right at the start.
    We found this by doing a JVM heap dump and analyzing the heap dump using IBM's heap analyser. Here is a snapshot of the heap dump for this object:
    321,240 [216] 11 oracle/jdbc/driver/T4CVarcharAccessor 0x72752968
    - 320,616 [320,616] 0 char[] 0x72761028
    - 216 [216] 0 short[] 0x727527d8
    - 72 [32] 1 java/lang/String 0x727530a0
    - 24 [24] 0 int[] 0x72752938
    - 24 [24] 0 int[] 0x72752948
    - 24 [24] 0 int[] 0x72752958
    - 16 [16] 0 bool[] 0x72752928
    - 16 [16] 0 byte[] 0x727528b0
    - 16 [16] 0 bool[] 0x72752918
    - 10,336 [88] 15 oracle/jdbc/driver/T4CMAREngine 0x712e7128
    - 1,544 [1,032] 79 oracle/jdbc/driver/T4CPreparedStatement 0x72754c58
    It is repeated many times for each prepared/callable stmt call.
    Details of our platform is:
    Database - Oracle Database 10g Release 10.2.0.1.0 - 64bit Production
    JDBC Driver - Oracle Database 10g Release 2 (10.2.0.1.0) JDBC Drivers
    JDK - [Classic VM, Version 1.4.2] from [IBM Corporation]
    Our callable stmts are not using any of the Oracle caching facility. It is a simple call stmt with OUT parameters and the stmt is closed after each execution. However, we implement our own connection pooling and do not close the connection after each stmt.
    Is there a workaround to this? Would appreciate any feedback.

    What is happening is that each new CallableStatement you create allocates a new char[]. I would strongly encourage you to use the implicit statement cache if at all possible. That way instead of creating a new statement each time with a new char[] you will get an already existing statement and reuse the existing char[]. Closing a statement releases the char[] so if you really are closing the statements the char[]s should be GC'd.
    Douglas

  • Unable to set string in prepared statement

    Hi all,
    I just want to set an string to a prepared stmt.
    the setting string is in the format..... the integers with comma saparated....
    str="23,55,22"
    ps.setString(1,str)
    The prepare statement is taking only the first integer... i.e. 23
    can any one help me out..........
    thanks in advance,
    prakhyath

    if i am not mistaken.... If I create the Prepared
    Statement after receiving the arguments that are to
    be provided to it.... the actual purpose.. Of using
    a prepared statement is not served at all....Not creating a new Statement each time, is only one of the purposes of PreparedStatement. In this case, since the arguments should be ints (and I hope you are checking that), then it doesn't make much of a difference. But a PreparedStatement is alos used to easily facilitate the proper quoting and escaping of the parameters set, which almost eliminates any chance of an SQL injection attack. There are also a few other convienences associated with a PreparedStatement, but, in this case, you are probabyl right in that there is no advantage of PreparedStatement over Statement (as long as you are checking that the arguments provided are actually ints, otherwise you are opening yourself up to an injection attack).

  • Prepared statement not releasing from access db

    Hello all,
    I have several prepared statements like the following:
    public void storeUpdate(String userId,String ws,String wm,String wl,String wx,String wxx,String bs,String bm,String bl,String bx,String bxx, String tq, String tp,Timestamp ts)
         String updatePurchase = "UPDATE store SET smallWhite=?,medWhite=?,lrgWhite=?,xlrgWhite=?,xxlrgWhite=?,smallBlue=?,medBlue=?,lrgBlue=?,xlrgBlue=?,xxlrgBlue=?,totalQty=?,totalPrice=?,ot=? WHERE playerNo='"+userId+"'";
         try{
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
             objConn = java.sql.DriverManager.getConnection("jdbc:odbc:myDB","","");
             PreparedStatement ps = objConn.prepareStatement(updatePurchase);
             ps.setString(1, ws);
             ps.setString(2, wm);
             ps.setString(3, wl);
             ps.setString(4, wx);
             ps.setString(5, wxx);
             ps.setString(6, bs);
             ps.setString(7, bm);
             ps.setString(8, bl);
             ps.setString(9, bx);
             ps.setString(10, bxx);
             ps.setString(11, tq);
             ps.setString(12, tp);
             ps.setTimestamp(13,ts);
             ps.executeUpdate();
             ps.close();
             objConn.close();
                catch (SQLException s)
                    System.err.println("DataBase PROBLEM");
                    s.printStackTrace();
                catch (Exception e)
                        System.err.println("Error in updateStore method");
                        e.printStackTrace();
    } The prepared stmts seem to be "hanging on to" the access(dont laugh)table that the prepared stmt just updated. The reason I know this is because when I try to look at the table in access's design view I get a message saying:
    "Microsoft access
    You cant open the table 'store' for modification.
    A query or form bound to the table is open, you may not have permission to open this table in design view, or another user has the table open.
    If you have opened a query or form bound to this table, close it, and then try again to open the table in design view."
    The only way to open the table in design view is to shut down tomcat and restart.
    Should I be worried about this?
    Am i forgetting to close something in my ps?
    TIA!!

    I use PreparedStatement all the time with Access and never have a problem. The only thing I noticed about your code is that if an exception gets thrown in your method, the close statements won't get executed. This might leave the tables locked. You might want to try moving the close statements into a finally block. That way your statement and connection will get closed if an exception gets thrown or not.

  • Error fetching data from a foxpro db using Oracle Gateway for ODBC

    Hi.
    I have an 10.2.0.1 database an a 11.2.0 Oracle Gateway for ODBC installed and configured.
    The dblink test works fine, I can connect with the foxpro database because if I execute desc centros I can see the
    columns of table centros.
    The problem comes when I try to execute Select * from centros@fox1;
    A syntax error is returned ([Microsoft][ODBC Visual FoxPro Driver]Syntax error. {42000,NativeErr = 200})
    I paste down the output of the trace file with HS_FDS_TRACE_LEVEL=255
    If I run select codcen from centros@fox1; another error is shown. Tell me if you want the other trace file.
    select codcen from centros@fox1
    ERROR en lÝnea 1:
    ORA-00904: "CODCEN": identificador no vßlido
    Oracle Corporation --- JUEVES MAY 31 2012 13:11:24.765
    Heterogeneous Agent Release
    11.2.0.1.0
    Oracle Corporation --- JUEVES MAY 31 2012 13:11:24.750
    Version 11.2.0.1.0
    Entered hgogprd
    HOSGIP for "HS_FDS_TRACE_LEVEL" returned "255"
    Entered hgosdip
    setting HS_OPEN_CURSORS to default of 50
    setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
    setting HS_FDS_RECOVERY_PWD to default value
    setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
    setting HS_IDLE_TIMEOUT to default of 0
    setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
    setting HS_NLS_NCHAR to default of "UCS2"
    setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
    setting HS_FDS_DATE_MAPPING to default of "DATE"
    setting HS_RPC_FETCH_REBLOCKING to default of "ON"
    setting HS_FDS_FETCH_ROWS to default of "100"
    setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
    setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
    setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
    setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
    setting HS_FDS_MAP_NCHAR to default of "TRUE"
    setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
    setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
    setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
    setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
    setting HS_FDS_QUERY_DRIVER to default of "TRUE"
    setting HS_FDS_SUPPORT_STATISTICS to default of "FALSE"
    Parameter HS_FDS_QUOTE_IDENTIFIER is not set
    setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
    setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
    setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
    Default value of 32 assumed for HS_FDS_SQLLEN_INTERPRETATION
    setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
    setting HS_FDS_DELAYED_OPEN to default of "TRUE"
    setting HS_FDS_WORKAROUNDS to default of "0"
    Exiting hgosdip, rc=0
    ORACLE_SID is "DAVID"
    Product-Info:
    Port Rls/Upd:1/0 PrdStat:0
    Agent:Oracle Database Gateway for ODBC
    Facility:hsa
    Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:DAVID
    Exiting hgogprd, rc=0
    hostmstr: 2057416704:      HOA After hoagprd
    hostmstr: 2057416704:      HOA Before hoainit
    Entered hgoinit
    HOCXU_COMP_CSET=1
    HOCXU_DRV_CSET=178
    HOCXU_DRV_NCHAR=1000
    HOCXU_DB_CSET=178
    HOCXU_SEM_VER=102000
    Entered hgolofn at 2012/05/31-13:11:25
    Exiting hgolofn, rc=0 at 2012/05/31-13:11:25
    HOSGIP for "HS_OPEN_CURSORS" returned "50"
    HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
    HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
    HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
    HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
    HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
    HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
    HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
    HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
    Invalid value of 32 given for HS_FDS_SQLLEN_INTERPRETATION
    treat_SQLLEN_as_compiled = 1
    Exiting hgoinit, rc=0 at 2012/05/31-13:11:25
    hostmstr: 2057416704:      HOA After hoainit
    hostmstr: 2057416704:      HOA Before hoalgon
    Entered hgolgon at 2012/05/31-13:11:25
    reco:0, name:SYSTEM, tflag:0
    Entered hgosuec at 2012/05/31-13:11:25
    Exiting hgosuec, rc=0 at 2012/05/31-13:11:25
    HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
    HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
    HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
    HOSGIP for "HS_FDS_CHARACTER_SEMANTICS" returned "FALSE"
    HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
    HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
    HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
    HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
    HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
    using SYSTEM as default value for "HS_FDS_DEFAULT_OWNER"
    HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
    Entered hgocont at 2012/05/31-13:11:25
    HS_FDS_CONNECT_INFO = "Prueba_Foxpro"
    RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
    Entered hgogenconstr at 2012/05/31-13:11:25
    dsn:Prueba_Foxpro, name:SYSTEM
    optn:
    Entered hgocip at 2012/05/31-13:11:25
    dsn:Prueba_Foxpro
    Exiting hgocip, rc=0 at 2012/05/31-13:11:25
    ##>Connect Parameters (len=39)<##
    ## DSN=Prueba_Foxpro;
    #! UID=SYSTEM;
    #! PWD=*
    Exiting hgogenconstr, rc=0 at 2012/05/31-13:11:25
    Entered hgopoer at 2012/05/31-13:11:26
    hgopoer, line 233: got native error 0 and sqlstate 01000; message follows...
    [*Microsoft][Administrador de controladores ODBC] El controlador no admite una versión de ODBC distinta de la que la necesita la aplicación (vea SQLSetEnvAttr)*. {01000}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:26
    hgocont, line 2686: calling SqlDriverConnect got sqlstate 01000
    Entered hgolosf at 2012/05/31-13:11:26
    ODBC Function-Available-Array 0xFFFE 0x00FF 0xFF00 0xAA7F 0x03B3 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0x0000 0x0000 0x0000 0x0000
    0x0000 0x0000 0xEE00 0x395C
    Exiting hgolosf, rc=0 at 2012/05/31-13:11:26
    DriverName:VFPODBC.DLL, DriverVer:06.86.0001
    DBMS Name:Visual FoxPro, DBMS Version:03.00.0000
    Exiting hgocont, rc=0 at 2012/05/31-13:11:26 with error ptr FILE:hgocont.c LINE:2686 ID:SQLDriverConnect
    Entered hgopoer at 2012/05/31-13:11:26
    hgopoer, line 233: got native error 0 and sqlstate HYC00; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Driver not capable {HYC00}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:26
    hgolgon, line 795: calling SQLGetInfo got sqlstate HYC00
    SQLGetInfo returns N for SQL_CATALOG_NAME
    Exiting hgolgon, rc=0 at 2012/05/31-13:11:26 with error ptr FILE:hgolgon.c LINE:795 ID:GetInfo: Support catalogs
    hostmstr: 2036506624:      HOA After hoalgon
    RPC Calling nscontrol(0), rc=0
    hostmstr: 2036506624: RPC Before Upload Caps
    hostmstr: 2036506624:      HOA Before hoaulcp
    Entered hgoulcp at 2012/05/31-13:11:26
    Entered hgowlst at 2012/05/31-13:11:26
    Exiting hgowlst, rc=0 at 2012/05/31-13:11:26
    SQLGetInfo returns 0x0 for SQL_OWNER_USAGE
    TXN Capable:1, Isolation Option:0x2
    SQLGetInfo returns 0 for SQL_MAX_SCHEMA_NAME_LEN
    SQLGetInfo returns 128 for SQL_MAX_TABLE_NAME_LEN
    SQLGetInfo returns 0 for SQL_MAX_PROCEDURE_NAME_LEN
    SQLGetInfo returns ` (0x60) for SQL_IDENTIFIER_QUOTE_CHAR
    SQLGetInfo returns Y for SQL_COLUMN_ALIAS
    16 instance capabilities will be uploaded
    capno:1964, context:0x00000000, add-info: 0
    capno:1989, context:0x00000000, add-info: 0
    capno:1991, context:0x0001ffff, add-info: 0
    capno:1992, context:0x0001ffff, add-info: 1, translation:"`"
    capno:3042, context:0x00000000, add-info: 0, translation:"42"
    capno:3047, context:0x00000000, add-info: 0, translation:"57"
    capno:3049, context:0x00000000, add-info: 0, translation:"59"
    capno:3050, context:0x00000000, add-info: 0, translation:"60"
    capno:3066, context:0x00000000, add-info: 0
    capno:3067, context:0x00000000, add-info: 0
    capno:3068, context:0x00000000, add-info: 0
    capno:3069, context:0x00000000, add-info: 0
    capno:3500, context:0x00000001, add-info: 91, translation:"42"
    capno:3501, context:0x00000001, add-info: 93, translation:"57"
    capno:3502, context:0x00000001, add-info: 107, translation:"59"
    capno:3503, context:0x00000001, add-info: 110, translation:"60"
    Exiting hgoulcp, rc=0 at 2012/05/31-13:11:26
    hostmstr: 2036506624:      HOA After hoaulcp
    hostmstr: 2036506624: RPC After Upload Caps
    hostmstr: 2036506624: RPC Before Upload DDTR
    hostmstr: 2036506624:      HOA Before hoauldt
    Entered hgouldt at 2012/05/31-13:11:27
    NO instance DD translations were uploaded
    Exiting hgouldt, rc=0 at 2012/05/31-13:11:27
    hostmstr: 2036506624:      HOA After hoauldt
    hostmstr: 2036506624: RPC After Upload DDTR
    hostmstr: 2036506624: RPC Before Begin Trans
    hostmstr: 2036506624:      HOA Before hoabegn
    Entered hgobegn at 2012/05/31-13:11:27
    tflag:0 , initial:1
    hoi:0x12f094, ttid (len 54) is ...
    00: 54455354 2E524547 52455353 2E524442 [TEST.REGRESS.RDB]
    10: 4D532E44 45562E55 532E4F52 41434C45 [MS.DEV.US.ORACLE]
    20: 2E434F4D 2E663033 63383037 372E392E [.COM.f03c8077.9.]
    30: 34342E37 3735 [44.775]
    tbid (len 10) is ...
    0: 09002C00 07030000 0104 [..,.......]
    Exiting hgobegn, rc=0 at 2012/05/31-13:11:27
    hostmstr: 2036506624:      HOA After hoabegn
    hostmstr: 2036506624: RPC After Begin Trans
    hostmstr: 2036506624: RPC Before Describe Table
    hostmstr: 2036506624:      HOA Before hoadtab
    Entered hgodtab at 2012/05/31-13:11:27
    count:1
    table: CENTROS
    Entered hgopdsc at 2012/05/31-13:11:27
    Describing procedure CENTROS
    Output hoada
    hgopdsc, line 1426: NO hoada to print
    Exiting hgopdsc, rc=942 at 2012/05/31-13:11:27
    The hoada for table CENTROS follows...
    hgodtab, line 904: NO hoada to print
    Exiting hgodtab, rc=0 at 2012/05/31-13:11:27
    hostmstr: 2036506624:      HOA After hoadtab
    hostmstr: 2036506624: RPC After Describe Table
    hostmstr: 2036506624: RPC Before SQL Bundling
    hostmstr: 2036506624:      HOA Before hoxpars
    Entered hgopars, cursor id 1 at 2012/05/31-13:11:27
    type:0
    SQL text from hgopars, id=1, len=23 ...
    00: 53454C45 4354202A 2046524F 4D202243 [SELECT * FROM "C]
    10: 454E5452 4F5322 [ENTROS"]
    Exiting hgopars, rc=0 at 2012/05/31-13:11:28
    hostmstr: 2036506624:      HOA After hoxpars
    hostmstr: 2036506624: RPC After SQL Bundling
    hostmstr: 2036506624: RPC Before SQL Bundling
    hostmstr: 2036506624:      HOA Before hoxopen
    Entered hgoopen, cursor id 1 at 2012/05/31-13:11:28
    hgoopen, line 87: NO hoada to print
    Deferred open until first fetch.
    Exiting hgoopen, rc=0 at 2012/05/31-13:11:28
    hostmstr: 2036506624:      HOA After hoxopen
    hostmstr: 2036506624:      HOA Before hoxdscr
    Entered hgodscr, cursor id 1 at 2012/05/31-13:11:28
    Allocate hoada @ 023E983C
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]*Descriptor type out of range* {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:1(codcen): dtype:1 (CHAR), prc/scl:8/0, nullbl:0, octet:8, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:2(litcen): dtype:1 (CHAR), prc/scl:45/0, nullbl:0, octet:45, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:3(codpos): dtype:1 (CHAR), prc/scl:5/0, nullbl:0, octet:5, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:4(codprov): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:5(codmun): dtype:1 (CHAR), prc/scl:3/0, nullbl:0, octet:3, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:6(codecol): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:7(codesin): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:8(cb): dtype:1 (CHAR), prc/scl:4/0, nullbl:0, octet:4, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:9(cs): dtype:1 (CHAR), prc/scl:4/0, nullbl:0, octet:4, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:10(digitocon): dtype:1 (CHAR), prc/scl:2/0, nullbl:0, octet:2, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:11(cuenta): dtype:1 (CHAR), prc/scl:10/0, nullbl:0, octet:10, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopcda at 2012/05/31-13:11:28
    Column:12(solar): dtype:2 (NUMERIC), prc/scl:5/0, nullbl:0, octet:10, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopcda at 2012/05/31-13:11:28
    Column:13(construido): dtype:2 (NUMERIC), prc/scl:5/0, nullbl:0, octet:10, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:14(domicen): dtype:1 (CHAR), prc/scl:40/0, nullbl:0, octet:40, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:15(telef): dtype:1 (CHAR), prc/scl:11/0, nullbl:0, octet:11, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:16(fax): dtype:1 (CHAR), prc/scl:11/0, nullbl:0, octet:11, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:17(cif): dtype:1 (CHAR), prc/scl:11/0, nullbl:0, octet:11, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Descriptor type out of range {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    Entered hgopcda at 2012/05/31-13:11:28
    Column:18(litloc): dtype:1 (CHAR), prc/scl:30/0, nullbl:0, octet:30, sign:1, radix:0
    Exiting hgopcda, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 910: Printing hoada @ 023E983C
    MAX:18, ACTUAL:18, BRC:100, WHT=5 (SELECT_LIST)
    hoadaMOD bit-values found (0x200:TREAT_AS_CHAR)
    DTY NULL-OK LEN MAXBUFLEN PR/SC CST IND MOD NAME
    1 CHAR N 8 8 0/ 0 0 0 200 codcen
    1 CHAR N 45 45 0/ 0 0 0 200 litcen
    1 CHAR N 5 5 0/ 0 0 0 200 codpos
    1 CHAR N 2 2 0/ 0 0 0 200 codprov
    1 CHAR N 3 3 0/ 0 0 0 200 codmun
    1 CHAR N 2 2 0/ 0 0 0 200 codecol
    1 CHAR N 2 2 0/ 0 0 0 200 codesin
    1 CHAR N 4 4 0/ 0 0 0 200 cb
    1 CHAR N 4 4 0/ 0 0 0 200 cs
    1 CHAR N 2 2 0/ 0 0 0 200 digitocon
    1 CHAR N 10 10 0/ 0 0 0 200 cuenta
    3 DECIMAL N 7 7 5/ 0 0 0 0 solar
    3 DECIMAL N 7 7 5/ 0 0 0 0 construido
    1 CHAR N 40 40 0/ 0 0 0 200 domicen
    1 CHAR N 11 11 0/ 0 0 0 200 telef
    1 CHAR N 11 11 0/ 0 0 0 200 fax
    1 CHAR N 11 11 0/ 0 0 0 200 cif
    1 CHAR N 30 30 0/ 0 0 0 200 litloc
    Exiting hgodscr, rc=0 at 2012/05/31-13:11:28 with error ptr FILE:hgodscr.c LINE:615 ID:Transfer Octet Length
    hostmstr: 2036506624:      HOA After hoxdscr
    hostmstr: 2036506624: RPC After SQL Bundling
    hostmstr: 2036506624: RPC Before SQL Bundling
    hostmstr: 2036506624:      HOA Before hoxclse
    Entered hgoclse, cursor id 1 at 2012/05/31-13:11:28
    Exiting hgoclse, rc=0 at 2012/05/31-13:11:28
    hostmstr: 2036506624:      HOA After hoxclse
    hostmstr: 2036506624:      HOA Before hoadafr
    Entered hgodafr, cursor id 1 at 2012/05/31-13:11:28
    Free hoada @ 023E983C
    Exiting hgodafr, rc=0 at 2012/05/31-13:11:28
    hostmstr: 2036506624:      HOA After hoadafr
    hostmstr: 2036506624:      HOA Before hoxpars
    Entered hgopars, cursor id 1 at 2012/05/31-13:11:28
    type:0
    SQL text from hgopars, id=1, len=235 ...
    00: 53454C45 43542041 312E2263 6F646365 [SELECT A1."codce]
    10: 6E222C41 312E226C 69746365 6E222C41 [n",A1."litcen",A]
    20: 312E2263 6F64706F 73222C41 312E2263 [1."codpos",A1."c]
    30: 6F647072 6F76222C 41312E22 636F646D [odprov",A1."codm]
    40: 756E222C 41312E22 636F6465 636F6C22 [un",A1."codecol"]
    50: 2C41312E 22636F64 6573696E 222C4131 [,A1."codesin",A1]
    60: 2E226362 222C4131 2E226373 222C4131 [."cb",A1."cs",A1]
    70: 2E226469 6769746F 636F6E22 2C41312E [."digitocon",A1.]
    80: 22637565 6E746122 2C41312E 22736F6C ["cuenta",A1."sol]
    90: 6172222C 41312E22 636F6E73 74727569 [ar",A1."construi]
    A0: 646F222C 41312E22 646F6D69 63656E22 [do",A1."domicen"]
    B0: 2C41312E 2274656C 6566222C 41312E22 [,A1."telef",A1."]
    C0: 66617822 2C41312E 22636966 222C4131 [fax",A1."cif",A1]
    D0: 2E226C69 746C6F63 22204652 4F4D2022 [."litloc" FROM "]
    E0: 43454E54 524F5322 204131 [CENTROS" A1]
    Entered hgopoer at 2012/05/31-13:11:28
    hgopoer, line 233: got native error 200 and sqlstate 42000; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]Syntax error. {42000,NativeErr = 200}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgopars, line 457: calling SQLPrepare got sqlstate 42000
    Exiting hgopars, rc=28500 at 2012/05/31-13:11:28 with error ptr FILE:hgopars.c LINE:487 ID:Prepare stmt
    hostmstr: 2036506624:      HOA After hoxpars
    hostmstr: 2036506624: RPC After SQL Bundling

    The first issue I see is that Oracle 10.2.0.1 was never certified with DG4ODBC 11. Only 10.2.0.4 or 10.2.0.5 can be used as the Oracle database HS kernel requires a gateway compatibility patch and this patch is included in 10.2.0.4 or 10.2.0.5 Oracle database patch set.
    Then another error in the trace is that for each column description you have an error:
    hgopoer, line 233: got native error 0 and sqlstate HY091; message follows...
    [Microsoft][ODBC Visual FoxPro Driver]*Descriptor type out of range* {HY091}
    Exiting hgopoer, rc=0 at 2012/05/31-13:11:28
    hgodscr, line 615: calling SQLColAttribute got sqlstate HY091
    It seems it is not critical as DG4ODBC continues, but a more detailed analysis would require an ODBC trace.
    When looking at the table description it seems the column names are all in lower letters, for example: solar. So commonly Dg4ODBC needs to quote the names
    00: 53454C45 43542041 312E2263 6F646365 [SELECT A1."codce]
    10: 6E222C41 312E226C 69746365 6E222C41 [n",A1."litcen",A]
    20: 312E2263 6F64706F 73222C41 312E2263 [1."codpos",A1."c]
    30: 6F647072 6F76222C 41312E22 636F646D [odprov",A1."codm]
    40: 756E222C 41312E22 636F6465 636F6C22 [un",A1."codecol"]
    50: 2C41312E 22636F64 6573696E 222C4131 [,A1."codesin",A1]
    60: 2E226362 222C4131 2E226373 222C4131 [."cb",A1."cs",A1]
    70: 2E226469 6769746F 636F6E22 2C41312E [."digitocon",A1.]
    80: 22637565 6E746122 2C41312E 22736F6C ["cuenta",A1."sol]
    90: 6172222C 41312E22 636F6E73 74727569 [ar",A1."construi]
    A0: 646F222C 41312E22 646F6D69 63656E22 [do",A1."domicen"]
    B0: 2C41312E 2274656C 6566222C 41312E22 [,A1."telef",A1."]
    C0: 66617822 2C41312E 22636966 222C4131 [fax",A1."cif",A1]
    D0: 2E226C69 746C6F63 22204652 4F4D2022 [."litloc" FROM "]
    E0: 43454E54 524F5322 204131 [CENTROS" A1]
    and according to the trace the FoxPro ODBC driver doesn't like these quotes and reports a syntax error.
    So this explains at least why select codcen from centros@fox1 will fail. In general the Oracle database is case insensitive and translates all object names to upper case and the select it will pass to the foreign database would be similar to:
    select CODCEN from CENTROS => which will fail as FoxPro is case sensitive. So the error message ORA-00904 (missing column name) is correct and the statement you need to use is:
    select "codcen" from centros@fox1;
    But this might lead again to the Syntax error you got earlier => You need to check which sign (single quote, back tick, double quote) Foxpro uses to quote object names and then set the gateway parameter HS_FDS_QUOTE_IDENTIFIER accordingly.
    To check which character can be used to quote column/table names you might use the Microsoft ODBc test utility which was distributed in the old MDAC 2.8:
    http://www.microsoft.com/downloads/details.aspx?familyid=5067faf8-0db4-429a-b502-de4329c8c850&displaylang=en
    Edited by: kgronau on Jun 1, 2012 7:27 AM
    If you know where I can download the MS FoxPro ODBC driver, please let me know and I'll check.

  • How to create a procedure in oracle to write the data into file

    Hi All,
    I am just wondered on how to create a procedure which will do following tasks:
    1. Concat the field names
    2. Union all the particular fields
    3. Convert the date field into IST
    4. Prepare the statement
    5. write the data into a file
    Basically what I am trying to achieve is to convert one mysql proc to oracle. MySQL Proc is as follows:
    DELIMITER $$
    USE `jioworld`$$
    DROP PROCEDURE IF EXISTS `usersReport`$$
    CREATE DEFINER=`root`@`%` PROCEDURE `usersReport`(IN pathFile VARCHAR(255),IN startDate TIMESTAMP,IN endDate TIMESTAMP )
    BEGIN
    SET @a= CONCAT("(SELECT 'User ID','Account ID','Gender','Birthdate','Account Registered On') UNION ALL (SELECT IFNULL(a.riluid,''),IFNULL(a.rilaccountid,''),IFNULL(a.gender,''),IFNULL(a.birthdate,''),IFNULL(CONVERT_TZ(a.creationDate,'+0:00','+5:30'),'') INTO OUTFILE '",pathFile,"' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM account_ a where a.creationDate>='",startDate,"' and a.creationdate <='",endDate,"')");
    PREPARE stmt FROM @a;
    EXECUTE stmt;
    DEALLOCATE PREPARE stmt ;
    END$$
    DELIMITER ;
    Regards,
    Vishal G

    1. Concat the field names
    Double Pipe (||) is the concatenation operator in Oracle. There is also a function CONCAT for this purpose
    2. Union all the particular fields
    Not sure what do you mean by UNION ALL particular fields? UNION ALL is a set operation applied on two different result sets that have the same projection.
    3. Convert the date field into IST
    SQL> select systimestamp "Default Time"
      2       , systimestamp at time zone 'Asia/Calcutta' "IST Time"
      3    from dual;
    Default Time                                       IST Time
    05-05-15 03:14:52.346099 AM -04:00                 05-05-15 12:44:52.346099 PM ASIA/CALCUTTA
    4. Prepare the statement
    What do you mean by prepare the statement?
    5. write the data into a file
    You can use the API UTL_FILE to write to a file.

  • Getting Error:::oracle.jbo.domain.Date cannot be cast to java.lang.String

    Hi Friends,
    I have simple req'.
    i have one date filed in OAF page...if user has change the date filed..means if he incresed by 2 days..then i need to call one procedure..if not no need to call....
    first am picking that date field to by uusing prepared stmt and putting in to one variable..like below
    try {
    ps1 = am.getOADBTransaction().getJdbcConnection().prepareStatement("SELECT -------");
    ResultSet rs2 = ps1.executeQuery();
    while (rs2.next()) {
    schDate = rs2.getString(1);//storing the value
    } catch (Exception e) {
    throw OAException.wrapperException(e);
    Next..am picking the current value like this(user can change the value) like below...
    OAViewObject viewObj = (OAViewObject)am.findViewObject("simpleVO");
    String currSchDate = (String)viewObj.getCurrentRow().getAttribute("iDate");
    java.text.SimpleDateFormat dtFormat = new java.text.SimpleDateFormat ("MM/dd/yyyy");
    StringBuilder date = new StringBuilder(dtFormat.format(currSchDate));
    Then am comparing the values like below..
    if (schDate.equals(date)) {
    String outParamValue = "";
    String secondOutParamValue = "";
    but am geting the below error
    ## Detail 0 ##
    java.lang.ClassCastException: oracle.jbo.domain.Date cannot be cast to java.lang.String
         at xxuss.oracle.apps.abc.webui.xxPGCO15.processFormRequest(xxGCO15.java:594)
    Appriciate any help...its very urgent
    Regards
    Harry

    Instead of :
    String currSchDate = (String)viewObj.getCurrentRow().getAttribute("iDate");Try
    String currSchDate = viewObj.getCurrentRow().getAttribute("iDate").toString();
    -Anand

  • Is FAN ONS Publisher working?

    I have a single-instance (non-RAC) primary/physical standby configuration (V10.2.0.4). SID names: dbddg1t and dbddg2t
    I am following the MAA whitepaper: Client Failover Best Practices...etc..
    to setup the FAN ONS Publisher program to notify my JDBC-Thin client of the FAN event. The JDBC Thin client automatic reconnect is not working... so I'm making sure that the FAN ONS on the database side is working while my developer debugs the client side.
    Here's my cfo.sh script:
    #!/bin/ksh
    export CFO_DEBUG=TRUE
    export ORACLE_SID=dbddg1t
    export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    export LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/db_1/lib
    export PATH=$ORACLE_HOME/bin:$PATH
    /u01/app/oracle/product/10.2.0/db_1/bin/cfo r
    And the Trigger that calls it:
    CREATE OR REPLACE TRIGGER ons_JDBCpublish
    after DB_ROLE_CHANGE on
    DATABASE
    BEGIN
    dbms_scheduler.create_job(
    job_name => 'publish_events',
    job_type => 'EXECUTABLE',
    job_action => '/u01/app/oracle/product/10.2.0/db_1/bin/cfo.sh',
    enabled => true
    END;
    The output of cfo_dbddg1t.log from the last "switchover" test from dbddg2t to dbddg1t:
    2010/08/04 04:23:48 Start : Run
    config file = /u01/app/oracle/product/10.2.0/db_1/dbs/cfodbddg1t.ora
    2010/08/04 04:23:48 basic pre-reqs met
    Create Environment
    Allocate Error Handle
    Allocate Server Context
    Create server attach
    Allocate service handle
    set server attrib
    Allocate user session
    Set username
    Set password
    Set user session attribute in the service context
    Allocating stmt
    Preparing stmt
    Execute stmt
    local db_unique_name = dbddg1t
    Allocating role stmt
    Preparing stmt
    Execute stmt
    Allocating time stmt
    Preparing stmt
    Execute stmt
    Run-mode execution allowed only after recent switchover
    2010/08/04 04:23:48 Pre Requisites not met
    Exiting with error code 4
    The job scheduler shows that the job failed with:
    ORA-27369: job of type EXECUTABLE failed with exit code: Operation not permitted STANDARD_ERROR="log file = /u01/app/oracle/product/10.2.0/db_1/rdbms/log/cfo_dbddg1t.log Run-mode execution allowed only after recent switchover"
    Does the output from cfo log above look correct? Why does it get the error at the end "Run-mode execution allowed only after recent switchover"?
    Is this a question for MyOracleSupport? Just curious if anyone has this working.
    Thanks

    Hi
    Please update the Bios on the unit that might help you to fix your issue. Incase this does not work please call HP Technical support check the warranty and get the part replaced.
    Let us know how it goes!
    "I work for HP."
    ****Click the (purple thumbs up icon in the lower right corner of a post) to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    Regards
    Manjunath

  • ORA-01461 error

    Hi, all
    I am loading data in csv format into the Oracle 9i table. I can proceed with one a few lines, but end up with "ORA-01461 can bind a LONG value only for insert into a LONG column" error message. When I uncomment the setSQL call in earch loop, I got my job done with no complain. I wonder is there something wrong with my source code, or repeatedly bind and execute on a prepared statement are just disallowed.
    The csv data is something like:
    4409020,xxxxxx,6578B,,
    9901400,xxxxx,11CBM,,
    4447130,xxxx,6578H,,
    And the C++ source:
    PFile file("data.csv");
    int colCount = 5;
    int colTypes[] = {
         occi::OCCI_SQLT_CHR,
         occi::OCCI_SQLT_CHR,
         occi::OCCI_SQLT_CHR,
         occi::OCCI_SQLT_CHR,
         occi::OCCI_SQLT_NUM
    int count = 0;
    PString line;
    PStringArray fields;
    // prepare
    stmt->setSQL("INSERT INTO m_pckk_hatyu VALUES (:1,:2,:3,:4,:5)");
    while (file.ReadLine(line)) {
         //stmt->setSQL((const char *)sql);
         fields = line.Tokenise(",", TRUE);
         csvColCount = fields.GetSize();
         if (colCount != csvColCount) {
              cout << "Skip line " << (count+1) << ": " << line << endl;
              continue;
         // bind
         for (int j=0; j<colCount; j++) {
              if (colTypes[j] == occi::OCCI_SQLT_NUM) {                         // number
                   stmt->setNumber(j+1, occi::Number(fields[j].AsReal()));
              } else if (colTypes[j] == occi::OCCI_SQLT_CHR) {               // varchar2
                   stmt->setString(j+1, (const char *)fields[j]);
         // execute
         count += stmt->executeUpdate();

    When you are dealing with long varchars, try using the stmt->setMaxParamSize(index, maxSize) API. i beleive oracle has some predefined optimized sizes for the bind variables. Here the index is the index of the bind variable and the maxSize is the size of the varchar.

  • How to get the real SQL statement from a preparedstatement?

    Hi,
    I am trying to log the actual SQL sent to database by the preparedStatement. Since the original SQL I used to prepare the statement has a lot of "?" in it, after setting all the parameters in the preparedStatement, I want to get the final SQL statement executed. Is there a way to get it? Probably the SQL will depend on different drivers.
    Thanks in advance.

    Thanks, changhsu. I tried the tracing technique. But it only prints out the original SQL statement sent to the preparedStatement. The following is part of the log file:
    ======================================================================
    --------NetDirect JSQLConnect Version:2.2708--------
    2002-04-10 14:23:54.818 (1) Connection attempt number 1 Connection ID:1 for host:perseus
    2002-04-10 14:23:55.429 (1) JSQLConnect(2.2708) Trial license - expires on:Thu Apr 25 17:47:32 CDT 2002, unlimited connections
    2002-04-10 14:23:55.449 (2) Connection allocated from pool ID:2
    2002-04-10 14:23:55.72 (2) [Thread[Thread-6,5,main], IO:88cb4, Dbc:1346]] SELECT SHARED_DRIVES FROM EPM_PREFS WHERE PRODUCT='PE'
    2002-04-10 14:23:57.913 (2) Connection closed and returned to connection pool ID:2
    2002-04-10 14:23:58.193 (3) Connection attempt number 2 Connection ID:3 for host:perseus database:epm20 SQL6.5:false
    2002-04-10 14:23:58.203 (3) [Thread[Thread-6,5,main], IO:88cb3, Dbc:1347]] use epm20 set quoted_identifier,ansi_null_dflt_on,ansi_padding on set textsize 2147483647 set transaction isolation level read committed set implicit_transactions off
    2002-04-10 14:24:00.356 (4) Connection allocated from pool ID:4
    2002-04-10 14:24:01.168 (4) [Not Loged In@localhost, IO:88cb2, Dbc:1347]] PreparedStatement::prepare stmt:SELECT PASSWD FROM RESOURCE_INFO WHERE USER_ID=? AND DELETE_FLG IS NULL
    2002-04-10 14:24:01.448 (4) [Not Loged In@localhost, IO:88cb2, Dbc:1347]] RPC:sp_prepare
    2002-04-10 14:24:01.488 (4) [Not Loged In@localhost, IO:88cb2, Dbc:1347]] RPC:sp_execute
    =======================================================================
    I did not try to trace in SQL Server 7. I will have to find out how to do that first.
    Thanks again.

  • When to use PreparedStatement.close()

    Hi,
    For a long time I was/am convinced that it is good to use prepared statement eventhough you are not going to use them propertly, cause whenever in the future you are going to modify your code to use your connections wisely along with prepared statements it will save you valuble execution time.
    I have following enviornment....
    Miscrosoft SQL Server 2000 driver for JDBC
    Jakarta-Commons DBCP (have prepared stmt pooling on)
    Tomcat as the web app.
    (I would not like to use Tomcat's internal CPooling cause we may have to migrate to some other app server and then the installation process and everything should have been changed.)
    Now to the actuall question.... in a transacation I have 2 to 3 different sets of queries (some SELECTs, some UPDATEs and some INSERTs)
    say I have QUERY1 , a SELECT query and QUERY2 an UPDATE query in a transaction T1. Will following code utilize features of PreaparedStatement properly??
    String q1 = QUERY1;
    String q2 = QUERY2;
    PreparedStmt pStmt = null;
    pStmt = conn.prepareStatement(q1);
    rs = pStmt.executeQuery();
    Object obj1 = processRS (rs);
    pStmt = conn.prepareStatement(q2);
    myint = pStmt.executeUpdate();
    pStmt.close();Do I need to have "pStmt.close()" btw "Object obj1 = processRS (rs);" and "pStmt = conn.prepareStatement(q2);"?
    Thanks a lot.

    >>
    Do I need to have "pStmt.close()" btw "Object obj1 =
    processRS (rs);" and "pStmt =
    conn.prepareStatement(q2);"?Yes.
    And you need to close the ResultSets as well.
    And you need proper exception handling to handling
    closing all of them if an exception occurs.
    Won't "pStmt.close()" will also close the result set if any?
    And yes I am aware that I need to take care of closing it properly in case of any exception.
    Thanks a lot for your response.

  • Debugging Oracle Driver

    We are using version 10.1.0.4 of Oracles thin driver on WLS 8.1 SP4. I would like to get some debug logging out of the driver as we are experiencing some strange behaviour with a query for certain users even though the query executes extremely fast in sqlplus and when using a test app with a t3 connection and a prepared stmt.
    I have the ojdbc14_g.jar at the beginning of my classpath and have checked off jdbc debug logging. I see some output in the log when starting up the server, such as registerDriver, but don't see any activity at all when using our app. Is there something else I need to do?
    Any ideas at all would be greatly appreciated.
    Thanks!
    Lynn

    Thanks for the interest. Here's the test. Let me know what you think. I'll post to Oracle as well.
    Lynn
    import java.io.*;
    import java.sql.*;
    import java.util.Map;
    import java.util.HashMap;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.sql.DataSource;
    public class ParamTest {
    private static final String TEST_UPPER_PARAM =
    "SELECT action.status, action.status_change_datetime status_datetime, action.document_type, " +
    "header.invoice_number document_number, action.document_id, header.invoice_datetime document_datetime, " +
    "header.export_datetime, header.export_flag, header.description, " +
    "DECODE(action.document_type, 'A', header.remit_total, header.submit_total) amount, " +
    "DECODE(action.document_type, 'A', 'IM', DECODE(invoice_type_id, 11, 'OR', 12, 'CR', '')) subtype, " +
    "DECODE(action.custom_br_flag, '1', (select vendor_name from vendor where vendor_id = action.custom_br_rx), " +
    "(select company_name from company where company_id = header.vendor_id)) company_name, " +
    "DECODE(action.customer_group_user_flag, '1', (select u.common_name || ' ' || u.last_name " +
    "from s_user u where user_id = action.customer_rx_id), " +
    "(select g.group_name from s_group g where g.group_id = action.customer_rx_id)) owner_name " +
    "FROM oi_action action, invoice header WHERE action.document_id = header.invoice_id AND action.active_flag = 'A' " +
    "AND action.customer_id = header.customer_id AND (action.customer_site_id IN (11 " +
    //", 22" +
    ")) AND header.customer_id = 33 AND action.document_type = 'A' AND action.status NOT IN ('Saved', 'Cancelled') " +
    "AND upper(header.invoice_number) like ?";
    private static final String TEST_NO_PARAMS =
    "SELECT action.status, action.status_change_datetime status_datetime, action.document_type, " +
    "header.invoice_number document_number, action.document_id, header.invoice_datetime document_datetime, " +
    "header.export_datetime, header.export_flag, header.description, " +
    "DECODE(action.document_type, 'A', header.remit_total, header.submit_total) amount, " +
    "DECODE(action.document_type, 'A', 'IM', DECODE(invoice_type_id, 11, 'OR', 12, 'CR', '')) subtype, " +
    "DECODE(action.custom_br_flag, '1', (select vendor_name from vendor where vendor_id = action.custom_br_rx), " +
    "(select company_name from company where company_id = header.vendor_id)) company_name, " +
    "DECODE(action.customer_group_user_flag, '1', (select u.common_name || ' ' || u.last_name " +
    "from s_user u where user_id = action.customer_rx_id), " +
    "(select g.group_name from s_group g where g.group_id = action.customer_rx_id)) owner_name " +
    "FROM oi_action action, invoice header WHERE action.document_id = header.invoice_id AND action.active_flag = 'A' " +
    "AND action.customer_id = header.customer_id AND (action.customer_site_id IN (11 " +
    //", 22" +
    ")) AND header.customer_id = 33 AND action.document_type = 'A' AND action.status NOT IN ('Saved', 'Cancelled') " +
    "AND upper(header.invoice_number) like 'ABC123%'";
    private PreparedStatement stmt;
    private InitialContext context;
    private DataSource dataSource;
    private Connection connection;
    public static void main(String[] args) {
    try {
    ParamTest pt = new ParamTest();
    } catch(Throwable t) {
    System.err.println("Error:\n" + t.toString());
    public ParamTest() throws Throwable {
    long startTime;
    long endTime;
    Map map = new HashMap();
    Properties props = new Properties();
    props.setProperty("user", "joe");
    props.setProperty("password", "bea");
    props.setProperty("server", "test");
    props.setProperty("SID", "test");
    System.err.print("Using oracle.jdbc.OracleDriver\n");
    Class.forName("oracle.jdbc.OracleDriver");
    this.connection = DriverManager.getConnection("jdbc:oracle:thin:@host:1521:test", "joe", "bea");
    //System.err.print("Using weblogic.jdbc.oracle.OracleDriver\n");
    //Class.forName("weblogic.jdbc.oracle.OracleDriver");
    //this.connection = DriverManager.getConnection("jdbc:bea:oracle://host:1521", props);
    System.err.print("Got Connection\n");
    //this.stmt = connection.prepareStatement(TEST_NO_PARAMS);
    this.stmt = connection.prepareStatement(TEST_UPPER_PARAM);
    System.err.print("setting params\n");
    this.stmt.setObject(1, "ABC123"));
    System.err.print("done with params\n");
    startTime = System.currentTimeMillis();
    this.stmt.execute();
    ResultSet rs = stmt.getResultSet();
    while(rs.next()) {
    System.err.print(".");
    map.put(rs.getString(1), "found");
    endTime = System.currentTimeMillis();
    System.out.println("Time: " + (endTime - startTime));
    System.out.println("Found: " + (map));
    }

Maybe you are looking for

  • Standard report  for unit of measures

    Is there any standard report to see the Fert material unit of measures  and its alternate unit of measures.

  • Performance with select in Start routine

    Hi, I open a request because i have some troubles in a update rules. In this update rule i have several select function on master data and i takes just 3-4 minutes by packets (which is OK for my daily extraction). But my users needs now a data taht i

  • How to disable -xarch warning?

    If I compile with -xarch=native, I get: CC: Warning: -xarch=native has been explicitly specified, or implicitly specified by a macro option, -xarch=native on this architecture implies -xarch=sparcvis2 which generates code that does not run on pre Ult

  • Getting the end point to end point connections paths that exist from Switch Exe

    Can I query the Switch Exe data base and get a list of the existing paths that Switch EXE has connected? I have a debug app that reads the channel names (via a property node) and present them to the operator to manually connect and disconnect paths u

  • How to specify in TS unsigned long? unsigned short?

    Hi, I'm lusing a c/c++ step type from TestStand. I need to use a structure whose fields according to the h file of the dll are: unsigned char unsigned long unsigned short Now, when I define a container in TestStand (to interface with the dll structur