Sqljdbc4.jar and rails 3

I’m trying to set up a test project for a rails app using MS SQL server
as
backend database,
but i cannot get it working.

Dev env is Mac OSX Snow leopard, jruby 1.5.1, rails 3.0.0beta4
database is MS Sql server 2005

I did download the ms sql jdbc driver from MS site and placed
sqljdbc4.jar
in jruby lib
I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar

gems installed

activerecord (3.0.0.beta4)
activerecord-jdbc-adapter (0.9.7)
activerecord-jdbcmssql-adapter (0.9.7)

database.yml

development:
host:
adapter: jdbc
username:
password:
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://;databaseName=jruby01
timeout: 5000

I created manually the database, added a table “products” with a column
“ID” and a couple of fields and filled a few records
I did generate a Product model in rails

if i run rails console and try to do Product.find i get an error saying:

com.microsoft.sqlserver.jdbc.SQLServerConnection
SEVERE: Java Runtime Environment (JRE) versione 1.6 is not supported by
this driver.
Please use the JDBC 4 driver (sqljdbc4.jar) instead.

Why does it say i have to use sqljdbc4.jar instead? instead of what? I
did
copy only the sqljdbc4.jar and not the sqljdbc.jar.

if in database.yml i change adapter from jdbc to jdbcmssql i cannot even
launch rails console

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in
establish_connection': Please install the jdbcmssql adapter:gem
install
activerecord-jdbcmssql-adapter` (no such file to load –
active_record/connection_adapters/jdbcmssql_adapter) (RuntimeError)

even in this case jdbcmssql activerecord gem was installed…

Any hint about what to do?

Many thanks and brgds

Francesco

Francesco Pellegrini
Frame Srl
email [email protected]

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

Did you follow the Rails 3 specific instructions here?
http://github.com/nicksieger/activerecord-jdbc-adapter

On Wed, Jul 28, 2010 at 2:30 AM, [email protected] wrote:

   adapter: jdbc
if i run rails console and try to do Product.find i get an error saying:
launch rails console
Many thanks and brgds


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Wed, Jul 28, 2010 at 1:30 AM, [email protected] wrote:

I did download the ms sql jdbc driver from MS site and placed sqljdbc4.jar
in jruby lib
I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar

That looks ok…

   host:
   adapter: jdbc
   username:
   password:
   driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
   url: jdbc:sqlserver://;databaseName=jruby01
   timeout: 5000

I think this still works but I’m not sure it will pick up any MS SQL
Server specific stuff in the ar-jdbcmssql code…so I would expect
jdbcmssql to be the right way to go (and perhaps just “mssql” under
Rails 3, but Nick would know better than I).

com.microsoft.sqlserver.jdbc.SQLServerConnection
SEVERE: Java Runtime Environment (JRE) versione 1.6 is not supported by this
driver.
Please use the JDBC 4 driver (sqljdbc4.jar) instead.

Why does it say i have to use sqljdbc4.jar instead? instead of what? I did
copy only the sqljdbc4.jar and not the sqljdbc.jar.

Hmm…that’s unexpected. Are you able to run a simple piece of Ruby
code that uses classes from that jar?

I can’t say we have a ton of people on SQL Server but they’re
around…you may get results from googling for it.

if in database.yml i change adapter from jdbc to jdbcmssql i cannot even
launch rails console

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in
establish_connection': Please install the jdbcmssql adapter:gem install
activerecord-jdbcmssql-adapter` (no such file to load –
active_record/connection_adapters/jdbcmssql_adapter) (RuntimeError)

even in this case jdbcmssql activerecord gem was installed…

Try just “mssql”?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,
back from one week holiday just to find out that things don’t get fixed
by
themselves… very strange…

Yes, I did follow Nick’s instructions, but still can’t get it working

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in
establish_connection': Please install the jdbcmssql adapter:gem
install
activerecord-jdbcmssql-adapter` (no such file to load –
active_record/connection_adapters/jdbcmssql_adapter) (RuntimeError)

What do I have to check to see why this error comes out? The
activerecord-jdbcmssql-adapter gem is installed (0.9.7), so why does it
say
that ih have to install it?

best regards

Francesco

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

From: Kyle W. [email protected]
To: [email protected]
Date: 28/07/2010 13.28
Subject: Re: [jruby-user] sqljdbc4.jar and rails 3

Did you follow the Rails 3 specific instructions here?
http://github.com/nicksieger/activerecord-jdbc-adapter

On Wed, Jul 28, 2010 at 2:30 AM, [email protected] wrote:

I’m trying to set up a test project for a rails app using MS SQL server
as
backend database,
but i cannot get it working.

Dev env is Mac OSX Snow leopard, jruby 1.5.1, rails 3.0.0beta4
database is MS Sql server 2005

I did download the ms sql jdbc driver from MS site and placed
sqljdbc4.jar

development:
   host:
   adapter: jdbc
   username:
   password:
   driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
   url: jdbc:sqlserver://;databaseName=jruby01
   timeout: 5000

I created manually the database, added a table “products” with a column
“ID”
and a couple of fields and filled a few records
I did generate a Product model in rails

if i run rails console and try to do Product.find i get an error saying:

com.microsoft.sqlserver.jdbc.SQLServerConnection
SEVERE: Java Runtime Environment (JRE) versione 1.6 is not supported by
this
driver.
Please use the JDBC 4 driver (sqljdbc4.jar) instead.

Why does it say i have to use sqljdbc4.jar instead? instead of what? I
did
copy only the sqljdbc4.jar and not the sqljdbc.jar.

if in database.yml i change adapter from jdbc to jdbcmssql i cannot even
launch rails console

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in

establish_connection': Please install the jdbcmssql adapter:gem
install

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora vivo.
Epitaffio sulla tomba di Jacques De Lapalisse


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

see inline

On 08/04/2010 06:19 AM, Charles Oliver N. wrote:

On Wed, Jul 28, 2010 at 1:30 AM,[email protected] wrote:

I did download the ms sql jdbc driver from MS site and placed sqljdbc4.jar
in jruby lib
I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar

That looks ok…

alternatively you can change the classpath on the environment.rb (or a
custom initializer)
as seen below

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///#{Rails.root}/lib/sqljdbc4.jar”
end

This saves you from exporting CLASSPATH everytime.
And also simplifies other tasks, like running rake tasks and IDE
integration.

   adapter: jdbc

Even though I’ve yet to try Rails 3, I’ve several apps that work with
legacy db schemas on SqlServer,

Here is a tipical db config

development:
adapter: <%= defined?(JRUBY_VERSION) ? “jdbc” : “mysql” %>
encoding: latin1
reconnect: true
pool: 5
host: localhost
username: mydb
password: mydb
database: mydb
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
schema: dbo

So using jdbc should be enough

I can’t say we have a ton of people on SQL Server but they’re
around…you may get results from googling for it.

Only sqljdbc4.jar is needed, by the way on which JVM are you running it?
Both OpenJdk an SunJdk should be ok .

Cheers,
Luis Landeiro R.

Try just “mssql”?


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Luis, Charles

thanks for your hints.

I tried a mix of them and the result is now the following:

database.yml

development:
adapter: jdbcmssql
database: myapp_development
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://;databaseName=myapp_development
username:
password:
hostname:
port: 1433

I also did a patch to Gemfile

if defined?(JRUBY_VERSION)
gem ‘activerecord-jdbc-adapter’, :require => false
gem ‘activerecord-jdbcmssql-adapter’, :require => false
else

really don’t know what to put in here for mssql

the sqllite example

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

does not help me to understand what to write for mssql

end

when launching jruby -S rails server i get the following error

jruby -S rails server
=> Booting WEBrick
=> Rails 3.0.0.beta4 application starting in development on
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:in
method_missing': undefined methodestablish_connection’ for
ActiveRecord::Base:Class (NoMethodError)

I’m lost in the middle of nowhere…

Francesco Pellegrini
Frame Srl
Via Serra 6/6
16122 Genova

Tel 010 8992200
Cell. 348 2237798
Fax 010 8992256
email [email protected]

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

From: Luis R. [email protected]
To: [email protected]
Date: 04/08/2010 11.13
Subject: Re: [jruby-user] sqljdbc4.jar and rails 3

see inline

On 08/04/2010 06:19 AM, Charles Oliver N. wrote:

On Wed, Jul 28, 2010 at 1:30 AM,[email protected] wrote:

I did download the ms sql jdbc driver from MS site and placed
sqljdbc4.jar

in jruby lib
I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar

That looks ok…

alternatively you can change the classpath on the environment.rb (or a
custom initializer)
as seen below

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///#{Rails.root}/lib/sqljdbc4.jar”
end

This saves you from exporting CLASSPATH everytime.
And also simplifies other tasks, like running rake tasks and IDE
integration.

   adapter: jdbc
   username:<username>
   password:<password>
   driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
   url: jdbc:sqlserver://<sql server ip

address>;databaseName=jruby01

   timeout: 5000

I think this still works but I’m not sure it will pick up any MS SQL
Server specific stuff in the ar-jdbcmssql code…so I would expect
jdbcmssql to be the right way to go (and perhaps just “mssql” under
Rails 3, but Nick would know better than I).

Even though I’ve yet to try Rails 3, I’ve several apps that work with
legacy db schemas on SqlServer,

Here is a tipical db config

development:
adapter: <%= defined?(JRUBY_VERSION) ? “jdbc” : “mysql” %>
encoding: latin1
reconnect: true
pool: 5
host: localhost
username: mydb
password: mydb
database: mydb
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
schema: dbo

So using jdbc should be enough

com.microsoft.sqlserver.jdbc.SQLServerConnection
SEVERE: Java Runtime Environment (JRE) versione 1.6 is not supported by
this

driver.
Please use the JDBC 4 driver (sqljdbc4.jar) instead.

Why does it say i have to use sqljdbc4.jar instead? instead of what? I
did

copy only the sqljdbc4.jar and not the sqljdbc.jar.

Hmm…that’s unexpected. Are you able to run a simple piece of Ruby
code that uses classes from that jar?

I can’t say we have a ton of people on SQL Server but they’re
around…you may get results from googling for it.

Only sqljdbc4.jar is needed, by the way on which JVM are you running it?
Both OpenJdk an SunJdk should be ok .

Cheers,
Luis Landeiro R.

if in database.yml i change adapter from jdbc to jdbcmssql i cannot even
launch rails console

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in

establish_connection': Please install the jdbcmssql adapter:gem
install
To unsubscribe from this list, please visit:

 http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On 08/05/2010 05:27 PM, [email protected]n.invalid wrote:

adapter: jdbcmssql
if defined?(JRUBY_VERSION)

ActiveRecord::Base:Class (NoMethodError)

The missing stacktrace would help us understand the problem.
Anyway I will bootstrap a rails 3 pre and check if I can get it up and
running.

Francesco,
I’ve successfully connected to a SqlServer 2k8 with the app below

http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html

Since I don’t know what’s the current list policy on file attachments,
I’ve uploaded it to hotfile to avoid spamming everyone else.

I only removed the sqljdbc4.jar file, from the lib directory to reduce
the transfer size.

My steps were:

rails new teste -d mysql
cd teste
vi config/database.yml
replaced development hash with:

development:
adapter: <%=“jdbc” if RUBY_ENGINE==“jruby”%>
encoding: latin1
reconnect: false
pool: 5
username: username
password: musernam
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://SERVER\SQLEXPRESS;databaseName=HERE_BE_DRAGONS

vi Gemfile
added
gem ‘activerecord-jdbc-adapter’, ‘0.9.7’

vi config/environment.rb
added

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///#{Rails.root}/lib/sqljdbc4.jar”
end

##Disclaimer
I’m still not fluent in rails3 there may be a better way of doing the
previous step.

[email protected]:/tmp/teste$ rails console
Loading development environment (Rails 3.0.0.rc)
jruby-head > ActiveRecord::Base.connection
=> #ActiveRecord::ConnectionAdapters::JdbcAdapter:0x5054c2b8

Also rails server is working properly as well, tried out some generated
Models
and User.first works as expected

Cheers,
Luis Landeiro R.

http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html

Here the error with the missing stacktrace

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:in
method_missing': undefined methodestablish_connection’ for
ActiveRecord::Base:Class (NoMethodError)

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/railtie.rb:55

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:17:in
`instance_eval’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:17:in
`execute_hook’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:24:in
`run_load_hooks’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:23:in
`each’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activesupport-3.0.0.beta4/lib/active_support/lazy_load_hooks.rb:23:in
`run_load_hooks’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1937

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:2
… 44 levels…
from /Users/fpellegrini/myapp/config/environment.rb:5
from /Users/fpellegrini/myapp/config/environment.rb:3:in `require’
from config.ru:3

Francesco Pellegrini

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

From: Luis R. [email protected]
To: [email protected]
Cc: [email protected]
Date: 05/08/2010 18.43
Subject: {Disarmed} Re: [jruby-user] {Disarmed} Re: [jruby-user]
sqljdbc4.jar and rails 3

On 08/05/2010 05:27 PM, [email protected] wrote:

  Luis, Charles

  thanks for your hints.

  I tried a mix of them and the result is now the following:

  database.yml

  development:
  adapter: jdbcmssql
  database: myapp_development
  driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  url: jdbc:sqlserver://<srv ip addr>;databaseName=myapp_development
  username: <username>
  password: <password>
  hostname: <srv ip addr>
  port: 1433

  I also did a patch to Gemfile

  if defined?(JRUBY_VERSION)
  gem 'activerecord-jdbc-adapter', :require => false
  gem 'activerecord-jdbcmssql-adapter', :require => false
  else
  # really don't know what to put in here for mssql
  # the sqllite example
  # gem 'sqlite3-ruby', :require => 'sqlite3'
  # does not help me to understand what to write for mssql
  end

  when launching jruby -S rails server i get the following error

  jruby -S rails server
  => Booting WEBrick
  => Rails 3.0.0.beta4 application starting in development on
  MailScanner ha rilevato un possibile tentativo di frode 

proveniente
da “0.0.0.0:3000” MailScanner warning: numerical links are often
malicious: http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:in
method_missing': undefined methodestablish_connection’ for
ActiveRecord::Base:Class (NoMethodError)

The missing stacktrace would help us understand the problem.
Anyway I will bootstrap a rails 3 pre and check if I can get it up and
running.

  I'm lost in the middle of nowhere....


  Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe 

ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

  Inactive hide details for Luis R. ---04/08/2010 

11.13.41—see
inline On 08/04/2010 06:19 AM, Charles Oliver N. wrote:Luis
Ribeiro —04/08/2010 11.13.41—see inline On 08/04/2010 06:19
AM,
Charles Oliver N. wrote:

  From: Luis R. <[email protected]>
  To: [email protected]
  Date: 04/08/2010 11.13
  Subject: Re: [jruby-user] sqljdbc4.jar and rails 3





  see inline

  On 08/04/2010 06:19 AM, Charles Oliver N. wrote:
  > On Wed, Jul 28, 2010 at 1:30 AM,<[email protected]>  wrote:
  >
  >> I did download the ms sql jdbc driver from MS site and placed
  sqljdbc4.jar
  >> in jruby lib
  >> I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar
  >>
  > That looks ok...
  >
  >
  alternatively you can change the classpath on the environment.rb 

(or
a
custom initializer)
as seen below

  if defined?(JRUBY_VERSION)
    require 'java'
    $CLASSPATH << "file:///#{Rails.root}/lib/sqljdbc4.jar"
  end

  This saves you from exporting CLASSPATH everytime.
  And also simplifies other tasks, like running rake tasks and IDE
  integration.
  >> gems installed
  >>
  >> activerecord (3.0.0.beta4)
  >> activerecord-jdbc-adapter (0.9.7)
  >> activerecord-jdbcmssql-adapter (0.9.7)
  >>
  >> database.yml
  >>
  >> development:
  >>        host:<sql server ip address>
  >>        adapter: jdbc
  >>        username:<username>
  >>        password:<password>
  >>        driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  >>        url: jdbc:sqlserver://<sql server ip
  address>;databaseName=jruby01
  >>        timeout: 5000
  >>
  > I think this still works but I'm not sure it will pick up any MS
  SQL
  > Server specific stuff in the ar-jdbcmssql code...so I would 

expect
> jdbcmssql to be the right way to go (and perhaps just “mssql”
under
> Rails 3, but Nick would know better than I).
>
>
Even though I’ve yet to try Rails 3, I’ve several apps that work
with

  legacy db schemas on SqlServer,

  Here is a tipical db config

  development:
    adapter: <%= defined?(JRUBY_VERSION) ? "jdbc" : "mysql" %>
    encoding: latin1
    reconnect: true
    pool: 5
    host: localhost
    username: mydb
    password: mydb
    database: mydb
    driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
    schema: dbo

  So using jdbc should be enough

  >> com.microsoft.sqlserver.jdbc.SQLServerConnection<init>
  >> SEVERE: Java Runtime Environment (JRE) versione 1.6 is not
  supported by this
  >> driver.
  >> Please use the JDBC 4 driver (sqljdbc4.jar) instead.
  >>
  >> Why does it say i have to use sqljdbc4.jar instead? instead of
  what? I did
  >> copy only the sqljdbc4.jar and not the sqljdbc.jar.
  >>
  > Hmm...that's unexpected. Are you able to run a simple piece of 

Ruby
> code that uses classes from that jar?
>
> I can’t say we have a ton of people on SQL Server but they’re
> around…you may get results from googling for it.
>
>

  Only sqljdbc4.jar is needed, by the way on which JVM are you 

running
it?
Both OpenJdk an SunJdk should be ok .

  Cheers,
  Luis Landeiro R.
  >> if in database.yml i change adapter from jdbc to jdbcmssql i
  cannot even
  >> launch rails console
  >>
  >> 

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in

  >> `establish_connection': Please install the jdbcmssql adapter: 

gem install >> activerecord-jdbcmssql-adapter (no such file to load –
>> active_record/connection_adapters/jdbcmssql_adapter)
(RuntimeError)
>>
>> even in this case jdbcmssql activerecord gem was installed…
>>
> Try just “mssql”?
>
> - Charlie
>
>
---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>

  ---------------------------------------------------------------------
  To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email

Hi,

The following code uses Sequel and JDBC to connect to a MSSQL server:

require ‘rubygems’

require ‘sequel’

db =
Sequel.connect(‘jdbc:sqlserver://servername:port;databaseName=xxx;user=x
xx;password=xxx’)

pdf = db[:PrintStream].first[:packingliststream]

Thanks,

Brandon H.

From: Luis R. [mailto:[email protected]]
Sent: Thursday, August 05, 2010 12:08 PM
To: [email protected]
Subject: Re: [jruby-user] {Disarmed} Re: [jruby-user] sqljdbc4.jar and
rails 3

Francesco,
I’ve successfully connected to a SqlServer 2k8 with the app below

http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html

Since I don’t know what’s the current list policy on file attachments,
I’ve uploaded it to hotfile to avoid spamming everyone else.

I only removed the sqljdbc4.jar file, from the lib directory to reduce
the transfer size.

My steps were:

rails new teste -d mysql
cd teste
vi config/database.yml
replaced development hash with:

development:
adapter: <%=“jdbc” if RUBY_ENGINE==“jruby”%>
encoding: latin1
reconnect: false
pool: 5
username: username
password: musernam
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://SERVER\SQLEXPRESS;databaseName=HERE_BE_DRAGONS

vi Gemfile
added
gem ‘activerecord-jdbc-adapter’, ‘0.9.7’

vi config/environment.rb
added

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///#{Rails.root}/lib/sqljdbc4.jar”
<file:///\#{Rails.root}/lib/sqljdbc4.jar>
end

##Disclaimer
I’m still not fluent in rails3 there may be a better way of doing the
previous step.

[email protected]:/tmp/teste$ rails console
Loading development environment (Rails 3.0.0.rc)
jruby-head > ActiveRecord::Base.connection
=> #ActiveRecord::ConnectionAdapters::JdbcAdapter:0x5054c2b8

Also rails server is working properly as well, tried out some generated
Models
and User.first works as expected

Cheers,
Luis Landeiro R.

On 08/05/2010 05:27 PM, [email protected] wrote:

Luis, Charles

thanks for your hints.

I tried a mix of them and the result is now the following:

database.yml

development:
adapter: jdbcmssql
database: myapp_development
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://;databaseName=myapp_development
username:
password:
hostname:
port: 1433

I also did a patch to Gemfile

if defined?(JRUBY_VERSION)
gem ‘activerecord-jdbc-adapter’, :require => false
gem ‘activerecord-jdbcmssql-adapter’, :require => false
else

really don’t know what to put in here for mssql

the sqllite example

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

does not help me to understand what to write for mssql

end

when launching jruby -S rails server i get the following error

jruby -S rails server
=> Booting WEBrick
=> Rails 3.0.0.beta4 application starting in development on MailScanner
warning: numerical links are often malicious: http://0.0.0.0:3000
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/
active_record/base.rb:1041:in method_missing': undefined methodestablish_connection’ for ActiveRecord::Base:Class (NoMethodError)

I’m lost in the middle of nowhere…

Francesco Pellegrini
Frame Srl
Via Serra 6/6
16122 Genova

Tel 010 8992200
Cell. 348 2237798
Fax 010 8992256
email [email protected]

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

Luis R. —04/08/2010 11.13.41—see inline On 08/04/2010 06:19
AM, Charles Oliver N. wrote:

From: Luis R. [email protected]
mailto:[email protected]
To: [email protected]
Date: 04/08/2010 11.13
Subject: Re: [jruby-user] sqljdbc4.jar and rails 3


see inline

On 08/04/2010 06:19 AM, Charles Oliver N. wrote:

On Wed, Jul 28, 2010 at 1:30 AM,[email protected]
mailto:[email protected] wrote:

I did download the ms sql jdbc driver from MS site and placed
sqljdbc4.jar

in jruby lib
I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar

That looks ok…

alternatively you can change the classpath on the environment.rb (or a
custom initializer)
as seen below

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///# <file:///\> {Rails.root}/lib/sqljdbc4.jar”
end

This saves you from exporting CLASSPATH everytime.
And also simplifies other tasks, like running rake tasks and IDE
integration.

   adapter: jdbc
   username:<username>
   password:<password>
   driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
   url: jdbc:sqlserver://<sql server ip

address>;databaseName=jruby01

   timeout: 5000

I think this still works but I’m not sure it will pick up any MS SQL
Server specific stuff in the ar-jdbcmssql code…so I would expect
jdbcmssql to be the right way to go (and perhaps just “mssql” under
Rails 3, but Nick would know better than I).

Even though I’ve yet to try Rails 3, I’ve several apps that work with
legacy db schemas on SqlServer,

Here is a tipical db config

development:
adapter: <%= defined?(JRUBY_VERSION) ? “jdbc” : “mysql” %>
encoding: latin1
reconnect: true
pool: 5
host: localhost
username: mydb
password: mydb
database: mydb
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
schema: dbo

So using jdbc should be enough

com.microsoft.sqlserver.jdbc.SQLServerConnection
SEVERE: Java Runtime Environment (JRE) versione 1.6 is not supported
by this

driver.
Please use the JDBC 4 driver (sqljdbc4.jar) instead.

Why does it say i have to use sqljdbc4.jar instead? instead of what?
I did

copy only the sqljdbc4.jar and not the sqljdbc.jar.

Hmm…that’s unexpected. Are you able to run a simple piece of Ruby
code that uses classes from that jar?

I can’t say we have a ton of people on SQL Server but they’re
around…you may get results from googling for it.

Only sqljdbc4.jar is needed, by the way on which JVM are you running it?
Both OpenJdk an SunJdk should be ok .

Cheers,
Luis Landeiro R.

if in database.yml i change adapter from jdbc to jdbcmssql i cannot
even

launch rails console

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/
active_record/connection_adapters/abstract/connection_specification.rb:7
6:in

establish_connection': Please install the jdbcmssql adapter:gem
install
To unsubscribe from this list, please visit:

 http://xircles.codehaus.org/manage_email

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Is it possible that the problem is related to Jruby version?

jruby --version
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java
HotSpot
™ 64-Bit Server VM 1.6.0_20) [x86_64-java]

Franesco

Francesco Pellegrini
Frame Srl
Via Serra 6/6
16122 Genova

Tel 010 8992200
Cell. 348 2237798
Fax 010 8992256
email [email protected]

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

From: Luis R. [email protected]
To: [email protected]
Date: 05/08/2010 19.09
Subject: {Disarmed} Re: [jruby-user] {Disarmed} Re: [jruby-user]
sqljdbc4.jar and rails 3

Francesco,
I’ve successfully connected to a SqlServer 2k8 with the app below

http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html

Since I don’t know what’s the current list policy on file attachments,
I’ve uploaded it to hotfile to avoid spamming everyone else.

I only removed the sqljdbc4.jar file, from the lib directory to reduce
the
transfer size.

My steps were:

rails new teste -d mysql
cd teste
vi config/database.yml
replaced development hash with:

development:
adapter: <%=“jdbc” if RUBY_ENGINE==“jruby”%>
encoding: latin1
reconnect: false
pool: 5
username: username
password: musernam
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://SERVER\SQLEXPRESS;databaseName=HERE_BE_DRAGONS

vi Gemfile
added
gem ‘activerecord-jdbc-adapter’, ‘0.9.7’

vi config/environment.rb
added

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///#{Rails.root}/lib/sqljdbc4.jar”
end

##Disclaimer
I’m still not fluent in rails3 there may be a better way of doing the
previous step.

[email protected]:/tmp/teste$ rails console
Loading development environment (Rails 3.0.0.rc)
jruby-head > ActiveRecord::Base.connection
=> #ActiveRecord::ConnectionAdapters::JdbcAdapter:0x5054c2b8

Also rails server is working properly as well, tried out some generated
Models
and User.first works as expected

Cheers,
Luis Landeiro R.

On 08/05/2010 05:27 PM, [email protected] wrote:

  Luis, Charles

  thanks for your hints.

  I tried a mix of them and the result is now the following:

  database.yml

  development:
  adapter: jdbcmssql
  database: myapp_development
  driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  url: jdbc:sqlserver://<srv ip addr>;databaseName=myapp_development
  username: <username>
  password: <password>
  hostname: <srv ip addr>
  port: 1433

  I also did a patch to Gemfile

  if defined?(JRUBY_VERSION)
  gem 'activerecord-jdbc-adapter', :require => false
  gem 'activerecord-jdbcmssql-adapter', :require => false
  else
  # really don't know what to put in here for mssql
  # the sqllite example
  # gem 'sqlite3-ruby', :require => 'sqlite3'
  # does not help me to understand what to write for mssql
  end

  when launching jruby -S rails server i get the following error

  jruby -S rails server
  => Booting WEBrick
  => Rails 3.0.0.beta4 application starting in development on
  MailScanner ha rilevato un possibile tentativo di frode 

proveniente
da “0.0.0.0:3000” MailScanner warning: numerical links are often
malicious: http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:in
method_missing': undefined methodestablish_connection’ for
ActiveRecord::Base:Class (NoMethodError)

  I'm lost in the middle of nowhere....


  Francesco Pellegrini
  Frame Srl
  Via Serra 6/6
  16122 Genova

  Tel 010 8992200
  Cell. 348 2237798
  Fax 010 8992256
  email [email protected]

  Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe 

ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

  Inactive hide details for Luis R. ---04/08/2010 

11.13.41—see
inline On 08/04/2010 06:19 AM, Charles Oliver N. wrote:Luis
Ribeiro —04/08/2010 11.13.41—see inline On 08/04/2010 06:19
AM,
Charles Oliver N. wrote:

  From: Luis R. <[email protected]>
  To: [email protected]
  Date: 04/08/2010 11.13
  Subject: Re: [jruby-user] sqljdbc4.jar and rails 3





  see inline

  On 08/04/2010 06:19 AM, Charles Oliver N. wrote:
  > On Wed, Jul 28, 2010 at 1:30 AM,<[email protected]>  wrote:
  >
  >> I did download the ms sql jdbc driver from MS site and placed
  sqljdbc4.jar
  >> in jruby lib
  >> I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar
  >>
  > That looks ok...
  >
  >
  alternatively you can change the classpath on the environment.rb 

(or
a
custom initializer)
as seen below

  if defined?(JRUBY_VERSION)
    require 'java'
    $CLASSPATH << "file:///#{Rails.root}/lib/sqljdbc4.jar"
  end

  This saves you from exporting CLASSPATH everytime.
  And also simplifies other tasks, like running rake tasks and IDE
  integration.
  >> gems installed
  >>
  >> activerecord (3.0.0.beta4)
  >> activerecord-jdbc-adapter (0.9.7)
  >> activerecord-jdbcmssql-adapter (0.9.7)
  >>
  >> database.yml
  >>
  >> development:
  >>        host:<sql server ip address>
  >>        adapter: jdbc
  >>        username:<username>
  >>        password:<password>
  >>        driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  >>        url: jdbc:sqlserver://<sql server ip
  address>;databaseName=jruby01
  >>        timeout: 5000
  >>
  > I think this still works but I'm not sure it will pick up any MS
  SQL
  > Server specific stuff in the ar-jdbcmssql code...so I would 

expect
> jdbcmssql to be the right way to go (and perhaps just “mssql”
under
> Rails 3, but Nick would know better than I).
>
>
Even though I’ve yet to try Rails 3, I’ve several apps that work
with

  legacy db schemas on SqlServer,

  Here is a tipical db config

  development:
    adapter: <%= defined?(JRUBY_VERSION) ? "jdbc" : "mysql" %>
    encoding: latin1
    reconnect: true
    pool: 5
    host: localhost
    username: mydb
    password: mydb
    database: mydb
    driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
    schema: dbo

  So using jdbc should be enough

  >> com.microsoft.sqlserver.jdbc.SQLServerConnection<init>
  >> SEVERE: Java Runtime Environment (JRE) versione 1.6 is not
  supported by this
  >> driver.
  >> Please use the JDBC 4 driver (sqljdbc4.jar) instead.
  >>
  >> Why does it say i have to use sqljdbc4.jar instead? instead of
  what? I did
  >> copy only the sqljdbc4.jar and not the sqljdbc.jar.
  >>
  > Hmm...that's unexpected. Are you able to run a simple piece of 

Ruby
> code that uses classes from that jar?
>
> I can’t say we have a ton of people on SQL Server but they’re
> around…you may get results from googling for it.
>
>

  Only sqljdbc4.jar is needed, by the way on which JVM are you 

running
it?
Both OpenJdk an SunJdk should be ok .

  Cheers,
  Luis Landeiro R.
  >> if in database.yml i change adapter from jdbc to jdbcmssql i
  cannot even
  >> launch rails console
  >>
  >> 

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in

  >> `establish_connection': Please install the jdbcmssql adapter: 

gem install >> activerecord-jdbcmssql-adapter (no such file to load –
>> active_record/connection_adapters/jdbcmssql_adapter)
(RuntimeError)
>>
>> even in this case jdbcmssql activerecord gem was installed…
>>
> Try just “mssql”?
>
> - Charlie
>
>
---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>

  ---------------------------------------------------------------------
  To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email

I don’t think so, I used jruby-head but 1.5.1 should work as well.
I’m betting on the JVM, can you download jdk instead of the jre, and try
with that?

Also I’m sending you in private my jar file just to have the same
environment.

Cheers,
Luis Landeiro R.

followed your steps but still getting troubles
Generated a rails app named teste
edited database.yml, Gemfile and environment.rb
added sqljdbc4.jar in teste/lib

Then launched Jruby -S rails console,
and trying to get AR connection… KA-BOOM…

fpcasa:teste fpellegrini$ jruby -S rails console
Loading development environment (Rails 3.0.0.beta4)
irb(main):001:0> ActiveRecord::Base.connection
5-ago-2010 20.11.32 com.microsoft.sqlserver.jdbc.SQLServerConnection

SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by
this
driver. Please use the JDBC 4 driver (sqljdbc4.jar) instead.
5-ago-2010 20.11.32 com.microsoft.sqlserver.jdbc.SQLServerConnection

SEVERE: Java Runtime Environment (JRE) version 1.6 is not supported by
this
driver. Please use the JDBC 4 driver (sqljdbc4.jar) instead.
RuntimeError: The driver encountered an error:
java.lang.UnsupportedOperationException: SEVERE: Java Runtime
Environment
(JRE) version 1.6 is not supported by this driver. Please use the JDBC 4
driver (sqljdbc4.jar) instead.

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:344:in
`initialize’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in
`new’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in
`initialize’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in
`new’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in
`jdbc_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:226:in
`new_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:248:in
`checkout_new_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in
`checkout’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in
`loop’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in
checkout' from /Applications/jruby/lib/ruby/1.8/monitor.rb:191:inmon_synchronize’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in
`checkout’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:99:in
`connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:330:in
`retrieve_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:103:in
`retrieve_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:95:in
`connection’

Francesco Pellegrini
Frame Srl
Via Serra 6/6
16122 Genova

Tel 010 8992200
Cell. 348 2237798
Fax 010 8992256
email [email protected]

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

From: Luis R. [email protected]
To: [email protected]
Date: 05/08/2010 19.09
Subject: {Disarmed} Re: [jruby-user] {Disarmed} Re: [jruby-user]
sqljdbc4.jar and rails 3

Francesco,
I’ve successfully connected to a SqlServer 2k8 with the app below

http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html

Since I don’t know what’s the current list policy on file attachments,
I’ve uploaded it to hotfile to avoid spamming everyone else.

I only removed the sqljdbc4.jar file, from the lib directory to reduce
the
transfer size.

My steps were:

rails new teste -d mysql
cd teste
vi config/database.yml
replaced development hash with:

development:
adapter: <%=“jdbc” if RUBY_ENGINE==“jruby”%>
encoding: latin1
reconnect: false
pool: 5
username: username
password: musernam
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://SERVER\SQLEXPRESS;databaseName=HERE_BE_DRAGONS

vi Gemfile
added
gem ‘activerecord-jdbc-adapter’, ‘0.9.7’

vi config/environment.rb
added

if defined?(JRUBY_VERSION)
require ‘java’
$CLASSPATH << “file:///#{Rails.root}/lib/sqljdbc4.jar”
end

##Disclaimer
I’m still not fluent in rails3 there may be a better way of doing the
previous step.

[email protected]:/tmp/teste$ rails console
Loading development environment (Rails 3.0.0.rc)
jruby-head > ActiveRecord::Base.connection
=> #ActiveRecord::ConnectionAdapters::JdbcAdapter:0x5054c2b8

Also rails server is working properly as well, tried out some generated
Models
and User.first works as expected

Cheers,
Luis Landeiro R.

On 08/05/2010 05:27 PM, [email protected] wrote:

  Luis, Charles

  thanks for your hints.

  I tried a mix of them and the result is now the following:

  database.yml

  development:
  adapter: jdbcmssql
  database: myapp_development
  driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  url: jdbc:sqlserver://<srv ip addr>;databaseName=myapp_development
  username: <username>
  password: <password>
  hostname: <srv ip addr>
  port: 1433

  I also did a patch to Gemfile

  if defined?(JRUBY_VERSION)
  gem 'activerecord-jdbc-adapter', :require => false
  gem 'activerecord-jdbcmssql-adapter', :require => false
  else
  # really don't know what to put in here for mssql
  # the sqllite example
  # gem 'sqlite3-ruby', :require => 'sqlite3'
  # does not help me to understand what to write for mssql
  end

  when launching jruby -S rails server i get the following error

  jruby -S rails server
  => Booting WEBrick
  => Rails 3.0.0.beta4 application starting in development on
  MailScanner ha rilevato un possibile tentativo di frode 

proveniente
da “0.0.0.0:3000” MailScanner warning: numerical links are often
malicious: http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:in
method_missing': undefined methodestablish_connection’ for
ActiveRecord::Base:Class (NoMethodError)

  I'm lost in the middle of nowhere....


  Francesco Pellegrini
  Frame Srl
  Via Serra 6/6
  16122 Genova

  Tel 010 8992200
  Cell. 348 2237798
  Fax 010 8992256
  email [email protected]

  Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe 

ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

  Inactive hide details for Luis R. ---04/08/2010 

11.13.41—see
inline On 08/04/2010 06:19 AM, Charles Oliver N. wrote:Luis
Ribeiro —04/08/2010 11.13.41—see inline On 08/04/2010 06:19
AM,
Charles Oliver N. wrote:

  From: Luis R. <[email protected]>
  To: [email protected]
  Date: 04/08/2010 11.13
  Subject: Re: [jruby-user] sqljdbc4.jar and rails 3





  see inline

  On 08/04/2010 06:19 AM, Charles Oliver N. wrote:
  > On Wed, Jul 28, 2010 at 1:30 AM,<[email protected]>  wrote:
  >
  >> I did download the ms sql jdbc driver from MS site and placed
  sqljdbc4.jar
  >> in jruby lib
  >> I did export CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar
  >>
  > That looks ok...
  >
  >
  alternatively you can change the classpath on the environment.rb 

(or
a
custom initializer)
as seen below

  if defined?(JRUBY_VERSION)
    require 'java'
    $CLASSPATH << "file:///#{Rails.root}/lib/sqljdbc4.jar"
  end

  This saves you from exporting CLASSPATH everytime.
  And also simplifies other tasks, like running rake tasks and IDE
  integration.
  >> gems installed
  >>
  >> activerecord (3.0.0.beta4)
  >> activerecord-jdbc-adapter (0.9.7)
  >> activerecord-jdbcmssql-adapter (0.9.7)
  >>
  >> database.yml
  >>
  >> development:
  >>        host:<sql server ip address>
  >>        adapter: jdbc
  >>        username:<username>
  >>        password:<password>
  >>        driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  >>        url: jdbc:sqlserver://<sql server ip
  address>;databaseName=jruby01
  >>        timeout: 5000
  >>
  > I think this still works but I'm not sure it will pick up any MS
  SQL
  > Server specific stuff in the ar-jdbcmssql code...so I would 

expect
> jdbcmssql to be the right way to go (and perhaps just “mssql”
under
> Rails 3, but Nick would know better than I).
>
>
Even though I’ve yet to try Rails 3, I’ve several apps that work
with

  legacy db schemas on SqlServer,

  Here is a tipical db config

  development:
    adapter: <%= defined?(JRUBY_VERSION) ? "jdbc" : "mysql" %>
    encoding: latin1
    reconnect: true
    pool: 5
    host: localhost
    username: mydb
    password: mydb
    database: mydb
    driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
    url: jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
    schema: dbo

  So using jdbc should be enough

  >> com.microsoft.sqlserver.jdbc.SQLServerConnection<init>
  >> SEVERE: Java Runtime Environment (JRE) versione 1.6 is not
  supported by this
  >> driver.
  >> Please use the JDBC 4 driver (sqljdbc4.jar) instead.
  >>
  >> Why does it say i have to use sqljdbc4.jar instead? instead of
  what? I did
  >> copy only the sqljdbc4.jar and not the sqljdbc.jar.
  >>
  > Hmm...that's unexpected. Are you able to run a simple piece of 

Ruby
> code that uses classes from that jar?
>
> I can’t say we have a ton of people on SQL Server but they’re
> around…you may get results from googling for it.
>
>

  Only sqljdbc4.jar is needed, by the way on which JVM are you 

running
it?
Both OpenJdk an SunJdk should be ok .

  Cheers,
  Luis Landeiro R.
  >> if in database.yml i change adapter from jdbc to jdbcmssql i
  cannot even
  >> launch rails console
  >>
  >> 

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in

  >> `establish_connection': Please install the jdbcmssql adapter: 

gem install >> activerecord-jdbcmssql-adapter (no such file to load –
>> active_record/connection_adapters/jdbcmssql_adapter)
(RuntimeError)
>>
>> even in this case jdbcmssql activerecord gem was installed…
>>
> Try just “mssql”?
>
> - Charlie
>
>
---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
>

  ---------------------------------------------------------------------
  To unsubscribe from this list, please visit:

     http://xircles.codehaus.org/manage_email

Can you post the classpath? Possibly you have also the older jar on the
classpath somewhere in your system

Luís Landeiro R.

Em 2010/08/08 05:17, [email protected] escreveu:

Luis,

tried your sqljdbc4.jar (put it in teste/lib), but i still get the same
error.
The JRE error stating that Java 1.6 is not supported and that you have
to
use sqljdbc.jar is in Italian.

macbook:teste fpellegrini$ jruby -S rails console

Loading development environment (Rails 3.0.0.beta4)
irb(main):001:0> ActiveRecord::Base.connection

8-ago-2010 6.09.43 com.microsoft.sqlserver.jdbc.SQLServerConnection

GRAVE: Java Runtime Environment (JRE) versione 1.6 non è supportato dal
driver. Utilizzare la libreria di classi sqljdbc4.jar, che fornisce
supporto
per JDBC 4.0.
8-ago-2010 6.09.43 com.microsoft.sqlserver.jdbc.SQLServerConnection

GRAVE: Java Runtime Environment (JRE) versione 1.6 non è supportato dal
driver. Utilizzare la libreria di classi sqljdbc4.jar, che fornisce
supporto
per JDBC 4.0.
RuntimeError: The driver encountered an error:
java.lang.UnsupportedOperationException: Java Runtime Environment (JRE)
versione 1.6 non è supportato dal driver. Utilizzare la libreria di
classi
sqljdbc4.jar, che fornisce supporto per JDBC 4.0.
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:344:in
initialize' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:476:innew’
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in
initialize' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:49:innew’
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in
jdbc_connection' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:226:innew_connection’
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:248:in
checkout_new_connection' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:incheckout’
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in
loop' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:incheckout’
from /Applications/jruby/lib/ruby/1.8/monitor.rb:191:in
mon_synchronize' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:incheckout’
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:99:in
connection' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:330:inretrieve_connection’
from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:103:in
retrieve_connection' from /Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:95:inconnection’
from (irb):1irb(main):002:0>

I have Mac OSX Snow Leopard and there is full JDK installed, last Apple
software update related to Java is dated June 10

macbook:/ fpellegrini$ javac -version
javac 1.6.0_20

macbook:/ fpellegrini$ which javac
/usr/bin/javac

macbook:/ fpellegrini$ java -version
java version “1.6.0_20”
Java™ SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot™ 64-Bit Server VM (build 16.3-b01-279, mixed mode)

macbook:/ fpellegrini$ which java
/usr/bin/java

BTW, the two sqljdbc.jar files have quite different sizes, even if both
share the same creation date:

my sqljdb.jar: Created April 19 2010 19.08, size 537.303
your sqljdbc.jar: Created April 19 2010 19.08 size 466.359

It seems it does not know where to look for sqljdbc4.jar; I checked the
environment.rb and classpath declaration is ok…

Francesco Pellegrini

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba d…
[image: Inactive hide details for Luis R. —06/08/2010
09.46.13—I
don’t think so, I used jruby-head but 1.5.1 should work as we]Luis
Ribeiro
—06/08/2010 09.46.13—I don’t think so, I used jruby-head but 1.5.1
should work as well. I’m betting on the JVM, can you d

From: Luis R. [email protected]
To: [email protected]
Cc: [email protected]
Date: 06/08/2010 09.46
Subject: Re: [jruby-user] Re: {Disarmed} Re: [jruby-user] {Disarmed} Re:
[jruby-user] sqljdbc4.jar and rails 3

I don’t think so, I used jruby-head but 1.5.1 should work as well.
I’m betting on the JVM, can you download jdk instead of the jre, and try
with that?

Also I’m sending you in private my jar file just to have the same
environment.

Cheers,
Luis Landeiro R.

On 08/05/2010 07:45 PM, [email protected]
[email protected]wrote:

Is it possible that the problem is related to Jruby version?

  jruby --version
  jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java
  HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]

  Franesco

  Francesco Pellegrini
  Frame Srl
  Via Serra 6/6
  16122 Genova

  Tel 010 8992200
  Cell. 348 2237798
  Fax 010 8992256
  email 

[email protected][email protected]

  Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe 

ancora
vivo.
Epitaffio sulla tomba di…
[image: Inactive hide details for Luis R. —05/08/2010
19.09.50—Francesco, I’ve successfully connected to a SqlServer
2k8 with]Luis
Ribeiro —05/08/2010 19.09.50—Francesco, I’ve successfully
connected to a
SqlServer 2k8 with the app below

  From: Luis R. <[email protected]>
  To: [email protected]

  Date: 05/08/2010 19.09


  Subject: {Disarmed} Re: [jruby-user] {Disarmed} Re: [jruby-user]
  sqljdbc4.jar and rails 3

  ------------------------------



  Francesco,
  I've successfully connected to a SqlServer 2k8 with the app below*
  **
  **http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html*<http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html>

  Since I don't know what's the current list policy on file 

attachments,
I’ve uploaded it to hotfile to avoid spamming everyone else.

  I only removed the sqljdbc4.jar file, from the lib directory to 

reduce
the transfer size.

  My steps were:

  rails new teste -d mysql
  cd teste
  vi config/database.yml
  replaced development hash with:

  development:
  adapter: <%="jdbc" if RUBY_ENGINE=="jruby"%>
  encoding: latin1
  reconnect: false
  pool: 5
  username: username
  password: musernam


  driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  url: 

jdbc:sqlserver://SERVER\SQLEXPRESS;databaseName=HERE_BE_DRAGONS

  vi Gemfile
  added
  gem 'activerecord-jdbc-adapter', '0.9.7'

  vi config/environment.rb
  added



  if defined?(JRUBY_VERSION)
  require 'java'
  $CLASSPATH <<
  *"file:///#{Rails.root}/lib/sqljdbc4.jar"*
  end

  ##Disclaimer
  I'm still not fluent in rails3 there may be a better way of doing 

the
previous step.

  [email protected]:/tmp/teste$ rails console
  Loading development environment (Rails 3.0.0.rc)
  jruby-head > ActiveRecord::Base.connection
  => #<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x5054c2b8>

  Also rails server is working properly as well, tried out some
  generated Models
  and User.first works as expected


  Cheers,
  Luis Landeiro R.





  On 08/05/2010 05:27 PM, [email protected] wrote:


              Luis, Charles

              thanks for your hints.

              I tried a mix of them and the result is now the 

following:

              ...

              driver: com.microsoft.sqlserver.jdbc.SQLServerDriver

              url: jdbc:sqlserver://<srv ip
              addr>;databaseName=myapp_development
              username: <username>
              password: <p...
              *MailScanner ha rilevato un possibile tentativo di 

frode
proveniente da “0.0.0.0:3000” MailScanner warning:
numerical links are often
malicious:** http://0.0.0.0:3000*
http://0.0.0.0:3000/

              => Call with -d to detach
              => Ctrl-C to shutdown server
              Exiting

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:i…

              I'm lost in the middle of nowhere....

              Francesco Pellegrini
              Frame Srl
              Via Serra 6/6
              16122 Genova

              Tel 010 8992200
              Cell. 348 2237798
              Fax 010 8992256
              email

[email protected][email protected]

              Qui giace Monsieur De Lapalisse; se non fosse morto,
              sarebbe ancora vivo.
              Epitaffio sulla tomba di...

              [image: Inactive hide details for Luis R.
              ---04/08/2010 11.13.41---see inline On 08/04/2010 

06:…

              see inline

              On 08/04/2010 06:19 AM, Charles Oliver N. wrote:
              > On Wed, Jul 28, 2010 at 1:30 AM,
              *<[email protected]>* <[email protected]>
              wrote:


              >
              >> I did download the ms sql jdbc driver from MS site 

and
placed sqljdbc4.jar
>> in jruby lib…
file:///#{Rails.root}/lib/sqljdbc4.jar"

              end

              This saves you from exporting CLASSPATH everytime.
              And also simplifies other tasks, like runni...

http://xircles.codehaus.org/manage_emailhttp://xircles.codehaus.org/manage_email

              >
              >
              >
              >

Luis,

tried your sqljdbc4.jar (put it in teste/lib), but i still get the same
error.
The JRE error stating that Java 1.6 is not supported and that you have
to
use sqljdbc.jar is in Italian.

macbook:teste fpellegrini$ jruby -S rails console

Loading development environment (Rails 3.0.0.beta4)
irb(main):001:0> ActiveRecord::Base.connection

8-ago-2010 6.09.43 com.microsoft.sqlserver.jdbc.SQLServerConnection

GRAVE: Java Runtime Environment (JRE) versione 1.6 non è supportato dal
driver. Utilizzare la libreria di classi sqljdbc4.jar, che fornisce
supporto per JDBC 4.0.
8-ago-2010 6.09.43 com.microsoft.sqlserver.jdbc.SQLServerConnection

GRAVE: Java Runtime Environment (JRE) versione 1.6 non è supportato dal
driver. Utilizzare la libreria di classi sqljdbc4.jar, che fornisce
supporto per JDBC 4.0.
RuntimeError: The driver encountered an error:
java.lang.UnsupportedOperationException: Java Runtime Environment (JRE)
versione 1.6 non è supportato dal driver. Utilizzare la libreria di
classi
sqljdbc4.jar, che fornisce supporto per JDBC 4.0.

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:344:in
`initialize’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in
`new’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:476:in
`initialize’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in
`new’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-jdbc-adapter-0.9.7-java/lib/active_record/connection_adapters/jdbc_adapter.rb:49:in
`jdbc_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:226:in
`new_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:248:in
`checkout_new_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:190:in
`checkout’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in
`loop’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:186:in
checkout' from /Applications/jruby/lib/ruby/1.8/monitor.rb:191:inmon_synchronize’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:185:in
`checkout’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:99:in
`connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_pool.rb:330:in
`retrieve_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:103:in
`retrieve_connection’

from
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:95:in
`connection’
from (irb):1irb(main):002:0>

I have Mac OSX Snow Leopard and there is full JDK installed, last Apple
software update related to Java is dated June 10

macbook:/ fpellegrini$ javac -version
javac 1.6.0_20

macbook:/ fpellegrini$ which javac
/usr/bin/javac

macbook:/ fpellegrini$ java -version
java version “1.6.0_20”
Java™ SE Runtime Environment (build 1.6.0_20-b02-279-10M3065)
Java HotSpot™ 64-Bit Server VM (build 16.3-b01-279, mixed mode)

macbook:/ fpellegrini$ which java
/usr/bin/java

BTW, the two sqljdbc.jar files have quite different sizes, even if both
share the same creation date:

my sqljdb.jar: Created April 19 2010 19.08, size 537.303
your sqljdbc.jar: Created April 19 2010 19.08 size 466.359

It seems it does not know where to look for sqljdbc4.jar; I checked the
environment.rb and classpath declaration is ok…

Francesco Pellegrini

Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

From: Luis R. [email protected]
To: [email protected]
Cc: [email protected]
Date: 06/08/2010 09.46
Subject: Re: [jruby-user] Re: {Disarmed} Re: [jruby-user] {Disarmed}
Re:
[jruby-user] sqljdbc4.jar and rails 3

I don’t think so, I used jruby-head but 1.5.1 should work as well.
I’m betting on the JVM, can you download jdk instead of the jre, and try
with that?

Also I’m sending you in private my jar file just to have the same
environment.

Cheers,
Luis Landeiro R.

On 08/05/2010 07:45 PM, [email protected] wrote:

  Is it possible that the problem is related to Jruby version?

  jruby --version
  jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java
  HotSpot(TM) 64-Bit Server VM 1.6.0_20) [x86_64-java]

  Franesco

  Francesco Pellegrini
  Frame Srl
  Via Serra 6/6
  16122 Genova

  Tel 010 8992200
  Cell. 348 2237798
  Fax 010 8992256
  email [email protected]

  Qui giace Monsieur De Lapalisse; se non fosse morto, sarebbe 

ancora
vivo.
Epitaffio sulla tomba di Jacques De Lapalisse

  Inactive hide details for Luis R. ---05/08/2010
  19.09.50---Francesco, I've successfully connected to a SqlServer 

2k8
with Luis R. —05/08/2010 19.09.50—Francesco, I’ve
successfully connected to a SqlServer 2k8 with the app below

  From: Luis R. <[email protected]>
  To: [email protected]
  Date: 05/08/2010 19.09
  Subject: {Disarmed} Re: [jruby-user] {Disarmed} Re: [jruby-user]
  sqljdbc4.jar and rails 3





  Francesco,
  I've successfully connected to a SqlServer 2k8 with the app below

  http://hotfile.com/dl/60016895/3c906d2/test.tbz2.html

  Since I don't know what's the current list policy on file
  attachments,
  I've uploaded it to hotfile to avoid spamming everyone else.

  I only removed the sqljdbc4.jar file, from the lib directory to
  reduce the transfer size.

  My steps were:

  rails new teste -d mysql
  cd teste
  vi config/database.yml
  replaced development hash with:

  development:
  adapter: <%="jdbc" if RUBY_ENGINE=="jruby"%>
  encoding: latin1
  reconnect: false
  pool: 5
  username: username
  password: musernam
  driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
  url: 

jdbc:sqlserver://SERVER\SQLEXPRESS;databaseName=HERE_BE_DRAGONS

  vi Gemfile
  added
  gem 'activerecord-jdbc-adapter', '0.9.7'

  vi config/environment.rb
  added

  if defined?(JRUBY_VERSION)
  require 'java'
  $CLASSPATH << "file:///#{Rails.root}/lib/sqljdbc4.jar"
  end

  ##Disclaimer
  I'm still not fluent in rails3 there may be a better way of doing 

the
previous step.

  [email protected]:/tmp/teste$ rails console
  Loading development environment (Rails 3.0.0.rc)
  jruby-head > ActiveRecord::Base.connection
  => #<ActiveRecord::ConnectionAdapters::JdbcAdapter:0x5054c2b8>

  Also rails server is working properly as well, tried out some
  generated Models
  and User.first works as expected


  Cheers,
  Luis Landeiro R.





  On 08/05/2010 05:27 PM, [email protected] wrote:
              Luis, Charles

              thanks for your hints.

              I tried a mix of them and the result is now the
              following:

              database.yml

              development:
              adapter: jdbcmssql
              database: myapp_development
              driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
              url: jdbc:sqlserver://<srv ip
              addr>;databaseName=myapp_development
              username: <username>
              password: <password>
              hostname: <srv ip addr>
              port: 1433

              I also did a patch to Gemfile

              if defined?(JRUBY_VERSION)
              gem 'activerecord-jdbc-adapter', :require => false
              gem 'activerecord-jdbcmssql-adapter', :require => 

false
else
# really don’t know what to put in here for mssql
# the sqllite example
# gem ‘sqlite3-ruby’, :require => ‘sqlite3’
# does not help me to understand what to write for
mssql
end

              when launching jruby -S rails server i get the 

following
error

              jruby -S rails server
              => Booting WEBrick
              => Rails 3.0.0.beta4 application starting in 

development
on MailScanner ha rilevato un possibile tentativo di
frode proveniente da “0.0.0.0:3000” MailScanner
warning:
numerical links are often malicious:
http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/base.rb:1041:in
method_missing': undefined methodestablish_connection’ for
ActiveRecord::Base:Class (NoMethodError)

              I'm lost in the middle of nowhere....


              Francesco Pellegrini
              Frame Srl
              Via Serra 6/6
              16122 Genova

              Tel 010 8992200
              Cell. 348 2237798
              Fax 010 8992256
              email [email protected]

              Qui giace Monsieur De Lapalisse; se non fosse morto,
              sarebbe ancora vivo.
              Epitaffio sulla tomba di Jacques De Lapalisse


              Inactive hide details for Luis R. ---04/08/2010
              11.13.41---see inline On 08/04/2010 06:19 AM, Charles
              Oliver N. wrote:Luis R. ---04/08/2010
              11.13.41---see inline On 08/04/2010 06:19 AM, Charles
              Oliver N. wrote:

              From: Luis R. <[email protected]>
              To: [email protected]
              Date: 04/08/2010 11.13
              Subject: Re: [jruby-user] sqljdbc4.jar and rails 3


              see inline

              On 08/04/2010 06:19 AM, Charles Oliver N. wrote:
              > On Wed, Jul 28, 2010 at 1:30 AM,
              <[email protected]>  wrote:
              >
              >> I did download the ms sql jdbc driver from MS site 

and
placed sqljdbc4.jar
>> in jruby lib
>> I did export
CLASSPATH=/Applications/jruby/lib/sqljdbc4.jar
>>
> That looks ok…
>
>
alternatively you can change the classpath on the
environment.rb (or a
custom initializer)
as seen below

              if defined?(JRUBY_VERSION)
               require 'java'
               $CLASSPATH << 

“file:///#{Rails.root}/lib/sqljdbc4.jar”
end

              This saves you from exporting CLASSPATH everytime.
              And also simplifies other tasks, like running rake 

tasks
and IDE
integration.
>> gems installed
>>
>> activerecord (3.0.0.beta4)
>> activerecord-jdbc-adapter (0.9.7)
>> activerecord-jdbcmssql-adapter (0.9.7)
>>
>> database.yml
>>
>> development:
>> host:
>> adapter: jdbc
>> username:
>> password:
>> driver:
com.microsoft.sqlserver.jdbc.SQLServerDriver
>> url: jdbc:sqlserver://;databaseName=jruby01
>> timeout: 5000
>>
> I think this still works but I’m not sure it will
pick
up any MS SQL
> Server specific stuff in the ar-jdbcmssql code…so
I
would expect
> jdbcmssql to be the right way to go (and perhaps
just
“mssql” under
> Rails 3, but Nick would know better than I).
>
>
Even though I’ve yet to try Rails 3, I’ve several apps
that work with
legacy db schemas on SqlServer,

              Here is a tipical db config

              development:
               adapter: <%= defined?(JRUBY_VERSION) ? "jdbc" : 

“mysql”
%>
encoding: latin1
reconnect: true
pool: 5
host: localhost
username: mydb
password: mydb
database: mydb
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url:
jdbc:sqlserver://myserver\SQLEXPRESS;database=mydb
schema: dbo

              So using jdbc should be enough

              >> 

com.microsoft.sqlserver.jdbc.SQLServerConnection
>> SEVERE: Java Runtime Environment (JRE) versione 1.6
is
not supported by this
>> driver.
>> Please use the JDBC 4 driver (sqljdbc4.jar)
instead.
>>
>> Why does it say i have to use sqljdbc4.jar instead?
instead of what? I did
>> copy only the sqljdbc4.jar and not the sqljdbc.jar.
>>
> Hmm…that’s unexpected. Are you able to run a
simple
piece of Ruby
> code that uses classes from that jar?
>
> I can’t say we have a ton of people on SQL Server
but
they’re
> around…you may get results from googling for it.
>
>

              Only sqljdbc4.jar is needed, by the way on which JVM 

are
you running it?
Both OpenJdk an SunJdk should be ok .

              Cheers,
              Luis Landeiro R.
              >> if in database.yml i change adapter from jdbc to
              jdbcmssql i cannot even
              >> launch rails console
              >>
              >> 

/Applications/jruby/lib/ruby/gems/1.8/gems/activerecord-3.0.0.beta4/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in

              >> `establish_connection': Please install the 

jdbcmssql
adapter: gem install >> activerecord-jdbcmssql-adapter (no such file to
load

>>
active_record/connection_adapters/jdbcmssql_adapter)
(RuntimeError)
>>
>> even in this case jdbcmssql activerecord gem was
installed…
>>
> Try just “mssql”?
>
> - Charlie
>
>
---------------------------------------------------------------------

              > To unsubscribe from this list, please visit:
              >
              >      http://xircles.codehaus.org/manage_email
              >
              >
              >
              >


              ---------------------------------------------------------------------

              To unsubscribe from this list, please visit:

                http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs