GetObject(int, Map) not working with oracle JDBC

I'm using Oracle and I'd like to get Date fields as Timestamps since an Oracle date column includes time. I'm trying to use getObject(int, Map) to map the types to Java objects, but it's not working. This is my code:
     public static final HashMap oracleMap = new HashMap();
     static{
          try{
               oracleMap.put( "DATE", Class.forName("java.sql.Timestamp") );
               oracleMap.put( "NUMBER", Class.forName("java.math.BigDecimal") );
               oracleMap.put( "VARCHAR2", Class.forName("java.lang.String") );
               oracleMap.put( "CLOB", Class.forName("java.sql.Clob") );
               oracleMap.put( "LONG", Class.forName("java.lang.String") );
          }catch(Exception e){
               IllegalStateException ise = new IllegalStateException("Oracle type mapping failed.");
               ise.initCause(e);
               throw ise;
     }And
                    BASE.println("rs.getClass().getName(): "+rs.getClass().getName());                                        
                    BASE.println("rs.getMetaData().getColumnTypeName(i): "+rs.getMetaData().getColumnTypeName(i));
                    if(rs.getClass().getName().startsWith("oracle")) valObj = rs.getObject(i, DOMTools.oracleMap);                    
                    else valObj = rs.getObject(i);                    
                    BASE.println("valObj.getClass().getName(): "+valObj.getClass().getName());Here's a snippet of my output that illustrates the code not working:
rs.getClass().getName(): oracle.jdbc.driver.OracleResultSetImpl
rs.getMetaData().getColumnTypeName(i): DATE
valObj.getClass().getName(): java.sql.Date
Anyone know if this is a driver issue? Anyone had luck doing this with Oracle?
Thanks.

Well, I'd like it to be java.sql.Timestamp instead of
java.sql.Date. My actual type is an oracle "DATE".
Are you saying the Map key for this would be
"TIMESTAMP" and that by default it maps to
java.sql.Date? Doesn't seem like that makes sense.I am saying that "TIMESTAMP" is not an oracle value but is instead a JDBC value. Thus it is up to to the driver, not you, to determine what oracle types map to the JDBC type.

Similar Messages

  • PreparedStatement not working with Oracle

    Hi All,
    I am using preparedStatement in my JDBC code to fetch/insert values from oracle9i database.
    I am checking condition like if a given record does not exist then insert it else update it.
    First time it works when there is no row in database, however for subsequent run it's not able to return me the result though that row exist in database and this resulting in DuplicateKeyException becuase it try to create the row in db again.
    The code is working fine for MySQL DB2 and SQLServer but doesn't work in case oracle 9i
    Here is mycode
    //problem is here 1st time it works next time it is not retunring true though record is there in DB.
    if(isItemExist("1","CORP"))
    updateItem("1","CORP","DESC1");
    else
    insertItem("1","CORP","DESC1");
    public boolean isItemExist(String itemid, String storeid)
    String FIND_SQL = "SELECT item_desc from item where item_id = ? and store_id = ? ";          
    c = utils.getConnection();
    ps = c.prepareStatement();
    int i = 1;
    ps.setString(i++, storeid);
    ps.setString(i++, itemid);
    rs = ps.executeQuery();
    if(rs.next()){
         return true;
    utils.close(c, ps, rs);
    else{
         return false;
    utils.close(c, ps, rs);
    public void createItem(String itemid, String storeid, String item_desc)
    String INSERT_SQL = "INSERT INTO item(item_id,store_id,item_desc)values(?, ?, ?)";
    c = utils.getConnection();
    ps = c.prepareStatement();
    int i = 1;
    ps.setString(i++, itemid);
    ps.setString(i++, storeid);
    ps.setString(i++, item_desc);
    ps.executeUpdate();
    utils.close(c, ps, null);
    public void updateItem(String itemid, String storeid, String item_desc)
    String INSERT_SQL = "UPDATE item SET item_desc = ?, store_id=? WHERE item_id = ?";
    c = utils.getConnection();
    ps = c.prepareStatement();
    int i = 1;
    ps.setString(i++, item_desc);
    ps.setString(i++, storeid);
    ps.setString(i++, itemid);
    ps.executeUpdate();
    utils.close(c, ps, null);
    Kindly suggest what's wrong with code. because same code works with other databse like SQL Server, MySQL but it is not working with oracle9i.

    if(isItemExist("1","CORP"))
    updateItem("1","CORP","DESC1");
    else
    insertItem("1","CORP","DESC1");
    String FIND_SQL = "SELECT item_desc from item where item_id = ? and store_id = ? ";
    ps.setString(i++, storeid);
    ps.setString(i++, itemid);
    String INSERT_SQL = "INSERT INTO item(item_id,store_id,item_desc)values(?, ?, ?)";
    ps.setString(i++, itemid);
    ps.setString(i++, storeid);
    ps.setString(i++, item_desc);
    String INSERT_SQL = "UPDATE item SET item_desc = ?, store_id=? WHERE item_id = ?";
    ps.setString(i++, item_desc);
    ps.setString(i++, storeid);
    ps.setString(i++, itemid);My first guess, looking at the above snippets, would be that the item_id field is a number and not a string and so you should be calling ps.setInt instead of ps.setString when setting that parameter.
    This is only a guess, however, since you have not posted what the actual error is, which will probably give a hint to what the actual error is.

  • Clob mapping not working with mysql

    Hi,
    I have an application that i'm running with MySQL and Oracle at the same
    time. At some point, i need to use a 'clob' mapping. When i do this, it
    just works fine with oracle but it fails with mysql. i have the exception:
    Field "com.ennov.prisma.api.document.jdo.AbstractDocumentPO.description"
    is mapped as a clob, but should be represented as a different mapping.
    If the field is a string and you would like to force it to map as a
    clob, add an extension to its field metadata with a key of "jdbc-size"
    and a value of
    -1.[com.ennov.prisma.api.document.jdo.AbstractDocumentPO.description]
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:132)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:118)
         at
    kodo.jdbc.meta.ClobFieldMapping.fromMappingInfo(ClobFieldMapping.java:46)
    if i use a value mapping, it works with MySQL but fails with Oracle (I
    have sql error because a clob is used in a distinct select).
    In the manual, it is written "Note that some databases can support
    string of unlimited length without using a CLOB; when this is the case
    the mapping tool will install a value mapping in favor of
    this mapping.". So apparently, this is not the case with MySQLDictionary.
    To solve my problem and have my code working with both databases, i had
    to extend the MySQLDictionary and overwrite the replaceFieldMapping
    method in order to replace the clob mapping by a value mapping at
    runtime but i don't feel confident to do this kind of modifications by
    mysel and would expect this behaviour to be solved quite soon.
    Thanks for your help since this problem is urgent for us,
    Laurent Czinczenheim

    Laurent-
    The best solution would probably be to just have separate mappings for
    the MySQL and Oracle databases. The easiest way to accomplish this would
    be to have a separate setting for each of the databases. E.g.:
    kodo.jdbc.meta.MappingFactory: file(SingleFile=true, FileName=oracle.mapping)
    kodo.jdbc.meta.MappingFactory: file(SingleFile=true, FileName=mysql.mapping)
    That way, you can use a clob mapping for Oracle, and a normal value
    mapping for MySQL (since MySQL doesn't need to use the CLOB mapping, and
    it isn't very efficient).
    For more details on this, see:
    http://docs.solarmetric.com/manual.html#ref_guide_mapping_factory
    Another solution is to just stick with your custom extension of the
    MySQLDictionary, which is a perfectly valid way of having special CLOB
    handling in MySQL. Note, though, that CLOB handling is less efficient
    than VARCHAR handling, so it should be a mapping of last resort, and
    there isn't any need to use it in MySQL.
    In article <[email protected]>, czinczenheim wrote:
    Hi,
    I have an application that i'm running with MySQL and Oracle at the same
    time. At some point, i need to use a 'clob' mapping. When i do this, it
    just works fine with oracle but it fails with mysql. i have the exception:
    Field "com.ennov.prisma.api.document.jdo.AbstractDocumentPO.description"
    is mapped as a clob, but should be represented as a different mapping.
    If the field is a string and you would like to force it to map as a
    clob, add an extension to its field metadata with a key of "jdbc-size"
    and a value of
    -1.[com.ennov.prisma.api.document.jdo.AbstractDocumentPO.description]
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:132)
         at kodo.jdbc.meta.Mappings.invalidMapping(Mappings.java:118)
         at
    kodo.jdbc.meta.ClobFieldMapping.fromMappingInfo(ClobFieldMapping.java:46)
    if i use a value mapping, it works with MySQL but fails with Oracle (I
    have sql error because a clob is used in a distinct select).
    In the manual, it is written "Note that some databases can support
    string of unlimited length without using a CLOB; when this is the case
    the mapping tool will install a value mapping in favor of
    this mapping.". So apparently, this is not the case with MySQLDictionary.
    To solve my problem and have my code working with both databases, i had
    to extend the MySQLDictionary and overwrite the replaceFieldMapping
    method in order to replace the clob mapping by a value mapping at
    runtime but i don't feel confident to do this kind of modifications by
    mysel and would expect this behaviour to be solved quite soon.
    Thanks for your help since this problem is urgent for us,
    Laurent Czinczenheim
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Oracle 11g XE not working with oracle BI publisher 10g after enabling ACL

    Hello,
    I previously work with oracle 10gXE and Oracle BI publisher 10g and it work fine. now i install oracle 11g XE and try to configure it with oracle Bi Publlisher, it show this error
    "ORA-29273: HTTP request failed ORA-06512: at "SYS.UTL_HTTP", line 1324 ORA-12570: TNS:packet reader failure" after runing the ACL package to neable network service.
    on the database.
    Please can any body tell be why this is not working. Tanx.

    You'll need to add the apex engine owner to the ACL (Access Control List). Depending on your version of apex the user name varies. i.e. 4.0 is APEX_040000
    See Joel's blog for info about the ACL and APEX.
    [http://joelkallman.blogspot.com/2010/10/application-express-network-acls-and.html]

  • Hp t510 right alt key mapping not working with ctrl + s

    Using the HP t510 to launch a xendesktop session via storefront. We have a mission critical application that uses the ctrl + alt + s hotkey to secure itself. The left alt key with ctrl + s is working as it should but the right alt key does not. When testing in the win7 on screen keyboard the right alt and ctrl stay lit up. When hitting the S key after depressing both the  right alt + ctrl (right or left ctrl doesn't matter) the alt keys disappear from the on screen keyboard as if they were no longer pushed. They hotkey combination never makes it to the application and it does not secure itself.
    I've tested this same workflow on an ASUS thin client, desktop, and laptop hardware with no issues. It does in fact seem to be some hotkey mapping the HP device has baked into it using the right alt key.
    Has anyone seen any issues that even closely mimic this? I've seen some for ctrl + alt + del but their fixes don't work for this specific issue.

    Hello xXenStatex,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand that the alt key mapping is not working with ctrl + s on your Thin Client, and I would be happy to guide you towards a resolution!
    I am sorry, but to get your issue more exposure, I would suggest posting it in the commercial forums, since this is a commercial product. You can do this at:
    http://h30499.www3.hp.com/t5/Workstations-Thin-Clients/bd-p/bsc-635
    I hope this helps!
    Regards
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • IPlanet J2EE application not working with oracle 9i but working with 7.3

    We are in a process of upgrading database from oracle 7.3 to 9i.
    We have a working application running on iPlanet Application Server with oracle 7.3 as database. We are using iPlanet Application Server's connection pooling. Our JDBC driver is classes111.zip.
    After upgrading to 9i, our application doesnt work. When I try to run a test application that uses single select statement, this the error I get: java.sql.SQLException: Invalid URL: Driver type not specified
    SQL*PLUS works fine. I havent upgraded oracle client. Do I need to upgrade the JDBC driver or oracle client?
    Any suggestions? iAS version is 6.5.

    If you are new to JSF, then I'd try and simplify the environment in which you are working as the first step to achieving a successful outcome.
    JSF 1.2 is a certified and well tested component of WLS, so we know it works. I'm not sure of the effect of all those additional modules you are adding in there -- it appears as if you have gotten a Faces implementation instantiated, but there could be some form of version difference/conflict since it can't find a method its looking for.
    Using Oracle Enterprise Pack for Eclipse (http://www.oracle.com/technology/software/products/oepe/oepe_11115.html) you can build yourself out a pretty simple JSF application to get started from and deploy it to a WLS server. This would remove all the additional libraries you currently have, provide you with a bundled applicaton to deploy and give you a pretty good environment from which you can learn and experiment with JSF.
    -steve-

  • Attribute mapping not working with complex searches

    Hi all,
    We are using "attribute mapping" for some attributes and that works fine as far as we don't make a complex search. We are doing the attribute mapping at the Directory proxy 6.3 so we map businessSector to businessUnit. Everything work fine if we just put businessSector in the search, but if we add something else to the search filter, it will not work.
    So, if we use filter businessSector=XXXXXXX, it will work and make all the mapping, but if we use something like "(&(pocketSizeOffice=Yes)(businessSector=XXXXXXX))", it will not work.
    We have look at the logs and we see the mapping happening in the first case, but not in the second one.
    Have somebody seem this before or is facing this problem?
    Thanks,
    Federico

    Hi Federico,
    I was not able to reproduce the problem with DPS 6.3 in my labs... so the conditions to reproduce it may be more tricky than described. Anyway, this is not a known problem.
    Feel free to contact Sun support to have a fix delivered to you.
    Thanks
    -Sylvain

  • Port mapping not working with 7.5.1

    I am having trouble getting Port mapping working with the new 7.5.1 firmware. Port mapping is not working. Port mapping was working fine before update, now all attempts to connect from WAN on ports are rejected. Tested with: telnet <wan-ip> <port>
    I have removed and re-added all port mapping entries - no luck. Power cycled several times - no luck.
    Other info:
    I have an: Airport Extreme (Simultaneous Dual-Band II) running Version: 7.5.1.
    It is setup to "Allow this network to be extended"
    Network is being extended with an Airport Express with 802.11n running 7.4.2

    yeah. I noticed the same thing. now the splash screen comes on without the flashing green squares and just hangs. i tried unintalling and then reinstalling and still no go. kind of annoying but they will probably come out with an update pretty soon

  • Google maps not working with symbian belle upgrade

    guys after recent upgrade with symbian belle google maps stopped working is there any problem will belle dose it support google maps 4.1.1

    For those people still can't get Google map to work on Belle after the Wifi trick, a hard reset finally fixed mine!  (No, a soft reset did not fix mine, but you should try it first.)  Yea, it's a pain in the butt having to reinstall some apps and reconfigure preferences.  But my phone also runs smoother and the battery lasts longer, as least it seems.  I still need to turn on Wifi for Google map to start.
    Detailed steps:
    Do a full backup with Nokia Suite, just in case. (If you restore later, do not restore apps & preferences.  Otherwise, Google map won't work.)
    Put phone in Offline mode to end all calls and connections: Press Hangup > Offline
    Try Soft reset first: Settings > Phone > Phone Management > Factory Settings > Restore.
    Reinstall Google Maps.
    If soft reset didn't work, try Hard reset: Settings > Phone > Phone Management > Factory Settings > Delete data and restore
    Enjoy!

  • Netbeans not working with Oracle Waveset 8.1.1!!!!

    We have recently done a test upgrade to Oracle Waveset 8.1.1 and discovered that we can no longer use Netbeans to do further development. We are trying to use Netbeans 6.8 with the 8.1 connector downloaded from the open source java website, which is the last official one available.
    When creating a new IDM project you receive an error saying:
    "The version of the server you are attempting to connect to, 8.1.1,does not match that of the IDE Compatability Bundle for your project,8.1".
    We contacted Oracle and they have advised that we cannot upgrade to 8.1.1, as there is no supported connector. We are getting further advice on this as this is quite bad if its true.
    Is anyone else using Netbeans 6.8 with Oracle Waveset 8.1.1 successfully and if so can you advise how you went about configuring it?

    Update:
    We upgraded our production environment with patch 14 this last Thursday.
    The "sample/ide-bundle.zip" is not located in the download but instead was updated during the patching process and may be found at $WSHOME/sample/ide-bundle.zip.
    After moving the zip to my local machine I was able to configure a (remote) IDM project in Netbeans without receiving an error.
    My problem has been resolved.
    -IDMxml

  • Ankh SVN does not work with Oracle DB Project in ODT 11.1.0.5.10 beta

    I was able to add the new Oracle Database Project to my Subversion repository using TortioseSVN, but unfortunately, the Ankh Source Control options do not appear within Visual Studio and none of the icon overlays appear within Visual Studio.
    Does anyone know any way to get this to work? Does anyone know if this would be an issue with Ankh or with the new Oracle Database Project?
    null

    Yes. Visual C# class projects work just fine with Ankh. It's only the new Oracle Database Project that doesn't have any Ankh menu options or Ankh icon overlays.
    Check out this screenshot of my Visual Studio Solution explorer:
    http://www.mixcollective.com/media/559/oracledbproject.jpg
    You'll see that none of the folders under "Oracle.New" (a new 11.1.0.5.10 beta Oracle Db Project) have the green/read/yellow Ankh icons that indicate the status of the file. Also, none of the repository commit, update, etc options are available when you right click on folders or files in the project.

  • Powerpivot Data Refresh Not working with Oracle Data Source in sharePoint 2013

    I am using SQL Server 2012 PowerPivot for Excel 2010. Getting the following error in SharePoint 2013 environment, when using Oracle data source within a workbook -
    EXCEPTION: Microsoft.AnalysisServices.SPAddin.DataRefreshException: Engine error during processing of OLE DB or ODBC error: The specified module could not be found..:
    <Site\PPIV workbook>---> Microsoft.AnalysisServices.SPAddin.DataRefreshException: OLE DB or ODBC error:
    The specified module could not be found..   
     at Microsoft.AnalysisServices.SPAddin.DataRefresh.ASEngineInstance.ProcessDataSource(String server, String databaseName, String datasourceName, SecureStoreCredentialsWrapper
    runAsCredentials, SecureStoreCredentialsWrapper specificConfigurationCredentials, DataRefreshService dataRefreshService, String fileUrlForTracing)     -
    -- End of inner exception stack trace ---   
     at Microsoft.AnalysisServices.SPAddin.DataRefresh.ASEngineInstance.ProcessDataSource(String server, String databaseName, String datasourceName, SecureStoreCredentialsWrapper
    runAsCredentials, SecureStoreCredentialsWrapper specificConfigurationCredentials, DataRefreshService dataRefreshService, String fileUrlForTracing)   
     at Microsoft.AnalysisServices.SPAddin.DataRefresh.DataRefreshService.ProcessingJob(Object parameters)
    I created a simple Excel 2013 PPIV workbook with an oracle data source and uploaded that to SharePoint 2013, but no change in the results - still getting the above error.
    What is this error? We have installed Oracle client (64-bit, since we use 64-bit Excel and Sp is also 64-bit) on SSAS PPIV Server and SharePoint Content DB Server. Do we need
    to install it anywhere else?
    Thanks,
    Sonal

    Hi Sonal,
    To use PowerPivot for SharePoint on SharePoint 2013, it is required to install PowerPivot for SharePoint with the Slipstream version of SQL Server 2012 SP1. If you install SQL Server 2012 and then use the upgrade version of SQL Server 2012 SP1 to upgrade,
    the environment will not support SharePoint 2013.
    I would suggest you refer to the following articles:
    Install SQL Server BI Features with SharePoint 2013 (SQL Server 2012 SP1):
    http://technet.microsoft.com/en-us/library/jj218795.aspx
    Upgrade SQL Server BI Features to SQL Server 2012 SP1:
    http://technet.microsoft.com/en-us/library/jj870987.aspx
    Regards,
    Elvis Long
    TechNet Community Support

  • Select * from table not working with Oracle OBDC driver

    Hello,
    In our web development we have been using the MS ODBC for Oracle
    driver to connect to our Oracle db. We decided to try the
    Oracle ODBC driver because it supports the commandTimeout
    property in ASP which the MS driver does not. The problem I'm
    running into now is that all of our select * from table
    statements appear not to be working. The Oracle ODBC driver
    version we are using is ver 8.00.05.00. Is there something that
    I'm not doing properly? If I take the same select * from table
    statement and name the columns, I dont get any error. Otherwise
    I'm getting a Subscript out of range error. It seems strange to
    me that this driver would not support a select * from table
    statement (which I''m told is the case by another developer
    here).
    Is there something I'm missing?
    Thanks,
    Pete

    I'm positive I have a connection. Otherwise I wouldn't get a
    response when I name the columns instead of using *.
    There must be something else that I'm missing or doing wrong.
    I've actually been looking into alternative ODBC drivers to see
    if I have the same problems but none that I have found support
    commandTimeout.
    Any other ideas?

  • Hibernate data insertion not working with oracle auto increment

    hi i have created a table and the id is set to auto increment by a sequence trigger pair
    when i manually giving value to id its working fine
    but when i tried without maually giving the id i am getting this error
    org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save(): com.pojo.Example
    at org.hibernate.id.Assigned.generate(Assigned.java:33)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)
    at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)
    at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)
    at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
    at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
    at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)
    at hibernetsample.Main.main(Main.java:30)

    >
    hi i have created a table and the id is set to auto increment by a sequence trigger pair
    when i manually giving value to id its working fine
    but when i tried without maually giving the id i am getting this error
    org.hibernate.id.Assigned
    >
    That is because you are using the hibernate 'assigned' generator which, by definition
    >
    lets the application to assign an identifier to the object before save() is called.
    This is the default strategy if no <generator> element is specified.
    >
    For your use case you can use the 'sequence' generator.
    The valid generator options and one way to use a sequence generator is shown in this article
    http://www.hibernate-training-guide.com/identifiers-generators.html
    The hibernate section of this article also uses a trigger with sequence generator
    http://blog.lishman.com/2009/02/auto-generated-primary-keys-in-oracle.html
    You should check the hibernate documention and tutorial for examples or search 'hibernate generator sequence example'

  • JavaBean not working with Oracle Forms (URGENT)

    I have written a Javabean program which I invoke from Oracle Forms. The program is designed to pass a parameter from the form to the bean and get a parameter back to the form from the Javabean. The bean is called on the when-button-pressed event of a form button. The problem is, the form doesnt seem to invoke the bean at all. There seems to be no communcation between the form and the bean at runtime on-click of the form button other that all the messages in the form procedure being displayed.
    The event code for the button is,
    Declare
    setNewMsg varchar2(2000) := 'Hello World';
    getData varchar2(2000);
    BeanHdl Item;
    Begin
    BeanHdl := find_item('Block3.MYBEAN');
    If NOT ID_NULL(BeanHdl) Then
              Message('Before Set');
              SET_CUSTOM_PROPERTY(BeanHdl,1,'setMessage',setNewMsg);
              Message('Before Get');
              getData := GET_CUSTOM_PROPERTY(BeanHdl,1,'getMessage');
              SYNCHRONIZE;
              Message(getData);
              Message('After Get');
              Message(' ');
    Else
              Message('The ID is null');
              Message(' ');
    End If;
    END;
    The javabean code is,
    package oracle.forms.beans;
    import java.awt.*;
    import java.io.*;
    import java.beans.*;
    import oracle.forms.ui.*;
    import oracle.forms.properties.*;
    import oracle.forms.handler.*;
    import oracle.ewt.lwAWT.*;
    public class SimpleTestBean extends VBean { 
    public static final ID SETMESSAGE = ID.registerProperty("setMessage");
    public static final ID GETMESSAGE = ID.registerProperty("getMessage");
    private String msg = "";
    public String newMessage() {
         return msg;
    public Object getProperty(ID id) { 
         try { 
              if (id == GETMESSAGE) { 
                   return newMessage();
    return super.getProperty(id);
    catch (Exception e) { 
         e.printStackTrace();
    return null;
    public boolean setProperty(ID id, Object value) { 
         try { 
              if (id == SETMESSAGE) { 
              msg = (String) value;
    return super.setProperty(id, value);
    catch (Exception e) { 
         e.printStackTrace();
    return false;
    Thanks

    Hi,
         I have written a Javabean program which I invoke from Oracle Forms. The program is designed to pass a parameter from Oracle Form(Ver 6i) to the java bean and get a parameter back to the form. The Javabean is called on "When-Button-Pressed" event of a Form button. The problem is, Form doesn't seem to invoke the bean at all. There seems to be no communication between the Oracle Form and the Javabean at runtime.
         On-click of the Form button though all test messages in the Form trigger are being displayed (Even message before and after the Set_Custom_Property & Get_Custome_Property). The only issue is the Form variable doesn't show the returned value from the bean. So the big question is - Whether the bean is invoked at all or not.
         If YES then how to check it and if NO then how to communicate with the bean from Oracle Form. I am attaching the code of Javabean and trigger code.
    Thanks & Regards
    NOTE : All the ClassPath for the JavaBean has been set properly and the Form is also recognizing the Implementation Class for the Javabean.
         The Trigger Code is,
         --- This code is written on When-Button-Pressed trigger of Form button.
         --- The form also contains the bean area "MYBEAN", which i have referred in the code.
         Declare
              setNewMsg varchar2(2000) := 'Hello World';
              getData varchar2(2000);
              BeanHdl Item;
         Begin
         BeanHdl := find_item('Block3.MYBEAN');
         If NOT ID_NULL(BeanHdl) Then
              Message('Before Set');
              SET_CUSTOM_PROPERTY(BeanHdl,1,'setMessage',setNewMsg);
              Message('Before Get');
              getData := GET_CUSTOM_PROPERTY(BeanHdl,1,'getMessage');
              SYNCHRONIZE;
              Message(getData);
              Message('After Get');
              Message(' ');
         Else
              Message('The ID is null');
              Message(' ');
         End If;
         END;
    The Bean Code is,
         package oracle.forms.beans;
         import java.awt.*;
         import java.io.*;
         import java.beans.*;
         import oracle.forms.ui.*;
         import oracle.forms.properties.*;
         import oracle.forms.handler.*;
         import oracle.ewt.lwAWT.*;
         public class SimpleTestBean extends VBean { 
         public static final ID SETMESSAGE = ID.registerProperty("setMessage");
         public static final ID GETMESSAGE = ID.registerProperty("getMessage");
         private String msg = "";
         public String newMessage() {
              return msg;
         public Object getProperty(ID id) { 
              try { 
                   if (id == GETMESSAGE) { 
                        return newMessage();
    return super.getProperty(id);
         catch (Exception e) { 
              e.printStackTrace();
              return null;
         public boolean setProperty(ID id, Object value) { 
              try { 
              if (id == SETMESSAGE) { 
              msg = (String) value;
    return super.setProperty(id, value);
         catch (Exception e) { 
              e.printStackTrace();
              return false;
    ------------------------------------------------------------------------------------------

Maybe you are looking for

  • I-pod wont sync songs

    my computer crashed recently and i lost my i-tunes library but when i reinstalled i-tunes it would only copy some songs from my i-pod. i just purchased new songs,and my i-pod will not sync them...HELP?!

  • Firefox freezes and beeps once new window opened

    Recent new problem whenever i open up a new window, the browser will freeze and each time i click it'll beep at me. The only solution is to press alt+f4. So i upgraded to firefox 4, updated all my plugin's and the same thing is happening. Open in new

  • How to remove Help - About - "Check for updates"

    I need to disable completelly all update possibilities from Firefox 4 installation and this is still something that I have not been able to remove. inside omni.jar I have found similar configuration files that have been working also in prevoius FF ve

  • ¿How to get activities templates collection from sr template and export to csv using powershell?

    Hi friends. I want to build a script that obtains the collection of activities templates from a sr template (filtering the sr template by displayname)  and export the list (template activities displaynames) to csv file. Thanks for advance. Cheers

  • IGuitar? iPhone guitar? Is it a web app. or what...

    Ive seen lots of cool videos on youtube of people playing (iGuitar) or whatever the proper name is for it. And im wondering is that a web app. or an actual feature on the iPhone.. Im purchasing the iPhone soon so im still kind of clueless to lots of