[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

YAJB and JDBC?

jared.r.richardson@gmail.com

9/1/2006 11:12:00 AM

Hi all,

I'm tinkering with Yet Another Java Bridge
(http://www.cmt.phys.kyushu-u.ac.jp/~M.Sakurai/cgi-bin/fw/wiki.cgi...)
and a JDBC driver. I'm wondering if anyone has tried this and might
have a few examples laying around?

btw, YAJB works very nicely so far. :)

Much thanks!

Jared
http://jaredrich...

3 Answers

jared.r.richardson@gmail.com

9/1/2006 1:40:00 PM

0


jared.r.richardson@gmail.com wrote:
> Hi all,
>
> I'm tinkering with Yet Another Java Bridge
> (http://www.cmt.phys.kyushu-u.ac.jp/~M.Sakurai/cgi-bin/fw/wiki.cgi...)
> and a JDBC driver. I'm wondering if anyone has tried this and might
> have a few examples laying around?
>
> btw, YAJB works very nicely so far. :)
>
> Much thanks!
>
> Jared
> http://jaredrich...

I'm getting there... here's a working example.

require 'yajb/jbridge'

JBRIDGE_OPTIONS = { :classpath =>
"/Users/jared/work/hypersonic/tinkering/lib/hsqldb.jar"}

include JavaBridge

jimport "java.sql.*"
jimport "org.hsqldb.*"


class_instance = jstatic Class
class_instance.forName("org.hsqldb.jdbcDriver" )

driver_manager = jstatic :DriverManager
conn = driver_manager.getConnection("jdbc:hsqldb:file:testdb", "sa",
"")
statement = conn.createStatement

statement.executeUpdate("CREATE TABLE child(c1 INTEGER, c2 VARCHAR)")

Adam Keys

9/1/2006 3:35:00 PM

0

On Sep 1, 2006, at 6:15 AM, jared.r.richardson@gmail.com wrote:
> I'm tinkering with Yet Another Java Bridge
> (http://www.cmt.phys.kyushu-u.ac.jp/~M.Sakurai/cgi-bin/fw...
> page=YAJB)
> and a JDBC driver. I'm wondering if anyone has tried this and might
> have a few examples laying around?
>
> btw, YAJB works very nicely so far. :)
>

Did you try rjb at all? I'd be interested to know how they compare.

--
Adam Keys
adam@purediscovery.com




Jared Richardson

9/2/2006 12:25:00 AM

0



--

"Adam Keys" <adam@therealadam.com> wrote in message
news:5CB0A76E-F528-472D-B1CC-926BFBB9E40B@therealadam.com...
> On Sep 1, 2006, at 6:15 AM, jared.r.richardson@gmail.com wrote:
>> I'm tinkering with Yet Another Java Bridge
>> (http://www.cmt.phys.kyushu-u.ac.jp/~M.Sakurai/cgi-bin/fw...
>> page=YAJB)
>> and a JDBC driver. I'm wondering if anyone has tried this and might
>> have a few examples laying around?
>>
>> btw, YAJB works very nicely so far. :)
>>
>
> Did you try rjb at all? I'd be interested to know how they compare.
>
> --
> Adam Keys
> adam@purediscovery.com
>
>

The gem failed to compile some native extensions. While looking around to
see what I needed to tell mkmf so it could find jni.h I stumbled across YAJB
and it Just Worked. ;)

I did get an off list ping from someone about the two. RJB uses JNI and YAJB
uses a data stream over a socket, so the performance difference can be
substantial (with RJB w/JNI being much faster). Since I'm on a database
driver, I'm sure I'll end up using RJB...

But I got a skeleton of a database driver running in a day (just to Ruby,
not Active Record) using YAJB. It's really nice once you get your head into
it. I can see where it ~might~ be too slow, but I'm not convinced yet. :)

Jared
http://jaredrich...