Sequel + jruby + merb


#1

Hi guys,
I’m really stuck on how to configure the database.yml for merb apps to
work
with sequel + jruby
does anyone have any idea abt that?
also , does the current merb_activerecord support multi threaded apps ?
Thanks


#2

Sorry i had to clarify that i need the configuration to work for mysql
:slight_smile:

Thanks


Eng Khaled alHabache
http://www.khelll.com


#3

I’m afraid I don’t know how that should be set up, but it’s likely the
sequel or merb guys might be able to help. If I were you I’d pop into
#merb on FreeNode IRC and ask. You may get a quicker response.

And then come back and tell us all how to do it :slight_smile:

Khaled al Habache wrote:

mailto:removed_email_address@domain.invalid> wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#4

I’m there all the day :slight_smile: , i’ll do my best.
Thanks


Eng Khaled alHabache
http://www.khelll.com

On Mon, Dec 15, 2008 at 7:30 PM, Charles Oliver N. <


#5

I think the Sequel site has directions on how to set up a JDBC
connection to
a database.


#6

Ryan B. wrote:

I think the Sequel site has directions on how to set up a JDBC connection to
a database.

Sequel.connect(“jdbc:mysql://localhost/mysql_server_name?user=someusername&password=sekritpassword”)

James B.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#7

james said…

Ryan B. wrote:

I think the Sequel site has directions on how to set up a JDBC connection to
a database.

Sequel.connect(“jdbc:mysql://localhost/mysql_server_name?user=someusername&password=sekritpassword”)

Not meaning to hijack this thread, but I didn’t realise that Sequel was
now available under JRuby.

To this end, within netbeans Dev (Build 200812100201), using JRuby HEAD,
and with sequel and jdbc-mysql gems installed, I tried:

require ‘rubygems’
require ‘sequel’

DB = Sequel.mysql(‘blah’, :user => ‘blah’, :password => ‘blah’, :host
=> ‘localhost’)

and got:

/gems/sequel-2.8.0/lib/sequel_core/database.rb:100:in `adapter_class’:
Could not load mysql adapter: (Sequel::Error::AdapterNotFound)

Works fine in regular Ruby.

What am I missing?


Cheers,
Marc


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#8

As for me this is what i could do on irb:

$
jirb

irb(main):001:0> require “sequel”
=> true
irb(main):002:0> db =
Sequel.connect(“jdbc:mysql://localhost/merbtest?user=root”)
=> #<Sequel::JDBC::Database:
“jdbc:mysql://localhost/merbtest?user=root”>
irb(main):003:0> a = db[:accounts]
=> #<Sequel::JDBC::MySQL::Dataset: "SELECT * FROM accounts">
irb(main):004:0> a.all
=> [{:id=>1, :name=>“khelll”, :mobile=>“546345333444”}, {:id=>2,
:name=>“zakwan”, :mobile=>“00963955987654”}]


Eng Khaled alHabache
http://www.khelll.com


#9

Wes G. said…

=> ‘localhost’)

DB = Sequel.mysql(‘blah’, :user => ‘blah’, :password => ‘blah’, :host
=> ‘localhost’)

that you are not connecting via JDBC.

Sorry, I’m using the above for regular Ruby, but:

DB = Sequel.connect(“jdbc:mysql://localhost/blah?
user=blah&password=blah”)

for JRuby.


Cheers,
Marc


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#10

marc wrote:

Not meaning to hijack this thread, but I didn’t realise that Sequel was

and got:

/gems/sequel-2.8.0/lib/sequel_core/database.rb:100:in `adapter_class’:
Could not load mysql adapter: (Sequel::Error::AdapterNotFound)

You may need the mysql gem in your JRuby installation. I’m guessing
based on

DB = Sequel.mysql(‘blah’, :user => ‘blah’, :password => ‘blah’, :host
=> ‘localhost’)

that you are not connecting via JDBC.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#11

Khaled al Habache said…

Sequel.connect(“jdbc:mysql://localhost/mysql_server_name?user=someusername&password=sekritpassword”)
DB = Sequel.mysql(‘blah’, :user => ‘blah’, :password => ‘blah’, :host
As for me this is what i could do on irb:
=> #<Sequel::JDBC::MySQL::Dataset: "SELECT * FROM accounts">
irb(main):004:0> a.all
=> [{:id=>1, :name=>“khelll”, :mobile=>“546345333444”}, {:id=>2,
:name=>“zakwan”, :mobile=>“00963955987654”}]

In irb, I get:

irb(main):001:0> require ‘rubygems’
=> true
irb(main):002:0> require ‘sequel’
=> true
irb(main):003:0> DB = Sequel.connect(“jdbc:mysql://localhost/blah?
user=blah&password=blah”)
=> #<Sequel::JDBC::Database: “jdbc:mysql://localhost/blah?
user=blah&password=blah”

irb(main):004:0> DB[:quality].all
=> [{:quaID=>1, :quaDesc=>“Unknown”, :quaOrder=>1}, {:quaID=>2,
:quaDesc=>“Suspect”, :quaOrder=>2},
{:quaID=>3, :quaDesc=>“Poor”, :quaOrder=>3}, {:quaID=>4, :quaDesc=>“Less
than average”, :quaOrder=>4
}, {:quaID=>5, :quaDesc=>“Average”, :quaOrder=>5}, {:quaID=>6,
:quaDesc=>“More than average”, :quaOr
der=>6}, {:quaID=>7, :quaDesc=>“Good”, :quaOrder=>7}, {:quaID=>8,
:quaDesc=>“Excellent”, :quaOrder=>
8}, {:quaID=>9, :quaDesc=>“Gold”, :quaOrder=>9}]
irb(main):005:0>

But the identical code in netbeans bombs with:

java/sql/DriverManager.java:602:in getConnection': java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/blah?user=blah&password=blah (NativeException) from java/sql/DriverManager.java:207:ingetConnection’
from sun/reflect/NativeMethodAccessorImpl.java:-2:in invoke0' from sun/reflect/NativeMethodAccessorImpl.java:39:ininvoke’
from sun/reflect/DelegatingMethodAccessorImpl.java:25:in
invoke' from java/lang/reflect/Method.java:597:ininvoke’

etc.

Looks like netbeans needs some magic to make it work. As I mentioned,
works fine with regular Ruby in netbeans.
Any ideas?


Cheers,
Marc


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#12

marc wrote:

jirb
:name=>“zakwan”, :mobile=>“00963955987654”}]
=> #<Sequel::JDBC::Database: "jdbc:mysql://localhost/blah?
:quaDesc=>“Excellent”, :quaOrder=>
from sun/reflect/NativeMethodAccessorImpl.java:39:in invoke' from sun/reflect/DelegatingMethodAccessorImpl.java:25:ininvoke’
from java/lang/reflect/Method.java:597:in `invoke’

etc.

Looks like netbeans needs some magic to make it work. As I mentioned,
works fine with regular Ruby in netbeans.
Any ideas?

I’m seeing the same behaviour, but not sure now how to workaround it.
One difference in how the IRB console is run from NetBeans is that the
VM is launched directly instead of just running the launcher script (you
can see the actual command that gets run in the log file if you turn on
detailed logging in Tools -> Options -> Ruby. Then you can view the log
in View -> IDE Log). Can you please file an issue on this into NetBeans
IZ? In 7.0 we’ll hopefully have a terminal emulator, which should fix
this and improve the IRB console experience in the IDE.

Cheers,
Erno


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#13

Charles ,
Is the current merb-activerecord gem safe threaded ?
Thanks


Eng Khaled alHabache
http://www.khelll.com

On Wed, Dec 17, 2008 at 11:46 AM, Charles Oliver N. <


#14

marc wrote:

Sorry, I’m using the above for regular Ruby, but:

DB = Sequel.connect(“jdbc:mysql://localhost/blah?
user=blah&password=blah”)

for JRuby.

Seems like it would be nice if Sequel had some smarts about the
different DB URL structures. There’s not that many to support, after
all:

Sequel.jdbc.mysql(‘blah’, :user => ‘blah’, :password => ‘blah’,
:host => ‘localhost’)

…and it would load the appropriate driver and assemble the URL. Anyone
want to whip up a patch for Sequel guys? :slight_smile:

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#15

Hi guys

It seams that Jruby dosn’t handle Windows EOL the same way as MRI
does wich causes me a lot of headaches. My ruby script produces an
output file that an older legacy program is suppose to read which
relies on 0xd,0xa line endings. Hower i can’t get jruby to produce
these but MRI manages to. Consider the following code

Jruby

irb(main):001:0> File.open(“test.txt”,“w”)
{|x|x.write(“testntestn”)}
=> 10

dir test.txt

2008-12-17 12:11 10 test.txt

MRI

irb(main):001:0> File.open(“test.txt”,“w”)
{|x|x.write(“testntestn”)}
=> 10

dir test.txt

2008-12-17 12:12 12 test.txt
I really like to be able to use on these scripts as performa a lot
quicker than 1.8.7. Is there any fix to this planned?

Regards
/Mikael


#16

I got that far myself, but don’t know how to translate that into a
working database.yml stanza.
Let us know if you work it out.

Personally I prefer the

On Tue, Dec 16, 2008 at 11:30 PM, Khaled al Habache removed_email_address@domain.invalid
wrote:

=> #<Sequel::JDBC::MySQL::Dataset: "SELECT * FROM accounts">
On Wed, Dec 17, 2008 at 1:21 AM, marc removed_email_address@domain.invalid wrote:

=> ‘localhost’)


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#17

Hi,
I also filed a bug for this here
http://jira.codehaus.org/browse/JRUBY-3248

Maybe I’m missing a step but tt seems to me that files compiled with
jrubyc on Mac OS X produce unusable output.
Here the steps to recreate. The bug report also contains a test.class
file.

  1. Create a file with content “print ‘fun’”
  2. run with standart ruby: output --> fun
  3. compile the file with jrubyc
  4. run with jruby -S file.class
    output -->
    $ jruby -S test.class
    :1: test.class:1: Invalid char `\276’ (’??’) in expression (SyntaxError)

–Sam


#18

I’m not sure; I don’t know what that gem includes. Presumably it’s Rails
2.2-based, which would mean “yes”. But I don’t know.

Khaled al Habache wrote:

<removed_email_address@domain.invalid mailto:removed_email_address@domain.invalid> wrote:

- 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

#19

Thomas E Enebo wrote:

In Jira we have a newer windows component to make it easier to see
what windows compat issues we have. I am trying to additional flag
issues involving windows to help better track things.

JRUBY-1441 is a windows compatibility bug that’s been in Jira for a
while. I didn’t see where I could change the component for it to
Windows. It’s currently “Core Classes/Modules”.


Matt


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#20

Once we add:
http://jira.codehaus.org/browse/JRUBY-2283

Then we can enable that flag during .bat processing and then
conditionally add \r\n stuff in windows.

In Jira we have a newer windows component to make it easier to see
what windows compat issues we have. I am trying to additional flag
issues involving windows to help better track things.

-Tom

On Wed, Dec 17, 2008 at 5:15 AM, mikael removed_email_address@domain.invalid wrote:

Jruby
irb(main):001:0> File.open(“test.txt”,“w”) {|x|x.write(“test\n\test\n”)}

Regards

/Mikael


Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: removed_email_address@domain.invalid , removed_email_address@domain.invalid


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email