Access Grails DB Connection?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Access Grails DB Connection?

iamjediknight
All,

Does anyone know how to access the Connection object that Grails  
uses?  I want to drop down and do some direct SQL access via the  
groovy.sql package.

thanks,

scott.

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Access Grails DB Connection?

burtbeckwith
Declare a SessionFactory bean injection in your Service:

   def sessionFactory

and then in a method you can access the current connection via

   def connection = sessionFactory.currentSession.connection()

Burt

On Saturday 01 March 2008 8:52:16 am Scott Walter wrote:

> All,
>
> Does anyone know how to access the Connection object that Grails
> uses?  I want to drop down and do some direct SQL access via the
> groovy.sql package.
>
> thanks,
>
> scott.
>
> ---------------------------------------------------------------------
> 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


Reply | Threaded
Open this post in threaded view
|

Re: Access Grails DB Connection?

iamjediknight
Thank you!

cheers,

scott.

On Mar 1, 2008, at 10:38 AM, Burt Beckwith wrote:

> Declare a SessionFactory bean injection in your Service:
>
>   def sessionFactory
>
> and then in a method you can access the current connection via
>
>   def connection = sessionFactory.currentSession.connection()
>
> Burt
>
> On Saturday 01 March 2008 8:52:16 am Scott Walter wrote:
>> All,
>>
>> Does anyone know how to access the Connection object that Grails
>> uses?  I want to drop down and do some direct SQL access via the
>> groovy.sql package.
>>
>> thanks,
>>
>> scott.
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>


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

    http://xircles.codehaus.org/manage_email