It's basically the same as getting the datasource from within a BMP 
entity bean:

declare a resource-ref in ejb-jar.xml
(unless you're using JBoss defaultDS) Map a resourcemanager to your 
datasource and the resource-ref to that resourcemanager in jboss.xml 
(see jboss.dtd)
Write your bean to look up the datasource at the name 
"java:comp/env/"+the res-ref-name you specified in ejb-jar.xml (you 
should name it starting with jdbc, like "jdbc/MyDataSource")
get a connection
perform JDBC stuff
in a finally block, close all resultsets, statements, and connections 
(in that order, to be paranoid)

Sorry I don't have an example right now, but if you look at the typical 
BMP example, you should be able to get it.

-danch


felix wrote:

> where can I find an example of stateless accessing to a database by a
> datasource? I haven't found any example
> If anybody can send me a example or tell me where is, It would be
> appreciated.
> 
> Thanks in advance
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to