From noreply at rubyforge.org Thu May 13 10:03:18 2010 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 May 2010 10:03:18 -0400 (EDT) Subject: [Jruby-extras-devel] [ jruby-extras-Bugs-18604 ] activerecord-jdbc does not handle schemaname.tablename naming construct with mysql Message-ID: <20100513140319.43B7F1858340@rubyforge.org> Bugs item #18604, was opened at 2008-03-04 22:05 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=18604&group_id=2014 Category: AR-JDBC Group: 0.2.3 >Status: Closed Resolution: None Priority: 3 Submitted By: Greg Orlowski (gregorlowski) Assigned to: Nobody (None) Summary: activerecord-jdbc does not handle schemaname.tablename naming construct with mysql Initial Comment: In rails with MRI + MySQL, we are able to use the following construct for setting table names in our model classes: set_table_name "#{databasename}.tablename" where databasename represents a MySQL database (schema). We need to do this because our app spans multiple databases (legacy db), and different model classes reference different schemas (effectively databases in MySQL). In JRuby with activerecord-jdbcmysql-adapter-0.7.2, (warbler deployed on tomcat), we get the error (as a rails error page): Table databasename. does not exist (where databasename is the name of our dbschema). I confirmed that if I remove the schema name, I can run a subset of our app with the model classes that use the schema named as the default schema in database.yml (in the database: section). Rails version: 1.2.6 Gems Versions: activerecord-jdbc-adapter-0.7.2 activerecord-jdbcmysql-adapter-0.7.2 Jars: mysql-connector-java-5.0.4-bin.jar jruby-complete-1.1RC2.jar goldspike-1.5.jar database.yml development: adapter: jdbcmysql database: ourdbname username: ouruser password: ourpass host: 127.0.0.1 I do have this in my environment.rb: if RUBY_PLATFORM =~ /java/ require 'rubygems' RAILS_CONNECTION_ADAPTERS = %w(jdbcmysql) require 'active_record' gem 'activerecord-jdbcmysql-adapter' require 'active_record/connection_adapters/jdbcmysql_adapter' end ---------------------------------------------------------------------- Comment By: Nick Sieger (nicksieger) Date: 2010-05-13 09:03 Message: Hi, we no longer use this tracker to track bugs here. Can you please file a copy of this bug at http://kenai.com/jira/browse/ACTIVERECORD_JDBC ? Thanks! ---------------------------------------------------------------------- Comment By: Dilshod Mukhtarov (dilshodm) Date: 2010-03-07 04:29 Message: I faced same problem with activerecord-jdbc-adapter-0.9.3 The following is a patch that solves problem. diff -Nru activerecord-jdbc-adapter-0.9.3/src/java/jdbc_adapter/RubyJdbcConnection.java activerecord-jdbc-adapter-0.9.3.new/src/java/jdbc_adapter/RubyJdbcConnection.java --- activerecord-jdbc-adapter-0.9.3/src/java/jdbc_adapter/RubyJdbcConnection.java 2009-10-26 23:25:01.000000000 +0300 +++ activerecord-jdbc-adapter-0.9.3.new/src/java/jdbc_adapter/RubyJdbcConnection.java 2010-03-07 10:35:12.000000000 +0300 @@ -135,14 +135,17 @@ if (schemaName != null) schemaName = caseConvertIdentifierForJdbc(metadata, schemaName); table_name = caseConvertIdentifierForJdbc(metadata, table_name); + String catalog = c.getCatalog(); + if (schemaName != null) { catalog = schemaName; } + String[] tableTypes = new String[]{"TABLE","VIEW","SYNONYM"}; RubyArray matchingTables = (RubyArray) tableLookupBlock(context.getRuntime(), - c.getCatalog(), schemaName, table_name, tableTypes, false).call(c); + catalog, schemaName, table_name, tableTypes, false).call(c); if (matchingTables.isEmpty()) { throw new SQLException("Table " + table_name + " does not exist"); } - results = metadata.getColumns(c.getCatalog(),schemaName,table_name,null); + results = metadata.getColumns(catalog,schemaName,table_name,null); return unmarshal_columns(context, metadata, results); } finally { close(results); ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=18604&group_id=2014 From noreply at rubyforge.org Thu May 13 10:03:54 2010 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 13 May 2010 10:03:54 -0400 (EDT) Subject: [Jruby-extras-devel] [ jruby-extras-Bugs-18604 ] activerecord-jdbc does not handle schemaname.tablename naming construct with mysql Message-ID: <20100513140354.433461D799C7@rubyforge.org> Bugs item #18604, was opened at 2008-03-04 22:05 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=18604&group_id=2014 Category: AR-JDBC Group: 0.2.3 Status: Closed Resolution: None Priority: 3 Submitted By: Greg Orlowski (gregorlowski) Assigned to: Nobody (None) Summary: activerecord-jdbc does not handle schemaname.tablename naming construct with mysql Initial Comment: In rails with MRI + MySQL, we are able to use the following construct for setting table names in our model classes: set_table_name "#{databasename}.tablename" where databasename represents a MySQL database (schema). We need to do this because our app spans multiple databases (legacy db), and different model classes reference different schemas (effectively databases in MySQL). In JRuby with activerecord-jdbcmysql-adapter-0.7.2, (warbler deployed on tomcat), we get the error (as a rails error page): Table databasename. does not exist (where databasename is the name of our dbschema). I confirmed that if I remove the schema name, I can run a subset of our app with the model classes that use the schema named as the default schema in database.yml (in the database: section). Rails version: 1.2.6 Gems Versions: activerecord-jdbc-adapter-0.7.2 activerecord-jdbcmysql-adapter-0.7.2 Jars: mysql-connector-java-5.0.4-bin.jar jruby-complete-1.1RC2.jar goldspike-1.5.jar database.yml development: adapter: jdbcmysql database: ourdbname username: ouruser password: ourpass host: 127.0.0.1 I do have this in my environment.rb: if RUBY_PLATFORM =~ /java/ require 'rubygems' RAILS_CONNECTION_ADAPTERS = %w(jdbcmysql) require 'active_record' gem 'activerecord-jdbcmysql-adapter' require 'active_record/connection_adapters/jdbcmysql_adapter' end ---------------------------------------------------------------------- >Comment By: Nick Sieger (nicksieger) Date: 2010-05-13 09:03 Message: Whoops, didn't mean to use the canned message. Meant to say that I think this is fixed now: http://kenai.com/jira/browse/ACTIVERECORD_JDBC-116 ---------------------------------------------------------------------- Comment By: Nick Sieger (nicksieger) Date: 2010-05-13 09:03 Message: Hi, we no longer use this tracker to track bugs here. Can you please file a copy of this bug at http://kenai.com/jira/browse/ACTIVERECORD_JDBC ? Thanks! ---------------------------------------------------------------------- Comment By: Dilshod Mukhtarov (dilshodm) Date: 2010-03-07 04:29 Message: I faced same problem with activerecord-jdbc-adapter-0.9.3 The following is a patch that solves problem. diff -Nru activerecord-jdbc-adapter-0.9.3/src/java/jdbc_adapter/RubyJdbcConnection.java activerecord-jdbc-adapter-0.9.3.new/src/java/jdbc_adapter/RubyJdbcConnection.java --- activerecord-jdbc-adapter-0.9.3/src/java/jdbc_adapter/RubyJdbcConnection.java 2009-10-26 23:25:01.000000000 +0300 +++ activerecord-jdbc-adapter-0.9.3.new/src/java/jdbc_adapter/RubyJdbcConnection.java 2010-03-07 10:35:12.000000000 +0300 @@ -135,14 +135,17 @@ if (schemaName != null) schemaName = caseConvertIdentifierForJdbc(metadata, schemaName); table_name = caseConvertIdentifierForJdbc(metadata, table_name); + String catalog = c.getCatalog(); + if (schemaName != null) { catalog = schemaName; } + String[] tableTypes = new String[]{"TABLE","VIEW","SYNONYM"}; RubyArray matchingTables = (RubyArray) tableLookupBlock(context.getRuntime(), - c.getCatalog(), schemaName, table_name, tableTypes, false).call(c); + catalog, schemaName, table_name, tableTypes, false).call(c); if (matchingTables.isEmpty()) { throw new SQLException("Table " + table_name + " does not exist"); } - results = metadata.getColumns(c.getCatalog(),schemaName,table_name,null); + results = metadata.getColumns(catalog,schemaName,table_name,null); return unmarshal_columns(context, metadata, results); } finally { close(results); ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=7857&aid=18604&group_id=2014 From JKAY at nwrecc.org Fri May 14 12:03:13 2010 From: JKAY at nwrecc.org (Justin Kay) Date: Fri, 14 May 2010 10:03:13 -0600 Subject: [Jruby-extras-devel] activerecord-jdbcmssql-adapter Message-ID: <90604F69-F131-4342-AB3A-A0BB6F733A7B@nwrecc.org> I just installed the AR jdbcmssql adapter for use on a rails app that connects to a MS Sql server 2000. I am having issues with Object.first. I'm getting an error about ROW_NUMBER not being a recognized as a valid function name. I found this patch http://permalink.gmane.org/gmane.comp.lang.jruby.extras.devel/1049. My question is can I specify that I'm using sql server 2000 somehow? Justin