Subject | Re: [Firebird-Java] Tomcat Struts Firebird |
---|---|
Author | Gbouille |
Post date | 2002-12-30T19:50:50Z |
Hi
I'm using the last version of the driver (don't know the version cause I'm
using CVS to get the sources), Tomcat 4.1.12 and Struts 1.0.2.
Here is my strits-config.xml :
<data-sources>
<data-source key="GeneaDataSource">
<set-property property="driverClass" value="org.firebirdsql.jdbc.FBDriver"/>
<set-property property="maxCount" value="4"/>
<set-property property="minCount" value="2"/>
<set-property property="url" value="jdbc:firebirdsql:petit.mshome
net/3050:/var/db/genea.gdb"/>
<set-property property="autoCommit" value="false"/>
<set-property property="password" value="masterkey"/>
<set-property property="user" value="SYSDBA"/>
</data-source>
</data-sources>
And the code I use :
.
DataSource dataSource = servlet.findDataSource("GeneaDataSource");
myConnection = dataSource.getConnection();
Statement myStatement = myConnection.createStatement();
ResultSet myResultSet = myStatement.executeQuery("select count(*) as nb from
personne");
myResultSet.next();
..
And it's works for days without deconnection.
Hope it could help.
GB.
"John Croft" <jcroft@...> a �crit dans le message de news:
20021230172642.22702.qmail@......
Envie de discuter en "live" avec vos amis ? T�l�charger MSN Messenger
http://www.ifrance.com/_reloc/m la 1�re messagerie instantan�e de France
I'm using the last version of the driver (don't know the version cause I'm
using CVS to get the sources), Tomcat 4.1.12 and Struts 1.0.2.
Here is my strits-config.xml :
<data-sources>
<data-source key="GeneaDataSource">
<set-property property="driverClass" value="org.firebirdsql.jdbc.FBDriver"/>
<set-property property="maxCount" value="4"/>
<set-property property="minCount" value="2"/>
<set-property property="url" value="jdbc:firebirdsql:petit.mshome
net/3050:/var/db/genea.gdb"/>
<set-property property="autoCommit" value="false"/>
<set-property property="password" value="masterkey"/>
<set-property property="user" value="SYSDBA"/>
</data-source>
</data-sources>
And the code I use :
.
DataSource dataSource = servlet.findDataSource("GeneaDataSource");
myConnection = dataSource.getConnection();
Statement myStatement = myConnection.createStatement();
ResultSet myResultSet = myStatement.executeQuery("select count(*) as nb from
personne");
myResultSet.next();
..
And it's works for days without deconnection.
Hope it could help.
GB.
"John Croft" <jcroft@...> a �crit dans le message de news:
20021230172642.22702.qmail@......
> Hello -_____________________________________________________________________
> I am using the RC2 driver with Tomcat 4.1.18 and
> Struts 1.0.2 and Firebird 1.0.2. My test application
> is a user list where you login and add, edit, and
> delete users. Everything in my test application works
> initially, however after 60 to 90 minutes of
> inactivity the database connection is dropped by
> Firebird and then the next time the application is
> accessed database exceptions are thrown (apparently
> Struts doesn't know the connection is gone) and the
> application crashes and must be restarted. I have
> included my datasource setting and a code snippet
> below. If anyone has a suggestion, it would be
> greatly appreciated.
>
> Struts Datasource -
>
> <data-sources>
> <data-source>
> <set-property property="driverClass"
>
> value="org.firebirdsql.jdbc.FBDriver"/>
> <set-property property="url"
> value="jdbc:firebirdsql:localhost/3050:/opt/interbase/db/employee.gdb"/>
> <set-property property="user" value="SYSDBA"/>
> <set-property property="password" value="xxx"/>
> </data-source>
> </data-sources>
>
> Code from Employee Listing -
>
> ServletContext context = servlet.getServletContext();
> DataSource dataSource =
>
> (DataSource)Context.getAttribute(Action.DATA_SOURCE_KEY);
>
> try {
> conn = dataSource.getConnection();
> stmt = conn.createStatement();
> rs = stmt.executeQuery("SELECT e.*,r.*,d.* " +
> "FROM EMPLOYEE_TBL e, " +
> "ROLE_TBL r, " +
> "DEPARTMENT_TBL d WHERE " +
> "e.ROLEID = r.ROLEID AND " +
> "e.DEPID = d.DEPID;");
>
> while (rs.next()) {
>
> employee = new Employee();
>
> employee.setUsername(rs.getString("username"));
> ...
> employees.add(employee);
> }
> conn.commit();
>
> rs.close();
> stmt.close();
> conn.close();
> }
>
> TIA -
> John Croft
>
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> ------------------------ Yahoo! Groups Sponsor ---------------------~-->
> Get 128 Bit SSL Encryption!
> http://us.click.yahoo.com/CBxunD/vN2EAA/xGHJAA/saFolB/TM
> ---------------------------------------------------------------------~->
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
Envie de discuter en "live" avec vos amis ? T�l�charger MSN Messenger
http://www.ifrance.com/_reloc/m la 1�re messagerie instantan�e de France