OpenJPA
  1. OpenJPA
  2. OPENJPA-1029

SQLServerDictionary causes NumberFormatException if MS SQL Server JDBC driver is used

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-M2
    • Fix Version/s: 1.0.4, 1.2.2, 1.3.0, 2.0.0-M2
    • Component/s: third-party
    • Labels:
      None

      Description

      If the Microsoft SQL Server JDBC Driver v1.2 or 2.0 is used instead of the jTDS driver, then the SQLServerDictionary will throw an exception while trying to parse the driverName "Microsoft SQL Server JDBC Driver" to determine the server version. For the MS SQL JDBC driver, it should be using meta.getDatabaseMajorVersion() to determine the server version. Also, the MS SQL JDBC driver was not being recognized correctly, so driverVendor was being set to VENDOR_OTHER instead of VENDOR_MICROSOFT.

      java.lang.NumberFormatException: For input string: "JDBC"
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
      at java.lang.Integer.parseInt(Integer.java:447)
      at java.lang.Integer.parseInt(Integer.java:497)
      at org.apache.openjpa.jdbc.sql.SQLServerDictionary.connectedConfiguration(SQLServerDictionary.java:92)
      at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:190)
      at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:100)
      at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:584)
      at org.apache.openjpa.persistence.query.TestQueryTimeout.setUp(TestQueryTimeout.java:89)
      at junit.framework.TestCase.runBare(TestCase.java:125)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.runBare(PersistenceTestCase.java:455)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.apache.openjpa.persistence.test.PersistenceTestCase.run(PersistenceTestCase.java:182)
      at junit.framework.TestSuite.runTest(TestSuite.java:208)
      at junit.framework.TestSuite.run(TestSuite.java:203)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
      at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
      at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334)
      at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980)

      1. OPENJPA-1029.patch
        6 kB
        Donald Woods
      2. OPENJPA-1029-10x.patch
        9 kB
        Donald Woods
      3. OPENJPA-1029-12x.patch
        9 kB
        Donald Woods
      4. OPENJPA-1029-13x.patch
        9 kB
        Donald Woods
      5. OPENJPA-1029.patch
        9 kB
        Donald Woods
      6. OPENJPA-1029.patch
        6 kB
        Donald Woods

        Issue Links

          Activity

          Donald Woods created issue -
          Donald Woods made changes -
          Field Original Value New Value
          Link This issue is depended upon by OPENJPA-964 [ OPENJPA-964 ]
          Donald Woods made changes -
          Attachment OPENJPA-1029.patch [ 12405004 ]
          Donald Woods made changes -
          Assignee Donald Woods [ drwoods ] Jeremy Bauer [ techhusky ]
          Donald Woods made changes -
          Attachment OPENJPA-1029.patch [ 12405169 ]
          Donald Woods made changes -
          Attachment OPENJPA-1029-13x.patch [ 12405645 ]
          Attachment OPENJPA-1029-12x.patch [ 12405646 ]
          Attachment OPENJPA-1029-10x.patch [ 12405647 ]
          Donald Woods made changes -
          Summary SQLServerDictionary causes NumberFormatException if MS SQL JDBC v2.0 is used SQLServerDictionary causes NumberFormatException if MS SQL Server JDBC driver is used
          Description If the Microsoft SQL Server JDBC Driver is used instead of the jTDS driver, then the SQLServerDictionary will throw an exception while trying to parse the driverName to determine the server version. It should be using meta.getDatabaseMajorVersion() instead. Also, the MS SQL JDBC driver was not being recognized, so driverVendor was not getting set to VENDOR_MICROSOFT.

          java.lang.NumberFormatException: For input string: "JDBC"
          at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
          at java.lang.Integer.parseInt(Integer.java:447)
          at java.lang.Integer.parseInt(Integer.java:497)
          at org.apache.openjpa.jdbc.sql.SQLServerDictionary.connectedConfiguration(SQLServerDictionary.java:92)
          at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:190)
          at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:100)
          at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:584)
          at org.apache.openjpa.persistence.query.TestQueryTimeout.setUp(TestQueryTimeout.java:89)
          at junit.framework.TestCase.runBare(TestCase.java:125)
          at org.apache.openjpa.persistence.test.PersistenceTestCase.runBare(PersistenceTestCase.java:455)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at org.apache.openjpa.persistence.test.PersistenceTestCase.run(PersistenceTestCase.java:182)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
          at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
          at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
          at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334)
          at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980)
          If the Microsoft SQL Server JDBC Driver v1.2 or 2.0 is used instead of the jTDS driver, then the SQLServerDictionary will throw an exception while trying to parse the driverName "Microsoft SQL Server JDBC Driver" to determine the server version. For the MS SQL JDBC driver, it should be using meta.getDatabaseMajorVersion() to determine the server version. Also, the MS SQL JDBC driver was not being recognized correctly, so driverVendor was being set to VENDOR_OTHER instead of VENDOR_MICROSOFT.

          java.lang.NumberFormatException: For input string: "JDBC"
          at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
          at java.lang.Integer.parseInt(Integer.java:447)
          at java.lang.Integer.parseInt(Integer.java:497)
          at org.apache.openjpa.jdbc.sql.SQLServerDictionary.connectedConfiguration(SQLServerDictionary.java:92)
          at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:190)
          at org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:100)
          at org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:584)
          at org.apache.openjpa.persistence.query.TestQueryTimeout.setUp(TestQueryTimeout.java:89)
          at junit.framework.TestCase.runBare(TestCase.java:125)
          at org.apache.openjpa.persistence.test.PersistenceTestCase.runBare(PersistenceTestCase.java:455)
          at junit.framework.TestResult$1.protect(TestResult.java:106)
          at junit.framework.TestResult.runProtected(TestResult.java:124)
          at junit.framework.TestResult.run(TestResult.java:109)
          at junit.framework.TestCase.run(TestCase.java:118)
          at org.apache.openjpa.persistence.test.PersistenceTestCase.run(PersistenceTestCase.java:182)
          at junit.framework.TestSuite.runTest(TestSuite.java:208)
          at junit.framework.TestSuite.run(TestSuite.java:203)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:213)
          at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
          at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
          at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:585)
          at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334)
          at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980)
          Donald Woods made changes -
          Attachment OPENJPA-1029-10x.patch [ 12405647 ]
          Donald Woods made changes -
          Attachment OPENJPA-1029-12x.patch [ 12405646 ]
          Donald Woods made changes -
          Attachment OPENJPA-1029-13x.patch [ 12405645 ]
          Donald Woods made changes -
          Attachment OPENJPA-1029-13x.patch [ 12405667 ]
          Attachment OPENJPA-1029-12x.patch [ 12405668 ]
          Attachment OPENJPA-1029-10x.patch [ 12405669 ]
          Donald Woods made changes -
          Attachment OPENJPA-1029.patch [ 12405670 ]
          Jeremy Bauer made changes -
          Assignee Jeremy Bauer [ techhusky ] Donald Woods [ drwoods ]
          Donald Woods made changes -
          Assignee Donald Woods [ drwoods ] Michael Dick [ mikedd ]
          Donald Woods made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Donald Woods made changes -
          Issue Type Bug [ 1 ] Task [ 3 ]
          Donald Woods made changes -
          Issue Type Task [ 3 ] Bug [ 1 ]
          Michael Dick made changes -
          Fix Version/s 1.3.0 [ 12313326 ]
          Donald Woods made changes -
          Link This issue is duplicated by OPENJPA-1359 [ OPENJPA-1359 ]
          Michael Dick made changes -
          Fix Version/s 1.0.4 [ 12313301 ]
          Fix Version/s 1.2.2 [ 12313681 ]
          Donald Woods made changes -
          Status Resolved [ 5 ] Closed [ 6 ]

            People

            • Assignee:
              Michael Dick
              Reporter:
              Donald Woods
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development