Mapping JDBC and SQL types

Hi, I've got the following problem - I write program that communicates with PostgreSQL-Server. Everything is ok, but the database has been designed not in the best way and there's no way to change it now. Furthermore they have stored procedures that contain specific data types. And I've got the problems with these stored procedures. Look the procedure has a header:
send2db(macaddr, int8, float4, timestamp)
The problem is that I haven't found any compatible JDBC-type for macaddr. And it's not the worst - I don't know how to send arrays. I know that server accepts all these types simply like Strings in the form (for example for _timestamp):
'{"2005-4-15 15:3:4","2005-4-15 15:3:8","2005-4-15 15:3:28"}'
But if I send these Stings, I get the error from the server.
For Java I have the following code:
  CallableStatement cstmn = db.prepareCall("{?=call send2db(?,?,?,?)}");
      cstmn.registerOutParameter(1, Types.INTEGER);
      cstmn.setString(2,macaddr);
      cstmn.setInt(3,verytemp);
      cstmn.setString(4,tvalues_array);
      cstmn.setString(5,date_array);
      cstmn.execute();
      result = cstmn.getInt(1);

Since java extracts away the platform dependence it is less important what platform you work on.
In theory an application (web or not) should work with out modification on a solaris machine a windows pc or even a mac. That is not to say that you would want to run your web server off a mac g4 though. Use the best machine for the job. It is not the machine but all the software that goes with it that matters more.
The database is also much less of a problem because you interact with it through JDBC rather then directly. Hence, in theory (again), you should be able to switch the database and not change any code. This means the choice of SQLServer over Oracle over MySQL is less of an issue again. Databases are not as well extracted as the machine and often you have to change code to switch database but if you understand this from the start even that will mean only minor changes.

Similar Messages

  • One to Many Mapping with different SQL types

    We have an interesting one to many relationship in our system in which the source and target field SQL types do not match, but the values do. The relationship is actually between multiple entries in the same database table. So, imagine we have some table that looks sort of like this:
    KEY ObjectID OwnerNo
    100 1234     0
    101 ABCD     1234
    102 EFGH     1234ObjectID is defined as a varchar type, but Parent entries are guaranteed to have integer value ObjectIDs. Child entries point to the parent through the OwnerNo field, which defined in the database as a numeric.
    A simple one-to-many mapping will give you the following SQL error on execution: [SQL0401] Comparison operator = operands not compatible.
    I tried modifying my descriptor after load as follows:
       public static void modifyOneToMany(Descriptor descriptor)
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField("OwnerNo").
              equal(builder.getField("ObjectID").toNumber());
           descriptor.getMappingForAttributeName("children")
              .setSelectionCriteria(exp);
       }But this introduces two problems in the generated SQL ( ... WHERE ((t0.OwnerNo = TO_NUMBER(t0.ObjectID) ... ). First, this generates a where clause using the function TO_NUMBER, which is not supported by DB2 on AS400, our database platform. Second, the table reference is off in the generated SQL--I couldn't find a way to specify that the right hand side of the = operator should be from the parent of the one to many mapping--both sides are referenced from the child context (t0).

    I found the getFunction() method on Expression, so I can solve half of this problem with the following code:
       public static void modifyOneToMany(Descriptor descriptor)
         if (descriptor.getMappingForAttributeName("children").isOneToManyMapping())
           OneToManyMapping map = (OneToManyMapping) descriptor.
                                  getMappingForAttributeName("children");
           DatabaseField objectID= (DatabaseField) map.getSourceKeyFields().get(0);
           DatabaseField ownerNo = (DatabaseField) map.getTargetForeignKeyFields().get(0);
           ExpressionBuilder builder = new ExpressionBuilder();
           Expression exp = builder.getField(ownerNo).getFunction("CHAR").
                            equal(builder.getField(objectID));
           map.setSelectionCriteria(exp);
       }This generates the following where clause:
    ... WHERE ((CHAR(t0.OwnerNo) = t0.ObjectID) ...
    But, I still have two questions:
    1. How do we get the right hand side of this comparison to reference the Parent part of the 1-M mapping?
    2. Since character and numeric conversions are pretty standard SQL functions, is there something wrong with the DB2 database platform I'm using?

  • Items and SQL Types

    I've just started learning apex and I'm confused about page/application items. Since they can be used in SQL and PL/SQL as some kind of variables (for example using bind variable syntax), at some point they should be prescribed a type, since SQL and PL/SQL are both strongly typed languages.
    It seems that items do have types, see the documentation (http://docs.oracle.com/cd/E11882_01/appdev.112/e11947/bldapp.htm#BCEDCGGH), but I'm not sure how they correspond to SQL types.
    For example I saw that to_date is always used with items of date picker type, implying it is some string SQL type.
    So the question. What SQL type do apex page/application items have, that is what type conversion do I need to use when dealing with items inside SQL and PL/SQL?

    They are all VARCHAR2(4000) as far as I know - all application item are the same and the page items can be set to number or date in addition. Setting it to number or date will only include an internal validation checking if the format is matching the application globalization settings.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • Records and Objects, Cast for PL/SQL Type RECORD and SQL Type OBJECT

    Hi seniors:
    In my job, we have Oracle 10g, programming with Packages, the parameters are PL/SQL Types,
    Example:
    PACKAGE BODY NP_CONTROL_EQUIPMENT_PKG
    IS
    TYPE TR_EQUIPMENT_OPERATION IS RECORD(
    wn_npequipmentoperid CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.npequipmentoperid%TYPE,
    wv_npactiveservicenumber CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.npactiveservicenumber%TYPE,
    wv_npspecification ORDERS.NP_SPECIFICATION.npspecification%TYPE,
    wv_nptype ORDERS.NP_SPECIFICATION.nptype%TYPE,
    wn_nporderid CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.nporderid%TYPE,
    wn_npguidenumber CONTROL_EQUIPMENT.NP_EQUIPMENT_OPERATIONS.npguidenumber%TYPE,
    wd_npdevolutionprogramdate CONTROL_EQUIPMENT.NP_EQUIPMENT_STATUS.npdevolutionprogramdate%TYPE
    TYPE TT_TR_EQUIPMENT_OPERATION_LST IS TABLE OF TR_EQUIPMENT_OPERATION INDEX BY BINARY_INTEGER;
    PROCEDURE SP_GET_EQUIPMENT_OPERATION_LST(
    an_npequipstatid IN CONTROL_EQUIPMENT.NP_EQUIPMENT_STATUS.npequipstatid%TYPE,
    at_equipment_operation_list OUT TT_TR_EQUIPMENT_OPERATION_LST,
    av_message OUT VARCHAR2
    IS
    BEGIN
    SELECT EO.npequipmentoperid,
    EO.npactiveservicenumber,
    S.npspecification,
    S.nptype,
    EO.nporderid,
    EO.npguidenumber,
    ES.npdevolutionprogramdate
    BULK COLLECT INTO at_equipment_operation_list
    FROM NP_EQUIPMENT_OPERATIONS EO,
    NP_EQUIPMENT_STATUS ES,
    ORDERS.NP_ORDER O,
    ORDERS.NP_SPECIFICATION S
    WHERE EO.npequipstatid = ES.npequipstatid
    AND EO.nporderid = O.nporderid
    AND O.npspecificationid = S.npspecificationid
    AND EO.npequipstatid = an_npequipstatid;
    EXCEPTION
    WHEN OTHERS THEN
    av_message := 'NP_CONTROL_EQUIPMENT_PKG.SP_GET_EQUIPMENT_OPERATION_LST: '||SQLERRM;
    END SP_GET_EQUIPMENT_OPERATION_LST;
    END;
    Procedures calls other procedures and passing parameters IN OUT defined that PL/SQL Types. The problem appears when the access is through Java. Java can't read PL/SQL Types because only read SQL Types (Types defined in SCHEMA):
    CREATE OR REPLACE
    TYPE TO_EQUIPMENT_OPERATION AS OBJECT (
    wn_npequipmentoperid NUMBER,
    wv_npactiveservicenumber VARCHAR2(15),
    wv_npspecification VARCHAR2(8),
    wv_nptype VARCHAR2(2),
    wn_nporderid NUMBER,
    wn_npguidenumber NUMBER,
    wd_npdevolutionprogramdate DATE
    CREATE OR REPLACE
    TYPE TT_EQUIPMENT_OPERATION_LST
    AS TABLE OF "CONTROL_EQUIPMENT"."TO_EQUIPMENT_OPERATION"
    Java can read this SQL Types. The problem is how cast OBJECT to RECORD, because I can't execute that:
    DECLARE
    wt_operation_lst TT_EQUIPMENT_OPERATION_LST;
    BEGIN
    SELECT EO.npequipmentoperid,
    EO.npactiveservicenumber,
    S.npspecification,
    S.nptype,
    EO.nporderid,
    EO.npguidenumber,
    ES.npdevolutionprogramdate
    BULK COLLECT INTO wt_operation_lst
    FROM NP_EQUIPMENT_OPERATIONS EO,
    NP_EQUIPMENT_STATUS ES,
    ORDERS.NP_ORDER O,
    ORDERS.NP_SPECIFICATION S
    WHERE EO.npequipstatid = ES.npequipstatid
    AND EO.nporderid = O.nporderid
    AND O.npspecificationid = S.npspecificationid
    AND EO.npequipstatid = an_npequipstatid;
    END;
    and throws NOT ENOUGH VALUES, and I modified to:
    DECLARE
    wt_operation_lst TT_EQUIPMENT_OPERATION_LST;
    BEGIN
    SELECT TO_EQUIPMENT_OPERATION(EO.npequipmentoperid,
    EO.npactiveservicenumber,
    S.npspecification,
    S.nptype,
    EO.nporderid,
    EO.npguidenumber,
    ES.npdevolutionprogramdate)
    BULK COLLECT INTO wt_operation_lst
    FROM NP_EQUIPMENT_OPERATIONS EO,
    NP_EQUIPMENT_STATUS ES,
    ORDERS.NP_ORDER O,
    ORDERS.NP_SPECIFICATION S
    WHERE EO.npequipstatid = ES.npequipstatid
    AND EO.nporderid = O.nporderid
    AND O.npspecificationid = S.npspecificationid
    AND EO.npequipstatid = an_npequipstatid;
    END;
    Worst is that I can't modify this procedure and PL/SQL Types will survive.
    I have create a copy that CAST RECORD to OBJECT and OBJECT to RECORD too.
    PROCEDURE SP_COPY_PLSQL_TO_SQL(
    an_npequipstatid IN NUMBER,
    at_dominio_lst OUT ORDERS.TT_EQUIPMENT_OPERATION_LST, --SQL Type
    av_message OUT VARCHAR2
    IS
    wt_dominio_lst CONTROL_EQUIPMENT.NP_CONTROL_EQUIPMENT_PKG.TT_TR_EQUIPMENT_OPERATION_LST; --PL/SQL Type
    BEGIN
    SP_GET_EQUIPMENT_OPERATION_LST(an_npequipstatid, wt_dominio_lst, av_message);
    IF av_message IS NULL THEN
    at_dominio_lst := ORDERS.TT_EQUIPMENT_OPERATION_LST(ORDERS.TO_EQUIPMENT_OPERATION('','','','','','',''));
    at_dominio_lst.EXTEND(wt_dominio_lst.COUNT - 1);
    FOR i IN 1..wt_dominio_lst.COUNT LOOP
    at_dominio_lst(i) := ORDERS.TO_EQUIPMENT_OPERATION(wt_dominio_lst(i).wn_npequipmentoperid,
    wt_dominio_lst(i).wv_npactiveservicenumber,
    wt_dominio_lst(i).wv_npspecification,
    wt_dominio_lst(i).wv_nptype,
    wt_dominio_lst(i).wn_nporderid,
    wt_dominio_lst(i).wn_npguidenumber,
    wt_dominio_lst(i).wd_npdevolutionprogramdate
    END LOOP;
    END IF;
    END;
    I would like that the CAST is direct. Somebody can help me?. Thank you so much!

    I am facing the same problem as u had...may I know how u solved ur probkem...
    thanks,
    kishore

  • JDBC,  and  SQL Server's Datetime

    I am very new to Java, and have been working mostly with PHP, Perl, and MYSQL. So here is my question, how do I work with the Datetime data type in SQL Server and Java's java.sql.Date class?
    Here is what I have to do:
    Enter the current date into the date field of when the user took the survey.
    And when reports are requested, I have to get responses which fall between two dates.
    I'm not expecting any code, but a point in the right direction would be brilliant. Thank you.

    First I would suggest you have a look at the JDBC tutorial. There's a link to it from this page:
    http://java.sun.com/docs/books/tutorial/
    And then when you get around to programming your application, you'll find it easier if you use PreparedStatements rather than Statements for specifying "between two dates". And you'll need to use java.sql.Timestamp if your "dates" include time components, since java.sql.Date is only a date with no time.

  • JDBC and SQL Server

    Does anyone know whether SQL Server comes with a straight JDBC driver?

    Assuming that by SQL Server you mean Microsoft SQL Server, I do not know if it does come with (i.e. if Microsoft provides) a JDBC driver.
    However, there are quite a few companies that do provide JDBC drivers for SQL Server. A name that come to mind is Merant. Check it out at http://www.merant.com/products/datadirect/_jdbc/jdbc.asp
    For a complete (or atleast a more comprehensive) list of such providers, use http://industry.java.sun.com/products/jdbc/drivers to search.

  • Java.sql.types and oracletypes

    There appear to be difference in the way the constants are mapped in java.sql.types vs oracletypes(). For example date is '91' in oracletypes and '93' in java.sql.types. The DatabaseMetaData.getColumns() function reports data_type as a java.sql.type. Is there any mapping available from one to the other.
    Thanks

    Erm,
    One way to find out, I reckon.
    Good Luck,
    Avi.

  • SQL TYPE MAPPING for MSSQL SERVER and POSTGRES

    I have deployed an ejb application using weblogic6.1 and Oracle which was successful.The same application i tried to deploy for MSSQL SERVER which failed with the following exception :
    Errors encountered ''The Container-Managed Persistence Entity EJB failed while creating its SQL Type Map. The error was:
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'd_sip_salary_earning_1'.',
    'Error encountered while attempting to create Default DBMS Table: 'd_sip_salary_earning_1'. Error Text: '[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Column or parameter #3: Cannot find data type DATE.'.''
    How do i solve the above issue?
    Please someone help me solve this issue.
    Thanks in Advance.
    Regds,
    --Jagan

    Jagan wrote:
    I have deployed an ejb application using weblogic6.1 and Oracle which was successful.The same application i tried to deploy for MSSQL SERVER which failed with the following exception :
    Errors encountered ''The Container-Managed Persistence Entity EJB failed while creating its SQL Type Map. The error was:
    [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Invalid object name 'd_sip_salary_earning_1'.',
    'Error encountered while attempting to create Default DBMS Table: 'd_sip_salary_earning_1'. Error Text: '[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Column or parameter #3: Cannot find data type DATE.'.''
    How do i solve the above issue?
    Please someone help me solve this issue.
    Thanks in Advance.
    Regds,
    --JaganMS SQLServer does not have a DATE column type. The column type you want is 'DATETIME' in MS SQLServer.
    If you did not specify the DDL and/or if this is coming from generated code, then show me the full stack trace
    of this exception. If you dont have it, please turn on JDBC logging, and the full SQLException will show up in
    the jdbc log file.
    thanks,
    Joe

  • Mapping between oracle data types and ms sql server data types

    hello
    i need mapping between oracle data types and ms sql server data types
    where can i find them ?

    read this
    http://download.oracle.com/docs/cd/E10405_01/doc/appdev.120/e10379/ss_oracle_compared.htm

  • Inconsistent java and sql object types

    Hi,
    I have run into error "Inconsistent java and sql object types"
    while mapping a java class to a sql object type. The java class
    is just a duplicate of sql data structure and I pretty much
    follow the JDBC Developer's GUide's examples (20-43 to 20-45)
    to create the mapping java class.
    Any one runs into simliar problem or any clues?
    Thanks,
    Ed
    Exception in thread "main" java.sql.SQLException: Inconsistent java and sql object types: InstantiationException:
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
    at oracle.sql.STRUCT.toClass(STRUCT.java:433)
    at oracle.sql.STRUCT.toJdbc(STRUCT.java:366)
    at oracle.jdbc.oracore.OracleTypeUPT.unpickle80rec
    (OracleTypeUPT.java:236)
    at
    oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle80rec_elems
    (OracleTypeCOLLECTION.java:553)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle80rec
    (OracleTypeCOLLECTION.java:383)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unpickle80
    (OracleTypeCOLLECTION.java:329)
    at oracle.jdbc.oracore.OracleTypeCOLLECTION.unlinearize
    (OracleTypeCOLLECTION.java:218)
    at oracle.sql.ArrayDescriptor.toJavaArray
    (ArrayDescriptor.java:501)
    at oracle.sql.ARRAY.getArray(ARRAY.java:197)

    The safest way would be to use JPublisher to generate the type classes. In your application, you can just use the generated code to manipulate the object.

  • (262119469) Q DBC-17 How is data mapped from SQL-type to Java-type?

    Q<DBC-17> Is there any documentaion for the data mapping between the "java type" and
    the "sql type"
    A<DBC-17> The data types are the standard JDBC mappings. Check the javadoc for the
    java.sql package.

    Hi,
              If you are seeing last 3 fields coming as empty.... then you need to check the seperator type which correctly seperats one fields from another during mapping to BW infoobject.
    Thanks
    Kishore Kusupati

  • Help - JDBC MS SQL Server and Cursors Error

    Hello,
    Please help. I am using weblogic 8.1 and MS SQL Server 2000. Using JDBC. I have am calling a stored procedure which outputs a CURSOR. I haveing problems specifying the right java.sql.Type for this. I tried java.sql.Type.OTHER but it fails. The code is as follows
    Connection conn = null;
    CallableStatement stmt = null;
    String sqlProc = "{ call GetDocumentDetails(?,?) }";
    try {
    conn = this.getConnection();               
    stmt = conn.prepareCall(sqlProc);
    stmt.setInt(1, docId);
    stmt.registerOutParameter(2,Types.OTHER);
    stmt.execute();
    ResultSet rs = (ResultSet) stmt.getObject(2);
    while(rs.next()) {
    The exception that I get is
    java.sql.SQLException: [BEA][SQLServer JDBC Driver]The specified SQL type is not supported by this driver.
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
    PLEASE HELP.
    Thanks in advance
    GM

    hi llturro,
    Thanks for answering my question. I have tried out what you suggested, but I still can't fix my problem. The following are the messages that display when I try to run my servlet. It seems that the DataSource, Connection and Statement are ok, however when it comes to the ResultSet the error message appear. What's wrong with my ResultSet coding ?
    ResultSet rs = stat.executeQuery("SELECT ISBN FROM BOOKSINFO WHERE ISBN='"+primarykey+"'");
    setEntityContext Method
    Find by primary key
    DataSource OK
    Connection OK
    Primary Key = 013-00-675721-9
    Statement OK
    java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
    java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
    java.lang.NullPointerException
    java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
    java.lang.NullPointerException
    java.lang.NullPointerException
    <<no stack trace available>>

  • WLS 8.1 Type 4 JDBC Driver SQL Server sp_prepare/sp_execute

    Hello,
    I have a question regarding performance troubleshooting in a production situation using the WLS 8.1 Type 4 JDBC Driver for SQL Server and SQL Server 2000.
    This driver compiles a sql statement on the sql server using sp_prepare(), saving a handle to it. It will execute the statement using sp_execute(). Subsequent uses of the same statement will skip the sp_prepare(), and just call sp_execute(). So, ideally, for a particular statement, you should see one sp_prepare, and a lot of sp_execute's.
    My WLS app is running along in production, and I detect a performance problem of some sort on the sql server, such as excessive IO, or blocking.
    I turn on the sql server profiler, and I can see a bunch of
    sp_execute 123, 'one', 'two'
    sp_execute 123, 'foo', 'bar'
    with bad IO. How do I determine what the original SQL was that was used in the sp_prepare?
    The only way I can see to do this is to have the sql server profiler always running to catch every sp_prepare. I can't believe that this is a best practice.
    How are you all handling this type of situation?
    Thanks,
    Dave

    Dave Ballard wrote:
    Hi Joe,
    Thanks for the suggestions. The main issue I have with both is that they
    require a server restart to enable. Can't do that on my production system.
    The best I've come up with since I posted is to locate the poor
    performer/blocker real-time via sysprocesses, then use the sqlhandle column
    to call fn_get_sql to get at least some of the sql submitted with sp_prepare().
    Not pretty and difficult to do on a busy system.
    What's bugging me about the sp_prepare/sp_execute technique used by the driver is:
    1) sp_prepare/sp_execute don't seem to be documented anywhereThey are internal to SQLServer, so it'd be MS to document them or not.
    2) It is at best inconvenient to have to troubleshoot performance issues (requiring
    a server config change, server restart, and manual reconcile of two different,
    possibly very large, logs based on timestamp).
    Your idea to disable the stored procedure cache is interesting, but still requires
    a server restart to enable, and another to disable.
    To me this is a large step backwards in manageability of my system. What I don't
    understand is that I don't see much discussion about this topic on any forums,
    so I wonder if I'm just missing something here (maybe everyone's using Oracle).No, the same sorts of issues would be needed with Oracle. DBMSes must make tradeoffs
    between normal-case runtime performance, and the instrumentation that would be needed
    to simultaneously monitor performance problems.
    Joe
    >
    Thanks,
    Dave

  • Boolean attributes and SQL column types

    I have a MS SQL database table I am managing with SIM. One of the attributes needs to represent a boolean value. In my schema, the attribute is:
    <AccountAttributeType id='17' syntax='boolean'
                          name='foreignStudent' mapName='Foreign_Student'
                          mapType='string'/>which is what is generated when editing the Resource Schema through the administrative UI.
    What data type should I be using for the column in SQL? I have tried bit, tiny int and char(1), but am always seeing the same issue. When I save the user, the accounts[...].foreignStudent is true, and SIM sets the value in the database column to 1 (or '1'). But when I open the user again, accounts[...].foreignStudent is read in as false, and so SIM thinks it needs to update the resource.
    Same thing happens if I try a mapType='boolean' or mapType='integer'.
    Thanks in advance!

    Thanks, Paul, but although I have some flexibility in the database design, I need the column to hold either a 0/1 or F/T.
    I have worked around it by treating it as an int and not a Boolean, and making sure I just assign values of 0, 1 and null. But I am curious to know if anyone has successfully mapped a boolean attribute type to a SQL bit type rather than varchar(5)...

  • The java and sql object type  was not matched

    My table(Oracle10.2) has a varying arrays column. For mapping to java classes, I use JDeveloper(10.1.3.1.0) to generate java classes. Then I try to insert a record into this varrying arrays column with java. While it always complaints java.sql.SQLException.the java and sql object type was not matched. I can not find the reason.
    My java code:
                   StructDescriptor structdesc = StructDescriptor.createDescriptor(
                             "VARRAY_SEQ", con);
                   int nid=20;
                   int pid=546;
                   BigDecimal mynid=new BigDecimal(nid);
                   mynid=mynid.setScale(0, BigDecimal.ROUND_HALF_UP);
                   BigDecimal mypid=new BigDecimal(pid);
                   mypid=mypid.setScale(0, BigDecimal.ROUND_HALF_UP);
                   Object[] attributes = { "ASDF", mynid, "Developer", mypid,
                             "rwretw" };
                   STRUCT Rel = new STRUCT(structdesc, con, attributes);
                   stmt.setObject(8, Rel);
                   stmt.execute();
                   stmt.close();
    And the STRUCT is
    public RelSeq(String nucl, java.math.BigDecimal neId, String nuor, java.math.BigDecimal pId, String phor) throws SQLException
    { _init_struct(true);
    setNucl(nucl);
    setNeId(neId);
    setNuor(nuor);
    setPId(pId);
    setPhor(phor);
    }

    My table(Oracle10.2) has a varying arrays column. For mapping to java classes, I use JDeveloper(10.1.3.1.0) to generate java classes. Then I try to insert a record into this varrying arrays column with java. While it always complaints java.sql.SQLException.the java and sql object type was not matched. I can not find the reason.
    My java code:
                   StructDescriptor structdesc = StructDescriptor.createDescriptor(
                             "VARRAY_SEQ", con);
                   int nid=20;
                   int pid=546;
                   BigDecimal mynid=new BigDecimal(nid);
                   mynid=mynid.setScale(0, BigDecimal.ROUND_HALF_UP);
                   BigDecimal mypid=new BigDecimal(pid);
                   mypid=mypid.setScale(0, BigDecimal.ROUND_HALF_UP);
                   Object[] attributes = { "ASDF", mynid, "Developer", mypid,
                             "rwretw" };
                   STRUCT Rel = new STRUCT(structdesc, con, attributes);
                   stmt.setObject(8, Rel);
                   stmt.execute();
                   stmt.close();
    And the STRUCT is
    public RelSeq(String nucl, java.math.BigDecimal neId, String nuor, java.math.BigDecimal pId, String phor) throws SQLException
    { _init_struct(true);
    setNucl(nucl);
    setNeId(neId);
    setNuor(nuor);
    setPId(pId);
    setPhor(phor);
    }

Maybe you are looking for

  • Additional workflow Mailer setup on Purchase Order

    Dear All, We are running on R12 on 11.0.1.7 database. We have configured Workflow mailer notification and it seems to be running properly.. And the approver/approvee gets appropriate mails on appropriate time. But our management requires additional c

  • Outlook asks for credentials 2 times

    Hello, I'm in the middle of a transition from SBS 2011 to 2012 R2. Currently Exchange 2010 and 2013 co-exists. Every time I start Outlook (2013)  it asks for credentials. If I use [email protected] format it does not accept. If I use domain\user form

  • Drop shadow on garbage matte

    Happy New Year All. I may be missing something obvious. I made a hole in an animated background with a matte. It is static. An HD interview video is placed behind. It looks like a photo with straight edges and I did it to fake a mild zoom in out on t

  • Solaris x86: How to boot from Veritas mirror disk?

    Hello team, We are using trailware Veritas Storage Foundation (VxVM) on Solaris 10 x86 system and need help in booting from alternative boot disk(Mirror disk). Steps did : 1. Mirrored the root disk group using veritas volume manager command *"vxrootm

  • Importing To Keynote From Grapher

    I have created an image utilizing the Graphers application. I am trying to understand how I can import that into Keynote keeping the animations of the Graphers image. IN essence, I'm looking for the image to revolve on the title page within Keynote.