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,ConnectionPassword);



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=xxxxx;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]

Reply via email to