R: Re: [jruby-user] sqljdbc4.jar and rails 3

macbook:teste fpellegrini$ pwd
/Users/fpellegrini/teste

macbook:teste fpellegrini$ $CLASSPATH
-bash: /Users/fpellegrini/teste/lib/sqljdbc4.jar: Permission denied

macbook:teste fpellegrini$ ls -la
/Users/fpellegrini/teste/lib/sqljdbc4.jar

-rw-r–[email protected] 1 fpellegrini staff 466359 6 Ago 09:47
/Users/fpellegrini/teste/lib/sqljdbc4.jar

CLASSPATH seems ok…

Francesco

----- Messaggio originale -----
Da: Luis Landeiro R. [[email protected]]
Inviato: 08/08/2010 08.56 CET
A: [email protected]
Oggetto: Re: [jruby-user] sqljdbc4.jar and rails 3

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

              >
              >
              >
              >

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