Getting a java connection from ar-jdbc

View: New views
3 Messages — Rating Filter:   Alert me  

Getting a java connection from ar-jdbc

by rjst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

    I'm using rails with AR-JDBC. Since my rails apps uses some
libraries that require I give them jdbc connections, I'm wondering if
there's a way to get a java db connection from it ?

thanks,
Ricardo
--


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

    http://xircles.codehaus.org/manage_email



Re: Getting a java connection from ar-jdbc

by Nick Sieger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Jul 17, 2008 at 9:51 AM, Ricardo Trindade
<ricardo.trindade@...> wrote:
> Hi,
>
>   I'm using rails with AR-JDBC. Since my rails apps uses some libraries that
> require I give them jdbc connections, I'm wondering if there's a way to get
> a java db connection from it ?

Sure, I think ActiveRecord::Base.connection.connection should give you
the JDBC connection object.

/Nick

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

    http://xircles.codehaus.org/manage_email



Re: Getting a java connection from ar-jdbc

by rjst :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

    I couldn't do it the way you sugested, but this worked :

    connection = ActiveRecord::Base.connection.connection.connection_factory.connect

    However, I had to add a 'attr_reader :connection' to JdbcAdapter. I'm using version 0.7.2.

thanks,
Ricardo

Nick Sieger wrote:
On Thu, Jul 17, 2008 at 9:51 AM, Ricardo Trindade
ricardo.trindade@... wrote:
  
Hi,

  I'm using rails with AR-JDBC. Since my rails apps uses some libraries that
require I give them jdbc connections, I'm wondering if there's a way to get
a java db connection from it ?
    

Sure, I think ActiveRecord::Base.connection.connection should give you
the JDBC connection object.

/Nick

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

    http://xircles.codehaus.org/manage_email



  

--

LightInTheBox - Buy quality products at wholesale price!