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" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
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:[EMAIL PROTECTED]]
> 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: [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