If you deploy this service in Application Scope, then there will be one and only one instance of this service throught out the life time of the application. This way you only create your database connection once.
>Is it enough to create this service with application scope? So the answer is yes. Rajith Attapattu Red Hat. On 10/9/07, VF <[EMAIL PROTECTED]> wrote: > > Hi all, > I would like to ask u, how can i utilize database connection in my web > service. I have one web service with more methods in it. Id like to create > database connection just once and not with each call (each operation works > with the same database connection) Is it enough to create this service > with > application scope? > > It looks like this: > > Available services > stkdds > > Service Description : stkdds > Service Status : Active > Available Operations > > * getFinishedOrderBin > * getOrderInfo > * updateOrder > * getUserInfo > * cancelOrder > * updateUser > * testOperation > * getOrdersOverview > * getAllAccountsInfo > * getFinishedOrder > * getAccountInfo > * newOrder > > > And my code for database connection smth like this: > > public Connection setConnection() throws Exception { > > if(conn != null){ > return conn; > } > > Class.forName("org.firebirdsql.jdbc.FBDriver"); > conn = DriverManager.getConnection (p_connect_string, > sqlProps); > return conn; > > > > > Thanks Vladi > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >