Sequel + jruby + merb

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

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

Thanks


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

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:[email protected]> wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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. <

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

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

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

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

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

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

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

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

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. <

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

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

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 [email protected]
wrote:

=> #<Sequel::JDBC::MySQL::Dataset: “SELECT * FROM accounts”>
On Wed, Dec 17, 2008 at 1:21 AM, marc [email protected] wrote:

=> ‘localhost’)


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

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

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:

<[email protected] mailto:[email protected]> 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

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

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 [email protected] 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: [email protected] , [email protected]


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email