DataSource Injecting...

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

DataSource Injecting...

Jonathan Carlson
Where is it best to put this hint about using javax.sql.DataSource
instead of ApplicationDatasource  to inject the DataSource into a
Service?  My proxy or something isn't letting me edit the Services page
so I'd appreciate it if someone else could add it.

I want to make Grails as easy to use by documenting things to help
others avoid the same mistakes I've made.  :-)

- Jonathan


>>> [hidden email] 2006-04-21 4:40:37 PM >>>
The edit page is spinning on me so, if I remember, I'll add it on
Monday.

>>> [hidden email] 2006-04-21 4:32:50 PM >>>
Graeme wrote:
> did you try?:
> @Property javax.sql.DataSource dataSource

Thanks!  I was so close, yet so far.  Do you mind if I add this to
http://grails.org/Services page?


>>> [hidden email] 2006-04-21 4:22:49 PM >>>
On 4/21/06, Jonathan Carlson <[hidden email]> wrote:
> Did you use the regular ApplicationDataSource, or did you try the
groovy
> way to get a connection?  I tried putting a getSqlAccess() method
like
> this in my DataService and it couldn't find the Driver:
>
> class DataService {
>
>   //@Property ApplicationDataSource applicationDataSource (This
didn't
> work either!)

did you try?:

@Property javax.sql.DataSource dataSource

Graeme

>
>   def getSqlAccess() {
>     return groovy.sql.Sql.newInstance(
>      "jdbc:oracle:thin:mydb",
>      "userid", "pw",
>      "oracle.jdbc.driver.OracleDriver");
>   }
>
> }
>
>
>
> >>> [hidden email] 2006-04-21 2:43:53 PM >>>
> > On 4/21/06, Jonathan Carlson <[hidden email]> wrote:
> > > Did you try the <project_home>/lib folder?
> > >
> I used this method for jdbc jar library without any problem.
>
> Best regards
> Pietro
>
>
______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email 
>
______________________________________________________________________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________
Reply | Threaded
Open this post in threaded view
|

Re: DataSource Injecting...

graemer
On 4/25/06, Jonathan Carlson <[hidden email]> wrote:
> Where is it best to put this hint about using javax.sql.DataSource
> instead of ApplicationDatasource  to inject the DataSource into a
> Service?  My proxy or something isn't letting me edit the Services page
> so I'd appreciate it if someone else could add it.

I've added something on the Services page, is this appropriate?:
http://grails.org/Services?nocache

Cheers
Graeme

>
> I want to make Grails as easy to use by documenting things to help
> others avoid the same mistakes I've made.  :-)
>
> - Jonathan
>
>
> >>> [hidden email] 2006-04-21 4:40:37 PM >>>
> The edit page is spinning on me so, if I remember, I'll add it on
> Monday.
>
> >>> [hidden email] 2006-04-21 4:32:50 PM >>>
> Graeme wrote:
> > did you try?:
> > @Property javax.sql.DataSource dataSource
>
> Thanks!  I was so close, yet so far.  Do you mind if I add this to
> http://grails.org/Services page?
>
>
> >>> [hidden email] 2006-04-21 4:22:49 PM >>>
> On 4/21/06, Jonathan Carlson <[hidden email]> wrote:
> > Did you use the regular ApplicationDataSource, or did you try the
> groovy
> > way to get a connection?  I tried putting a getSqlAccess() method
> like
> > this in my DataService and it couldn't find the Driver:
> >
> > class DataService {
> >
> >   //@Property ApplicationDataSource applicationDataSource (This
> didn't
> > work either!)
>
> did you try?:
>
> @Property javax.sql.DataSource dataSource
>
> Graeme
>
> >
> >   def getSqlAccess() {
> >     return groovy.sql.Sql.newInstance(
> >      "jdbc:oracle:thin:mydb",
> >      "userid", "pw",
> >      "oracle.jdbc.driver.OracleDriver");
> >   }
> >
> > }
> >
> >
> >
> > >>> [hidden email] 2006-04-21 2:43:53 PM >>>
> > > On 4/21/06, Jonathan Carlson <[hidden email]> wrote:
> > > > Did you try the <project_home>/lib folder?
> > > >
> > I used this method for jdbc jar library without any problem.
> >
> > Best regards
> > Pietro
> >
> >
> ______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security
> System.
> > For more information please visit http://www.messagelabs.com/email
> >
> ______________________________________________________________________
> >
> >
> ______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
> _____________________________________________________________________
> >
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
>
> Katun Corporation -- www.katun.com
> _____________________________________________________________________
>
Reply | Threaded
Open this post in threaded view
|

Re: DataSource Injecting...

Jonathan Carlson
In reply to this post by Jonathan Carlson
Thanks.  I would have probably also added something about using it to
create groovy Sql objects for custom Groovy queries too, but you got the
most important point.

Thanks!

- Jonathan

>>> [hidden email] 2006-04-25 11:13:39 AM >>>
On 4/25/06, Jonathan Carlson <[hidden email]> wrote:
> Where is it best to put this hint about using javax.sql.DataSource
> instead of ApplicationDatasource  to inject the DataSource into a
> Service?  My proxy or something isn't letting me edit the Services
page
> so I'd appreciate it if someone else could add it.

I've added something on the Services page, is this appropriate?:
http://grails.org/Services?nocache 

Cheers
Graeme

>
> I want to make Grails as easy to use by documenting things to help
> others avoid the same mistakes I've made.  :-)
>
> - Jonathan
>
>
> >>> [hidden email] 2006-04-21 4:40:37 PM >>>
> The edit page is spinning on me so, if I remember, I'll add it on
> Monday.
>
> >>> [hidden email] 2006-04-21 4:32:50 PM >>>
> Graeme wrote:
> > did you try?:
> > @Property javax.sql.DataSource dataSource
>
> Thanks!  I was so close, yet so far.  Do you mind if I add this to
> http://grails.org/Services page?
>
>
> >>> [hidden email] 2006-04-21 4:22:49 PM >>>
> On 4/21/06, Jonathan Carlson <[hidden email]> wrote:
> > Did you use the regular ApplicationDataSource, or did you try the
> groovy
> > way to get a connection?  I tried putting a getSqlAccess() method
> like
> > this in my DataService and it couldn't find the Driver:
> >
> > class DataService {
> >
> >   //@Property ApplicationDataSource applicationDataSource (This
> didn't
> > work either!)
>
> did you try?:
>
> @Property javax.sql.DataSource dataSource
>
> Graeme
>
> >
> >   def getSqlAccess() {
> >     return groovy.sql.Sql.newInstance(
> >      "jdbc:oracle:thin:mydb",
> >      "userid", "pw",
> >      "oracle.jdbc.driver.OracleDriver");
> >   }
> >
> > }
> >
> >
> >
> > >>> [hidden email] 2006-04-21 2:43:53 PM >>>
> > > On 4/21/06, Jonathan Carlson <[hidden email]> wrote:
> > > > Did you try the <project_home>/lib folder?
> > > >
> > I used this method for jdbc jar library without any problem.
> >
> > Best regards
> > Pietro
> >
> >
>
______________________________________________________________________
> > This email has been scanned by the MessageLabs Email Security
> System.
> > For more information please visit http://www.messagelabs.com/email

> >
>
______________________________________________________________________
> >
> >
>
______________________________________________________________________
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom
they
> > are addressed. If you have received this email in error please
> notify
> > the system manager.
> >
> > Katun Corporation -- www.katun.com
> >
>
_____________________________________________________________________
> >
>
>
______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email 
>
______________________________________________________________________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>
>
______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email 
>
______________________________________________________________________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>
>
______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
System.
> For more information please visit http://www.messagelabs.com/email 
>
______________________________________________________________________
>
>
______________________________________________________________________
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please
notify
> the system manager.
>
> Katun Corporation -- www.katun.com
>
_____________________________________________________________________
>

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

______________________________________________________________________
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

Katun Corporation -- www.katun.com
_____________________________________________________________________