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.
Khaled A. (Guest)
on 2008-12-15 11: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
Khaled A. (Guest)
on 2008-12-15 11: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
Charles Oliver N. (Guest)
on 2008-12-15 19: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:removed_email_address@domain.invalid>> wrote:
>
>


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

    http://xircles.codehaus.org/manage_email
Khaled A. (Guest)
on 2008-12-15 19: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 N. <
Ryan B. (Guest)
on 2008-12-15 20:28
(Received via mailing list)
I think the Sequel site has directions on how to set up a JDBC
connection to
a database.
james (Guest)
on 2008-12-15 21:18
(Received via mailing list)
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
marc (Guest)
on 2008-12-17 01:22
(Received via mailing list)
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
Wes G. (Guest)
on 2008-12-17 01: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
Khaled A. (Guest)
on 2008-12-17 01: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
marc (Guest)
on 2008-12-17 09:35
(Received via mailing list)
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 (Guest)
on 2008-12-17 09: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
Erno M. (Guest)
on 2008-12-17 11: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
Charles Oliver N. (Guest)
on 2008-12-17 11: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
Khaled A. (Guest)
on 2008-12-17 11: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 N. <
Sam (Guest)
on 2008-12-17 12: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
mikael (Guest)
on 2008-12-17 13: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
Dick D. (Guest)
on 2008-12-17 14: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 
<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
Thomas E Enebo (Guest)
on 2008-12-17 17: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 <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
Charles Oliver N. (Guest)
on 2008-12-17 17: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:
> <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
Matt B. (Guest)
on 2008-12-17 19: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
Thomas E Enebo (Guest)
on 2008-12-17 21: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 B. <removed_email_address@domain.invalid> 
wrote:
> --
> Matt
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>



--
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
marc (Guest)
on 2008-12-17 23:04
(Received via mailing list)
Erno M. 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.