tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lindomar" <lindomar.si...@bol.com.br>
Subject Re: Datasource and connection
Date Mon, 03 Feb 2003 17:49:16 GMT
So so Sean.

Then this is a way of tomcat implements the concept of connection pools.
Right, i only wanted have certain.

Thanks for all.

----- Original Message -----
From: "Sean Dockery" <sean@sbdconsultants.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Monday, February 03, 2003 16:25
Subject: RE: Datasource and connection


> I'm curious as to why you're asking this question.  You should be using
the
> connection pool according to the documentation provided, because that is
how
> it is intended to be used.  That is...
>
> void doPost(...)
> {
>   InitialContext ic = new InitialContext();
>   Context jdbcCtx = (Context) ic.lookup("java:comp/env");
>   DataSource ds = (DataSource) jdbcCtx.lookup("jdbc/myDataSource");
>
>   Connection conn = null;
>   Statement stmt = null;
>   ResultSet rs = null;
>
>   try {
>     conn = ds.getConnection();
>
>     stmt = ...
>
>     rs = ...
>   }
>   catch(SQLException esql) {
>   }
>   finally {
>     if(rs != null)
>       rs.close();
>
>     if(stmt != null)
>       stmt.close();
>
>     if(conn != null)
>       conn.close();
>   }
> }
>
> What exactly are you THINKING of doing?
>
> -----Original Message-----
> From: Lindomar [mailto:lindomar.silva@bol.com.br]
> Sent: Monday, February 03, 2003 06:02
> To: Tomcat Users List
> Subject: Datasource and connection
>
>
> Hi everybody!
>
> I'm using datasource of tomcat for get connection.
> Well, when i do this:
> ...
> DataSource ds = (DataSource)ctx.lookup( "java:comp/env/jdbc/Anything");
> if (ds != null)
>     connection = ds.getConnection();
> ...
>
> In the next time, will give tomcat  to me a new connection or the same?
>
> I think that is same, but i didn't read anything about this.
>
> And when Tomcat close this connection? Only through the timeout?
>
> Thanks in advanced.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message