The way I have done it (though this might not be the best...) is this:
i) Copied the DBConnectionBroker.class file to
Web-inf/classes/com/javaexchange/dbConnectionBroker
ii) I have an initializing method being called from JspInit() such as
this:
package com.db.regnskab;
import com.javaexchange.dbConnectionBroker.*;
public class IRUtilities {
public static DbConnectionBroker dbBroker;
public static void init() {
try {
String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
String url = "jdbc:odbc:dmir";
String logfile = "D:\\DAT\\logfiles\\connections\\regnskab.log";
dbBroker = new DbConnectionBroker(driver, url, "foo", "bar", 50, 100, logfile,
0.01);
}
catch(IOException e) {
e.printStackTrace();
}
}
}
The syntax can be seen in the documentation but essentially this gives me
5 initial connection using the specified odbc-driver. Please note userid
and password are supplied within the class but may just as well be parsed.
iii)When I need a connection I simply use it in my classes such as this:
package com.db.regnskab;
import com.javaexchange.dbConnectionBroker.*;
public class Afstemning {
public static void arkiverAfstemning() {
DbConnectionBroker dbBroker = IRUtilities.dbBroker;
Connection conn = dbBroker.getConnection();
try {
/*some sql...*/
}
catch(Exception e) {
e.printStackTrace();
}
finally {
dbBroker.freeConnection(conn);
}
}
The answer to your second answer is YES - it is written and distributed under Open
Source License.
/Thomas
<[EMAIL PROTECTED]>
16-09-03 14:42
Til: <[EMAIL PROTECTED]>
cc: Thomas Nybro Bolding/THBO/Intranet/[EMAIL PROTECTED]
Vedr.: RE: Vedr.: RE: Connection Pooling in Tomcat 4.0
Hi Thomas,
As you have used DBConnectionBroker, can you tell me
what configuration is required,whatso ever
and the second question i want to ask is if it is free.
Regards,
Santosh Bhushan
i-flex solutions ltd.
Tel:2086013
"Where there is will there is a way and everything is possible for a
willing heart."
-----Original Message-----
From: Thomas Nybro Bolding [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 5:47 PM
To: Tomcat Users List
Subject: Vedr.: RE: Connection Pooling in Tomcat 4.0
Hi santosh.
I have been using DBConnectionBroker from http://www.javaexchange.com/
with Tomcat 4.03 and am currently using it with Tomcat 4.1.27.
I have no clue what so ever about its performance etc. vs. DBCP but found
it very easy to configure and use as I had no experience with connection
pooling.
Best regards Thomas
<[EMAIL PROTECTED]>
16-09-03 14:13
Besvar venligst til "Tomcat Users List"
Til: <[EMAIL PROTECTED]>
cc: <[EMAIL PROTECTED]>
Vedr.: RE: Connection Pooling in Tomcat 4.0
Hi andoni,
First of all thanks for reply.
Because you have already done this configaration,
Do we need to put Database user id and Password in the server.xml file.
if yes what other thing we need to put in server.xml and what things we
need to put in web.xml
Thanks a lot..............
Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is
highly welcome
-Santosh
-----Original Message-----
From: Andoni [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 16, 2003 5:27 PM
To: Tomcat Users List
Subject: Re: Connection Pooling in Tomcat 4.0
I have tried this and ended up using the DBCP package that comes with
Tomcat
4.1. It is not part of Tomcat 4.1 thought so you can download it
separately
and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is
not
the most useful of things and is major hassle to get working.
You can download the DBCP package from here:
http://jakarta.apache.org/commons/index.html
You need to download DBCP, Collections & Pool
>From there it's easy just put the necessary bits in your server.xml (yes I
think this is unavoidable) and it works a treat.
Hope that helps,
Andoni.
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 16, 2003 12:27 PM
Subject: Connection Pooling in Tomcat 4.0
Hi,
Can anyone send me the process of using Connection pooling in Tomcat 4.0
I have gone through Tomcat documentation, it says it can be done using
Tyrex.jar file.
Can anyone send me the process.
The second question is It is likely to put Database(SqL Server in our
case)
credential like DSN,USER,PASSWORD
in either web.xml or server.xml, which we don;t want to hard code as it is
already present in configuration file.
So how i can avoid writing SQL Server credential in web.xml
Thanks in advance
Regards,
Santosh Bhushan
i-flex solutions ltd.
Tel:2086013
"Where there is will there is a way and everything is possible for a
willing
heart."
DISCLAIMER:
This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient
you should not disseminate,distribute,store,print, copy or deliver this
message.Please notify the sender immediately by e-mail if you have
received
this e-mail by mistake and delete this e-mail from your system.E-mail
transmission cannot be guaranteed to be secure or error-free as
information
could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or
contain viruses.The sender therefore does not accept liability for any
errors or omissions in the contents of this message which arise as a
result
of e-mail transmission. If verification is required please request a
hard-copy version.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
DISCLAIMER:
This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if you
have received this e-mail by mistake and delete this e-mail from your
system.E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted,corrupted,lost,destroyed,arrive late
or incomplete or contain viruses.The sender therefore does not accept
liability for any errors or omissions in the contents of this message
which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<FONT SIZE=1 FACE="Arial">_______________
Vi goer opmaerksom paa, at denne e-mail kan indeholde fortrolig
information. Hvis du ved en fejltagelse modtager e-mailen, beder vi dig
venligst informere afsender om fejlen ved at bruge svar-funktionen.
Samtidig beder vi dig slette e-mailen i dit system uden at videresende
eller kopiere den.
Selv om e-mailen og ethvert vedhaeftet bilag efter vores overbevisning er
fri for virus og andre fejl, som kan paavirke computeren eller
it-systemet, hvori den modtages og laeses, aabnes den paa modtagerens eget
ansvar. Vi paatager os ikke noget ansvar for tab og skade, som er opstaaet
i forbindelse med at modtage og bruge e-mailen.
_______________
Please note that this message may contain confidential information. If you
have received this message by mistake, please inform the sender of the
mistake by sending a reply, then delete the message from your system
without making, distributing or retaining any copies of it.
Although we believe that the message and any attachments are free from
viruses and other errors that might affect the computer or IT system where
it is received and read, the recipient opens the message at his or her own
risk. We assume no responsibility for any loss or damage arising from the
receipt or use of this message.
</FONT>
DISCLAIMER:
This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended
recipient you should not disseminate,distribute,store,print, copy or
deliver this message.Please notify the sender immediately by e-mail if you
have received this e-mail by mistake and delete this e-mail from your
system.E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted,corrupted,lost,destroyed,arrive late
or incomplete or contain viruses.The sender therefore does not accept
liability for any errors or omissions in the contents of this message
which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.