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: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: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.
lribeiro@flesh:/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 method
establish_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