- This topic has 2 replies, 3 voices, and was last updated 15 years, 4 months ago by Brian Fernandes.
-
AuthorPosts
-
THCMemberI am trying to figure out how to configure DB Connection Pool (from built-in tomcat6). I am needing to use an existing remote oracle DB, and my legacy code I must use creates a connection object based on these kinds of conventions:
Connection conn = null;
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup(DB_BACKUP_DATASOURCE_NM);
conn = ds.getConnection();Can I create this pool from the built-in tomcat6, or do I need to instead use a remote/separate tomcat instance? If I can do it from the built-on tomcat, I am not sure how to go about it, and I cannot find any myecliipse documentation on how to proceed. If anyone can help at least point me in the right direction, I would greatly appreciate it. Thanks.
Loyal WaterMemberCan I create this pool from the built-in tomcat6, or do I need to instead use a remote/separate tomcat instance?
MyEclipse Tomcat is a stripped down version of Tomcat 6 so I would suggest you use another instance. You can setup a connector by pointing it to another instance of Tomcat 6. Let me know if you need any further assistance.
Brian FernandesModeratorTHC,
As nipun suggested, an external instance of Tomcat is preferred simply because it can be a minor pain to locate the files you need to modify to setup the pool.
To create a datasource, you must do the following in your Tomcat installation (this example sets up a datasource connected to our Embedded Derby database, you will need to replace attribute values depending on the database you intend to use):
1) Add the following element to the “Context” element in conf/context.xml
<Resource name=”jdbc/derby” auth=”Container” type=”javax.sql.DataSource”
username=”classiccars” password=”myeclipse”
driverClassName=”org.apache.derby.jdbc.ClientDriver”
url=”jdbc:derby://localhost:1527/myeclipse” maxActive=”8″ maxIdle=”4″/>2) Copy the driver JAR into the lib folder
This will create a datasource that can be accessed like so:
java:comp/env/jdbc/derbyHope this helps.
-
AuthorPosts