Forum: JRuby sequel + jruby + merb

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C6b63e9914149409d4b007918649ae65?d=identicon&s=25 Khaled Al Habache (khelll)
on 2008-12-15 10:56
(Received via mailing list)
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
C6b63e9914149409d4b007918649ae65?d=identicon&s=25 Khaled Al Habache (khelll)
on 2008-12-15 10:58
(Received via mailing list)
Sorry i had to clarify that i need the configuration to work for mysql
:)

Thanks
___________________________
Eng Khaled alHabache
http://www.khelll.com
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-12-15 18:31
(Received via mailing list)
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 :)

Khaled al Habache wrote:
> <mailto:khellls@gmail.com>> wrote:
>
>


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

    http://xircles.codehaus.org/manage_email
C6b63e9914149409d4b007918649ae65?d=identicon&s=25 Khaled Al Habache (khelll)
on 2008-12-15 18:37
(Received via mailing list)
I'm there all the day :) , i'll do my best.
Thanks
___________________________
Eng Khaled alHabache
http://www.khelll.com



On Mon, Dec 15, 2008 at 7:30 PM, Charles Oliver Nutter <
F34d2984f36c86ecc19b32e7142a7354?d=identicon&s=25 Ryan Bell (Guest)
on 2008-12-15 19:28
(Received via mailing list)
I think the Sequel site has directions on how to set up a JDBC
connection to
a database.
Bdc2580c477e048a6ce3a6cdff596bcb?d=identicon&s=25 james (Guest)
on 2008-12-15 20:18
(Received via mailing list)
Ryan Bell 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 Britt

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

    http://xircles.codehaus.org/manage_email
9d7ceca3c2fd90d61c6ea950f42b3a9a?d=identicon&s=25 marc (Guest)
on 2008-12-17 00:22
(Received via mailing list)
james said...
> Ryan Bell 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
Bb4bdf2b184027bc38d4fb529770cde5?d=identicon&s=25 Wes Gamble (weyus)
on 2008-12-17 00:27
(Received via mailing list)
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
C6b63e9914149409d4b007918649ae65?d=identicon&s=25 Khaled Al Habache (khelll)
on 2008-12-17 00:30
(Received via mailing list)
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
9d7ceca3c2fd90d61c6ea950f42b3a9a?d=identicon&s=25 marc (Guest)
on 2008-12-17 08:35
(Received via mailing list)
Wes Gamble 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
9d7ceca3c2fd90d61c6ea950f42b3a9a?d=identicon&s=25 marc (Guest)
on 2008-12-17 08:40
(Received via mailing list)
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:in `getConnection'
        from sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
        from sun/reflect/NativeMethodAccessorImpl.java:39:in `invoke'
        from sun/reflect/DelegatingMethodAccessorImpl.java:25:in
`invoke'
        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?

--
Cheers,
Marc


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

    http://xircles.codehaus.org/manage_email
50afd27dcbdf1ce85f07f047bac630bf?d=identicon&s=25 Erno Mononen (Guest)
on 2008-12-17 10:35
(Received via mailing list)
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:in
> `invoke'
>         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
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-12-17 10:47
(Received via mailing list)
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? :)

- Charlie

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

    http://xircles.codehaus.org/manage_email
C6b63e9914149409d4b007918649ae65?d=identicon&s=25 Khaled Al Habache (khelll)
on 2008-12-17 10:57
(Received via mailing list)
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 Nutter <
Fd42b99d6d83c6ef47bbf1e9ee53ef37?d=identicon&s=25 Sam (Guest)
on 2008-12-17 11:07
(Received via mailing list)
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
D3b53a23feb47aeaf92538a797268ac3?d=identicon&s=25 mikael (Guest)
on 2008-12-17 12:15
(Received via mailing list)
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
F472b397918df02e70d8d7d0cf086c00?d=identicon&s=25 Dick Davies (Guest)
on 2008-12-17 13:19
(Received via mailing list)
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 <khellls@gmail.com>
wrote:
> => #<Sequel::JDBC::MySQL::Dataset: "SELECT * FROM `accounts`">
> On Wed, Dec 17, 2008 at 1:21 AM, marc <gmane@auxbuss.com> wrote:
>>
>> => 'localhost')
>> --
>
>

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

    http://xircles.codehaus.org/manage_email
13313ac2ec7ba7c43b1b952db034ff3b?d=identicon&s=25 Thomas E Enebo (Guest)
on 2008-12-17 16:14
(Received via mailing list)
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 <mikael@iced.se> 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: enebo@acm.org , tom.enebo@gmail.com

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

    http://xircles.codehaus.org/manage_email
Ede2aa10c6462f1d825143879be59e38?d=identicon&s=25 Charles Oliver Nutter (Guest)
on 2008-12-17 16:23
(Received via mailing list)
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:
> <charles.nutter@sun.com <mailto:charles.nutter@sun.com>> 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
5a579b3ae2e98ebcc09403f38a390216?d=identicon&s=25 Matt Burke (Guest)
on 2008-12-17 18:55
(Received via mailing list)
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
13313ac2ec7ba7c43b1b952db034ff3b?d=identicon&s=25 Thomas E Enebo (Guest)
on 2008-12-17 20:38
(Received via mailing list)
I just added Windows as a component for 1441.  If you can edit an
issue you can mark them as the windows component (and mark any other
component they may affect too).

-Tom

On Wed, Dec 17, 2008 at 11:55 AM, Matt Burke <maburke@sep.com> wrote:
> --
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>



--
Blog: http://www.bloglines.com/blog/ThomasEEnebo
Email: enebo@acm.org , tom.enebo@gmail.com

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

    http://xircles.codehaus.org/manage_email
9d7ceca3c2fd90d61c6ea950f42b3a9a?d=identicon&s=25 marc (Guest)
on 2008-12-17 22:04
(Received via mailing list)
Erno Mononen said...
> >>>>> I think the Sequel site has directions on how to set up a JDBC
> >>> now available under JRuby.
> >>> and got:
> >> $
> >> => [{:id=>1, :name=>"khelll", :mobile=>"546345333444"}, {:id=>2,
> > user=blah&password=blah")
> > der=>6}, {:quaID=>7, :quaDesc=>"Good", :quaOrder=>7}, {:quaID=>8,
> >         from sun/reflect/NativeMethodAccessorImpl.java:-2:in `invoke0'
> >
> Cheers,
> Erno

Done:

  http://www.netbeans.org/issues/show_bug.cgi?id=155708

--
Cheers,
Marc


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

    http://xircles.codehaus.org/manage_email
This topic is locked and can not be replied to.