castor
  1. castor
  2. CASTOR-831

not possible to specify the pooling parameter "cache-scheme" for Oracle connects

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 0.9.5.3
    • Fix Version/s: 0.9.9 M1
    • Component/s: JDO
    • Labels:
      None
    • Environment:
      Operating System: Windows 2000
      Platform: PC
    • Bugzilla Id:
      1691
    • Number of attachments :
      6

      Description

      To activate connection pooling using the Oracle JDBC driver, one has to use
      the "data-source" form of configuration. This is a correct example for a
      database configuration:

      <database name="database" engine="oracle">
      <data-source class-name="oracle.jdbc.pool.OracleConnectionCacheImpl">
      <params URL="jdbc:oracle:thin:@localhost:1521:TEST" user="scott"
      password="tiger" />
      </data-source>
      ...
      </database>

      This activates Oracle connection pooling using the default parameters.

      Optionally you can add additional parameters in <params> such as:

      cache-time-to-live-timeout="30"
      cache-fixed-wait-timeout="30"
      max-limit="10"

      What doesn't work is to specify an caching scheme using:

      cache-scheme="OracleConnectionCacheImpl.DYNAMIC_SCHEME"

      This results in an exception: (using Castor 0.9.5.3)
      java.lang.NumberFormatException: For input
      string: "OracleConnectionCacheImpl.FIXED_SCHEME"
      at java.lang.NumberFormatException.forInputString(Unknown Source)
      at java.lang.Integer.parseInt(Unknown Source)
      at java.lang.Integer.<init>(Unknown Source)
      at org.exolab.castor.xml.UnmarshalHandler.toPrimitiveObject
      (UnmarshalHandler.java:3303)
      at org.exolab.castor.xml.UnmarshalHandler.processAttribute
      (UnmarshalHandler.java:2770)
      at org.exolab.castor.xml.UnmarshalHandler.processAttributes
      (UnmarshalHandler.java:2479)
      at org.exolab.castor.xml.UnmarshalHandler.startElement
      (UnmarshalHandler.java:2147)
      at org.exolab.castor.xml.UnmarshalHandler.startElement
      (UnmarshalHandler.java:1292)
      at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376)
      at org.apache.xerces.validators.common.XMLValidator.callStartElement
      (XMLValidator.java:1197)
      at org.apache.xerces.framework.XMLDocumentScanner.scanElement
      (XMLDocumentScanner.java:1862)
      at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch
      (XMLDocumentScanner.java:1238)
      at org.apache.xerces.framework.XMLDocumentScanner.parseSome
      (XMLDocumentScanner.java:381)
      at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:605)
      at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase
      (DatabaseRegistry.java:235)
      at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:603)
      at ScottTest.run(ScottTest.java:63)
      at ScottTest.main(ScottTest.java:23)

      It seems, Castor doesn't translate the expression constant into a numeric value.

      The following option to specify a caching scheme doesn't work either:
      cache-scheme="1"

      This results in another exception:
      java.lang.IllegalArgumentException: Type conversion error: could not set value
      of cacheScheme(java.lang.Integer) with value of type java.lang.Integer
      at org.exolab.castor.mapping.loader.FieldHandlerImpl.setValue
      (FieldHandlerImpl.java:474)
      at org.exolab.castor.xml.UnmarshalHandler.processAttribute
      (UnmarshalHandler.java:2779)
      at org.exolab.castor.xml.UnmarshalHandler.processAttributes
      (UnmarshalHandler.java:2479)
      at org.exolab.castor.xml.UnmarshalHandler.startElement
      (UnmarshalHandler.java:2147)
      at org.exolab.castor.xml.UnmarshalHandler.startElement
      (UnmarshalHandler.java:1292)
      at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376)
      at org.apache.xerces.validators.common.XMLValidator.callStartElement
      (XMLValidator.java:1197)
      at org.apache.xerces.framework.XMLDocumentScanner.scanElement
      (XMLDocumentScanner.java:1862)
      at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch
      (XMLDocumentScanner.java:1238)
      at org.apache.xerces.framework.XMLDocumentScanner.parseSome
      (XMLDocumentScanner.java:381)
      at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1035)
      at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:605)
      at org.exolab.castor.jdo.engine.DatabaseRegistry.loadDatabase
      (DatabaseRegistry.java:235)
      at org.exolab.castor.jdo.JDO.getDatabase(JDO.java:603)
      at ScottTest.run(ScottTest.java:63)
      at ScottTest.main(ScottTest.java:23)

      This error occures, because the function setCacheScheme() excpects a 'long'
      parameter, not a parameter of type 'int'. And Castor doesn't convert it from
      java.lang.Integer to long.

      1. 1691-updated.patch
        23 kB
        Martin Fuchs
      2. castor-1691.patch
        17 kB
        Martin Fuchs
      3. castor-1691-set-add.patch
        25 kB
        Martin Fuchs
      4. castor-1691-set-add.patch
        25 kB
        Martin Fuchs
      5. castor-1691-updated.patch
        25 kB
        Martin Fuchs

        Issue Links

          Activity

          Hide
          Werner Guttmann added a comment -

          As we just backed out CASTOR-831, this should run successfully again.

          Show
          Werner Guttmann added a comment - As we just backed out CASTOR-831 , this should run successfully again.
          Hide
          Martin Onis added a comment -

          > Thanks, Martin. I'll try to get this patch applied today or (at latest)
          > tomorrow at work. I assume it will have dawned upon you that once I have
          > checked this patch in, we are not going to support multiple set-methods
          > (with different types) anymore. But with Greg's regression test, it
          > should be straight forward for you to come up with a new patch that does
          > not run into the problems we are currently seeing.

          I tried this test case, but can't see any problems - neither with this patch not without it:

          D:\Castor\CTF-Tests>ctfrun -text src\tests\xml\RegressionTestSuite\mapping\GSC_Regression
          The system cannot find the file specified.
          .\build\classes;.\build\tests;D:\java\j2sdk1.4.2_06\lib\tools.jar;lib\adaptx-0.9.13.jar;lib\ant-1.6-
          launcher.jar;lib\ant-1.6.jar;lib\cglib-full-2.0.2.jar;lib\commons-logging.jar;lib\hsqldb.jar;lib\jak
          arta-oro-2.0.5.jar;lib\jakarta-regexp-1.1.jar;lib\jdbc-se2.0.jar;lib\jndi_1.2.1.jar;lib\jta1.0.1.jar
          ;lib\jtf-0.1.jar;lib\junit_3.8.1.jar;lib\ldapjdk_4.1.jar;lib\log4j-1.2.8.jar;lib\mysql-connector-jav
          a-3.0.15-ga-bin.jar;lib\mysql-connector-java-3.0.16-ga-bin.jar;lib\mysql-connector-java-3.1.6-bin.ja
          r;lib\ojdbc14.jar;lib\postgresql.jar;lib\servlet.jar;lib\xerces-J_1.4.0.jar
          arg: '-text'
          Running in text mode.
          arg: 'src\tests\xml\RegressionTestSuite\mapping\GSC_Regression'
          Using '1116966177968' as seed for the initialization of the pseudo-random number generator
          .
          Time: 3,265

          OK (1 test)

          Show
          Martin Onis added a comment - > Thanks, Martin. I'll try to get this patch applied today or (at latest) > tomorrow at work. I assume it will have dawned upon you that once I have > checked this patch in, we are not going to support multiple set-methods > (with different types) anymore. But with Greg's regression test, it > should be straight forward for you to come up with a new patch that does > not run into the problems we are currently seeing. I tried this test case, but can't see any problems - neither with this patch not without it: D:\Castor\CTF-Tests>ctfrun -text src\tests\xml\RegressionTestSuite\mapping\GSC_Regression The system cannot find the file specified. .\build\classes;.\build\tests;D:\java\j2sdk1.4.2_06\lib\tools.jar;lib\adaptx-0.9.13.jar;lib\ant-1.6- launcher.jar;lib\ant-1.6.jar;lib\cglib-full-2.0.2.jar;lib\commons-logging.jar;lib\hsqldb.jar;lib\jak arta-oro-2.0.5.jar;lib\jakarta-regexp-1.1.jar;lib\jdbc-se2.0.jar;lib\jndi_1.2.1.jar;lib\jta1.0.1.jar ;lib\jtf-0.1.jar;lib\junit_3.8.1.jar;lib\ldapjdk_4.1.jar;lib\log4j-1.2.8.jar;lib\mysql-connector-jav a-3.0.15-ga-bin.jar;lib\mysql-connector-java-3.0.16-ga-bin.jar;lib\mysql-connector-java-3.1.6-bin.ja r;lib\ojdbc14.jar;lib\postgresql.jar;lib\servlet.jar;lib\xerces-J_1.4.0.jar arg: '-text' Running in text mode. arg: 'src\tests\xml\RegressionTestSuite\mapping\GSC_Regression' Using '1116966177968' as seed for the initialization of the pseudo-random number generator . Time: 3,265 OK (1 test)
          Hide
          Ralf Joachim added a comment -

          Patch has been reverted due to problem described at CASTOR-1147

          Show
          Ralf Joachim added a comment - Patch has been reverted due to problem described at CASTOR-1147
          Hide
          Ralf Joachim added a comment -

          While working at CASTOR-943 I needed to change setting of parameters on datasource fromusing Unmarshaller to java reflections. according to this change this patch doesn't apply any longer. Having said that with CASTOR-943 also setting cache-scheme is possible with the syntax:

          cache-scheme=1

          still the syntax with using the CACHE_SCHEME_DYNAMIC constant of the oracle driver is not possible but IMO not required. I'll therefore close this issue as duplicate.

          Show
          Ralf Joachim added a comment - While working at CASTOR-943 I needed to change setting of parameters on datasource fromusing Unmarshaller to java reflections. according to this change this patch doesn't apply any longer. Having said that with CASTOR-943 also setting cache-scheme is possible with the syntax: cache-scheme=1 still the syntax with using the CACHE_SCHEME_DYNAMIC constant of the oracle driver is not possible but IMO not required. I'll therefore close this issue as duplicate.
          Hide
          Ralf Joachim added a comment -

          Changed my opinon and resolve this one as 'Won't fix'

          Show
          Ralf Joachim added a comment - Changed my opinon and resolve this one as 'Won't fix'

            People

            • Assignee:
              Unassigned
              Reporter:
              Martin Fuchs
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: