Getting a jdbc connection from Lucee

oops… I meant to send this here, not railo. old habits etc :slight_smile:---------- Forwarded message ----------
From: “Chris Blackwell”
Date: 14 Mar 2015 21:10
Subject: Getting a jdbc connection from Lucee
To: “railo” railo@googlegroups.com
Cc:

Hey,

I’m looking at using JOOQ and flywaydb in our projects to get a bit more
control over schema & sql query versioning. I’ve got a poc working with a
model generated and a few simple queries converted. Now i’m looking at
ways to integrate into our app, and what i’d like to be able to do is ask
Lucee for a jdbc connection from the pool which i can then use to
instantiate my JOOQ query classes.

It appears i can do OrmGetSession().getConnection() which does work, but
that feels wrong, we are using orm, but might not be for much longer.

I can get a datasource reference from
getPageContext().getDatasource(‘name’) but there doesn’t appear to be a way
to get at the underlying connection, at least that i could find.

Anyone have any thoughts on this?

Cheers, Chris

It looks like you can use the DataSourceManager:

pc = getPageContext();
dsManager = pc.getDataSourceManager();
connection = dsManager.getConnection(pc, pc.getDatasource(“name”), “”, “”).
getConnection();On Sunday, March 15, 2015 at 3:01:14 PM UTC-4, Chris Blackwell wrote:

oops… I meant to send this here, not railo. old habits etc :slight_smile:

---------- Forwarded message ----------
From: “Chris Blackwell”
Date: 14 Mar 2015 21:10
Subject: Getting a jdbc connection from Lucee
To: “railo” <ra...@googlegroups.com <javascript:>>
Cc:

Hey,

I’m looking at using JOOQ and flywaydb in our projects to get a bit more
control over schema & sql query versioning. I’ve got a poc working with a
model generated and a few simple queries converted. Now i’m looking at
ways to integrate into our app, and what i’d like to be able to do is ask
Lucee for a jdbc connection from the pool which i can then use to
instantiate my JOOQ query classes.

It appears i can do OrmGetSession().getConnection() which does work, but
that feels wrong, we are using orm, but might not be for much longer.

I can get a datasource reference from
getPageContext().getDatasource(‘name’) but there doesn’t appear to be a way
to get at the underlying connection, at least that i could find.

Anyone have any thoughts on this?

Cheers, Chris