[Building Sakai] DB Service and Spring

Glenn R. Golden ggolden22 at mac.com
Mon Apr 20 07:40:37 PDT 2009


Chris-

The connection you get from the SqlService is, for the duration of the  
"borrow", unique to your code.  Any other code using the SqlService  
will get other connections.  Any other use using your tool will get  
other connections as well, since they are coming in on different  
threads and each invoking the "borrow" call.  Connections are pooled  
by the service, so when you return the borrowed connection, it will be  
re-used in a future borrowing.

If you use the SqlService methods that do not require a connection,  
they will each borrow a connection to perform the service.  If you  
explicitly borrow a connection and use it in a series of calls, all  
the calls can be within the same Sql transaction (unless you  
explicitly commit the connection).

- Glenn


On Apr 20, 2009, at 2:54 AM, Dunstall, Christopher wrote:

> Hi all,
>
> I was wondering if someone can help me get my head around this.  
> Spring is starting to do me in...
>
> The BasicSqlService is loaded via Spring and can be injected into  
> another bean.
>
> If a Sakai tool's own DB service obtains the BasicSqlService from  
> the component manager (as a singleton), and borrows a connection  
> from the data source, is this connection directly related to the  
> session even though the BasicSqlService is shared to the entire VM?
>
> In other words, if user A enters the tool, and gets the DB service,  
> will their actions SHARE the same connection spawned by user B who's  
> already logged into the tool?
>
> Thanks,
>
> Chris Dunstall | Solutions Developer
> Enterprise Information Management Solutions (EIMS)
> Division of Information Technology | Charles Sturt University |  
> Bathurst, NSW
>
> Ph: 02 63384818 | Fax: 02 63384181
>
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org 
>  with a subject of "unsubscribe"



More information about the sakai-dev mailing list