Issue Details (XML | Word | Printable)

Key: JRUBY-970
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Major Major
Assignee: Thomas E Enebo
Reporter: Tor Norbye
Votes: 5
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JRuby

Issue doing migrate with Oracle

Created: 21/May/07 04:01 PM   Updated: 23/Apr/08 10:09 AM
Component/s: ActiveRecord-JDBC
Affects Version/s: JRuby 0.9.9
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Mac OSX


 Description  « Hide
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>



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Michael Blake added a comment - 24/May/07 12:12 AM

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

Michael Blake added a comment - 24/May/07 01:11 PM

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;


Jon Spalding added a comment - 17/Jul/07 10:42 AM
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.


Nick Sieger added a comment - 16/Aug/07 01:14 PM
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.


Bernie T added a comment - 27/Sep/07 12:56 AM
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!


Charles Oliver Nutter added a comment - 23/Oct/07 02:38 PM
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.

Nick Sieger added a comment - 12/Feb/08 12:07 PM
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).