Sorry i can't give you complete example, and now i don't have time to rewrite 
it :-(

but i can send yuo code for context:
                        ServletContext context = session.getServletContext();

hope it helps :-)

From: Philippe Le Gal <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <user@struts.apache.org>
Subject: Re: [Struts 2] Database access
Date: Tue, 16 Jan 2007 13:08:05 +0100

----- Original Message Follows -----
> Hi,
>
> Thanks again.
> Is it possible that you give me the complete listing of this example because,
> I've problem to find how to initialize the 'context' object.
>
> Thanks
>
> Philippe
>
> Le mardi 16 janvier 2007 11:14, Stanislav a écrit :
> > in java action class you can also connect through struts db mechanisam:
> > DataSource dataSource = (DataSource)
> > context.getAttribute("org.apache.struts.action.DATA_SOURCE"); conn > 
> > dataSource.getConnection();
> > or direct to db
> > Connection conn > 
> > DriverManager.getConnection(ConnectionURL,ConnectionUserName,ConnectionPass
> >word);
> >
> >
> >
> > From: Philippe Le Gal <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <user@struts.apache.org>
> > Subject: Re: [Struts 2] Database access
> > Date: Tue, 16 Jan 2007 11:08:28 +0100
> >
> > ----- Original Message Follows -----
> >
> > > Hi,
> > >
> > > Thanks for the information.
> > > I'm also looking for the mecanism of accessing the database in the java
> > > action class.
> > >
> > > Thanks
> > >
> > > Philippe
> > >
> > > Le mardi 16 janvier 2007 10:59, Stanislav a écrit :
> > > > in struts-config for sql database.
> > > >
> > > > <data-sources>
> > > >       <data-source type="org.apache.commons.dbcp.BasicDataSource">
> > > >          <set-property property="driverClassName"
> > > > value="com.microsoft.jdbc.sqlserver.SQLServerDriver" />
> > > >          <set-property property="url"
> > > > value="jdbc:microsoft:sqlserver://xxx.xxx.xxx.xxx:1433;DatabaseName=xxx
> > > >xx;S electMethod=Cursor" /> <set-property property="username"
> > > > value="xxxxx" /> <set-property property="password" value="xxxxx" />
> > > >          <set-property property="maxActive" value="0" />
> > > >          <set-property property="maxWait" value="5000" />
> > > >          <set-property property="defaultAutoCommit" value="false" />
> > > >          <set-property property="defaultReadOnly" value="false" />
> > > >       </data-source>
> > > > </data-sources>
> > > >
> > > >
> > > > From: Philippe Le Gal <[EMAIL PROTECTED]>
> > > > To: user@struts.apache.org
> > > > Subject: [Struts 2] Database access
> > > > Date: Tue, 16 Jan 2007 10:53:12 +0100
> > > >
> > > > ----- Original Message Follows -----
> > > >
> > > > > Hi,
> > > > >
> > > > > I'm looking for a simple struts 2 database access example.
> > > > >
> > > > > Thanks for any url
> > > > >
> > > > > Philippe
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to