JRuby

Issue doing migrate with Oracle

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Cannot Reproduce
  • Affects Version/s: JRuby 0.9.9
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Mac OSX
  • Number of attachments :
    0

Description

The following bug was filed in the NetBeans Ruby support issue tracker as http://www.netbeans.org/issues/show_bug.cgi?id=104038 . It looks like a generic JRuby issue (or maybe ActiveJDBC?) to me so I'm posting it here instead of closing the NetBeans issue with a pointer to it.

The issue body text was:
Using Latest JDBC Oracle drivers,
http://download.oracle.com/otn/utilities_drivers/jdbc/10203/ojdbc14.jar

Against a 9iR2 database. I have tried the 9i JDBC drivers with the same result.

When trying to migrate db, getting the error below.

rake aborted!
java.sql.SQLException: ORA-01424: missing or illegal character following the
escape character

(See full trace by running task with --trace)

database.yml is setup as follows

development:
adapter: jdbc
driver: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@host.foo.com:1521:DEV
username: app
password: app

The tables are actually created, but after a long wait, rake eventually aborts

SQL> select table_name from user_tables;

TABLE_NAME
------------------------------
POSTS
SCHEMA_INFO

SQL>

Activity

Hide
Michael Blake added a comment -


I'm getting the same error, it occurs durring the db:schema:dump task.

Show
Michael Blake added a comment - I'm getting the same error, it occurs durring the db:schema:dump task.
Hide
Michael Blake added a comment -

I ran this with --trace and the Oracle debugging Driver.

OracleDatabaseMetaData.java:242:in `oracle.jdbc.driver.OracleDatabaseMetaData.getColumns'
JdbcAdapterInternalService.java:217:in `JdbcAdapterInternalService.columns'
null:-1:in `JdbcAdapterInternalServiceInvokerScolumnsxx1.call'
FastInvocationCallback.java:49:in `org.jruby.runtime.callback.FastInvocationCallback.execute'

It seems to crash on this statement. Replacing the question marks with a '/' duplicates the ORA-01424 error.

SELECT NULL AS table_cat,
       t.owner AS table_schem,
       t.table_name AS table_name,
       t.column_name AS column_name,
       DECODE (t.data_type, 'CHAR', 1, 'VARCHAR2', 12, 'NUMBER', 3,
               'LONG', -1, 'DATE', 91, 'RAW', -3, 'LONG RAW', -4,  
               'BLOB', 2004, 'CLOB', 2005, 'BFILE', -13, 'FLOAT', 6, 
               'TIMESTAMP(6)', 93, 'TIMESTAMP(6) WITH TIME ZONE', -101, 
               'TIMESTAMP(6) WITH LOCAL TIME ZONE', -102, 
               'INTERVAL YEAR(2) TO MONTH', -103, 
               'INTERVAL DAY(2) TO SECOND(6)', -104, 
               'BINARY_FLOAT', 100, 'BINARY_DOUBLE', 101, 
               1111)
              AS data_type,
       t.data_type AS type_name,
       DECODE (t.data_precision, null, t.data_length, t.data_precision)
              AS column_size,
       0 AS buffer_length,
       t.data_scale AS decimal_digits,
       10 AS num_prec_radix,
       DECODE (t.nullable, 'N', 0, 1) AS nullable,
       NULL AS remarks,
       t.data_default AS column_def,
       0 AS sql_data_type,
       0 AS sql_datetime_sub,
       t.data_length AS char_octet_length,
       t.column_id AS ordinal_position,
       DECODE (t.nullable, 'N', 'NO', 'YES') AS is_nullable
FROM all_tab_columns t
WHERE t.owner LIKE ? ESCAPE '/'
  AND t.table_name LIKE ? ESCAPE '/'
  AND t.column_name LIKE ? ESCAPE '/'

ORDER BY table_schem, table_name, ordinal_position;

Show
Michael Blake added a comment - I ran this with --trace and the Oracle debugging Driver.
OracleDatabaseMetaData.java:242:in `oracle.jdbc.driver.OracleDatabaseMetaData.getColumns'
JdbcAdapterInternalService.java:217:in `JdbcAdapterInternalService.columns'
null:-1:in `JdbcAdapterInternalServiceInvokerScolumnsxx1.call'
FastInvocationCallback.java:49:in `org.jruby.runtime.callback.FastInvocationCallback.execute'

It seems to crash on this statement. Replacing the question marks with a '/' duplicates the ORA-01424 error.
SELECT NULL AS table_cat,
       t.owner AS table_schem,
       t.table_name AS table_name,
       t.column_name AS column_name,
       DECODE (t.data_type, 'CHAR', 1, 'VARCHAR2', 12, 'NUMBER', 3,
               'LONG', -1, 'DATE', 91, 'RAW', -3, 'LONG RAW', -4,  
               'BLOB', 2004, 'CLOB', 2005, 'BFILE', -13, 'FLOAT', 6, 
               'TIMESTAMP(6)', 93, 'TIMESTAMP(6) WITH TIME ZONE', -101, 
               'TIMESTAMP(6) WITH LOCAL TIME ZONE', -102, 
               'INTERVAL YEAR(2) TO MONTH', -103, 
               'INTERVAL DAY(2) TO SECOND(6)', -104, 
               'BINARY_FLOAT', 100, 'BINARY_DOUBLE', 101, 
               1111)
              AS data_type,
       t.data_type AS type_name,
       DECODE (t.data_precision, null, t.data_length, t.data_precision)
              AS column_size,
       0 AS buffer_length,
       t.data_scale AS decimal_digits,
       10 AS num_prec_radix,
       DECODE (t.nullable, 'N', 0, 1) AS nullable,
       NULL AS remarks,
       t.data_default AS column_def,
       0 AS sql_data_type,
       0 AS sql_datetime_sub,
       t.data_length AS char_octet_length,
       t.column_id AS ordinal_position,
       DECODE (t.nullable, 'N', 'NO', 'YES') AS is_nullable
FROM all_tab_columns t
WHERE t.owner LIKE ? ESCAPE '/'
  AND t.table_name LIKE ? ESCAPE '/'
  AND t.column_name LIKE ? ESCAPE '/'

ORDER BY table_schem, table_name, ordinal_position;

Hide
Jon Spalding added a comment -

We have had this error also. After doing some digging we found that the problem was caused by there being an underscore in the database user name. AR-JDBC seems to try and escape the underscore when it doesn't need to leading to the 'missing or illegal character' message.

As a workaround whilst this is fixed we removed the underscore from the user name.

Show
Jon Spalding added a comment - We have had this error also. After doing some digging we found that the problem was caused by there being an underscore in the database user name. AR-JDBC seems to try and escape the underscore when it doesn't need to leading to the 'missing or illegal character' message. As a workaround whilst this is fixed we removed the underscore from the user name.
Hide
Nick Sieger added a comment -

Anyone watching this or voting on it care to comment on whether it's still an issue? I suspect it is, but don't have the environment to confirm at the moment.

Also, a concrete test case would be appreciated.

Show
Nick Sieger added a comment - Anyone watching this or voting on it care to comment on whether it's still an issue? I suspect it is, but don't have the environment to confirm at the moment. Also, a concrete test case would be appreciated.
Hide
Bernie T added a comment -

Yes, I'm still experiencing exactly the same issue, and confirmed it by removing an underscore from a user name. I was REALLY glad to find out it wasn't my original code though.

One minor point: I think the tiny inflexibility caused by this tiny bug is precisely what my managers mean when they say "RoR isn't mature and robust enough to handle enterprise applications." It'd be a bummer to throw the baby out with the water because of minor imperfections like this :-/

Nonetheless, excellent job so far! jRuby has opened a back door for us to get real work done in reasonable time frames. I LOVE it. (I'm sure you haven't heard that before.)

Thanks everyone!

Show
Bernie T added a comment - Yes, I'm still experiencing exactly the same issue, and confirmed it by removing an underscore from a user name. I was REALLY glad to find out it wasn't my original code though. One minor point: I think the tiny inflexibility caused by this tiny bug is precisely what my managers mean when they say "RoR isn't mature and robust enough to handle enterprise applications." It'd be a bummer to throw the baby out with the water because of minor imperfections like this :-/ Nonetheless, excellent job so far! jRuby has opened a back door for us to get real work done in reasonable time frames. I LOVE it. (I'm sure you haven't heard that before.) Thanks everyone!
Hide
Charles Oliver Nutter added a comment -

We need a concrete test case and re-testing against more recent AR-JDBC Oracle support, which passes 100% of Rails tests now. Barring followup, we will probably punt this.

Show
Charles Oliver Nutter added a comment - We need a concrete test case and re-testing against more recent AR-JDBC Oracle support, which passes 100% of Rails tests now. Barring followup, we will probably punt this.
Hide
Nick Sieger added a comment -

Closing due to staleness. Please open a new one if you still observe this behavior.

In particular, Oracle support should be improved in recent releases. Please try 0.7.2 when it is released (due shortly).

Show
Nick Sieger added a comment - Closing due to staleness. Please open a new one if you still observe this behavior. In particular, Oracle support should be improved in recent releases. Please try 0.7.2 when it is released (due shortly).

People

Vote (5)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: