7 Replies Latest reply on Apr 27, 2010 6:19 AM by Francisco Fernandez

    V8Compatible: How to set it in JBoss?

    Davide Cicuta Newbie
      Hello!
      I'm developing an enterprise application which relies on JBoss AS and a MySQL or Oracle database. I'm developing on Windows XP Professional SP 3.
      We are not bound to any particular version of the DB (in particular for development I'm using Oracle 10g Express).
      Connections to the DB are obtained through a datasource and queries are performed via stored procedures.

      I'm having an issue with DATE fields which are accessed in Java with getTimestamp. The issue is described in
      http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.html#08_01
      and resolved that the only feasible approach is for me specifying oracle.java.V8Compatible to true. I use the ojdbc14.jar driver to connect to Oracle.

      I tried to do this in run.bat, run.conf and in the datasource deployment descriptor. Nothing changed and DATE is not returned as a java Timestamp.
      How can I achieve to treat Oracle DATE as a Java Timestamp?

      Thank you very much for your help!
        • 1. Re: V8Compatible: How to set it in JBoss?
          jaikiran pai Master

          Which exact version of JBoss AS? And please post the exact changes you did the the run.bat and/or run.conf (which is only for *nix OS). As per the documentation you pointed to:

           

          You can set this flag either as a connection property or a system   property. You set the connection property by adding it to the   java.util.Properties object passed to   DriverManager.getConnection or to   OracleDataSource.setConnectionProperties. You set the   system property by including a -D option in your   java command line.  

          So adding this -D option in the JAVA_OPTS section of the run.bat should ideally be enough.

           

          Also, how do you start the server?

          • 2. Re: V8Compatible: How to set it in JBoss?
            Davide Cicuta Newbie

            Hello!

            Thanks for your quick reply.

             

            I'm using JBoss 4.2.3

             

            In run.bat I have a line like:

            set JAVA_OPTS=%JAVA_OPTS% -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Doracle.jdbc.V8Compatible=true

             

            JAVA_OPTS is indeed correct (as displayed in the initial log), but the behaviour is not!

             

            I start JBoss via Eclipse (I added -Doracle.jdbc.V8Compatible=true to the launch configuration), but the same happens when I start it from command prompt...

            • 3. Re: V8Compatible: How to set it in JBoss?
              jaikiran pai Master

              davidec wrote:

               


              JAVA_OPTS is indeed correct (as displayed in the initial log), but the behaviour is not!

               

              In that case, you will probably have to ask this on the oracle jdbc driver forum for their inputs. Are you sure the version of the driver you are using is the correct one and supports this property?

              • 4. Re: V8Compatible: How to set it in JBoss?
                Davide Cicuta Newbie

                Pretty sure about the driver, or at least so Oracle says...

                I've also asked Oracle forums and I'm waiting a reply, in the meantime I'm trying to use a custom mapping for the datasource, to use the old Oracle8 mappings... It seems useless, but I don't know what else to try...

                 

                Thanks again!

                • 5. Re: V8Compatible: How to set it in JBoss?
                  jaikiran pai Master

                  For the sake of completeness, please post your *-ds.xml file. Let's see if that has any issues.

                  • 6. Re: V8Compatible: How to set it in JBoss?
                    Davide Cicuta Newbie

                    I'd be happy to share my success...

                    but I haven't had any...

                     

                    I'll let you know the replies from the other community...

                    • 7. Re: V8Compatible: How to set it in JBoss?
                      Francisco Fernandez Newbie

                      Hello,

                       

                      If you use "Jboss + Eclipse + Jboss-Seam + Jboss-Tools" and start your Jboss from Eclipse Server View, you need to add the argument into "Window/Preferences/Java/Installed JREs" and edit the entry you use, then, add argument -Doracle.jdbc.V8Compatible=true into "DefaultVM Arguments" field.

                       

                      I use obdbc14.jar library with same configuration and working.

                       

                      With that, all Date fields will use date/time format. If you want use only date format, you must add "@Temporal(TemporalType.DATE)" annotation to desired field.

                       

                      Regards.

                      Francisco.