wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes connection pool with jboss Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "connection pool with jboss" Watch "connection pool with jboss" New topic
Author

connection pool with jboss

Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134
Hi all -

I am not sure if I should post my question in jdbc forum.

I want to create a connection pool as mentioned in the article -

http://webdevelopersjournal.com/columns/connection_pool.html

and I read that JBOSS has a connection pool framework. Does this work differently than what is mentioned in the url?

Also, the above link does not tell how to create a connection pool. Can some one let me know how to do that?

I have never built a connection pool before or used jboss
Thanks all of you for your time!
[ October 27, 2004: Message edited by: Hari priya ]
Narendran Nair
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
Hi

if your need a connection pool from oracle you need to put oracle-ds.xml file in the deploy directory of Jboss.

the file is in the example section of Jboss ie C:\jboss-4.0.0\docs\examples\jca

edit the file with necesaary fields

Example i found from the JBoss Site
<datasources>
<local-tx-datasource>
<jndi-name>DefaultDS</jndi-name>
<connection-url>jdbc racle:thin:@dev-db:1000:abc</connection-url>
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
<max-pool-size>20</max-pool-size>
<min-pool-size>10</min-pool-size>
<!-- Use the security domain defined in conf/login-config.xml-->
<security-domain>EncryptDBPassword</security-domain>
</local-tx-datasource>
</datasources>

use the jndi name to look up the datasource in your program

regards
Naren


Narendran J S<br />SCJP 1.4<br /><a href="http://narendranj.blogspot.com" target="_blank" rel="nofollow">http://narendranj.blogspot.com</a><br /><a href="http://narendranj.blogspot.com" target="_blank" rel="nofollow">http://techboom.blogspot.com</a><br /><a href="http://bookmarks-share.blogspot.com" target="_blank" rel="nofollow">http://bookmarks-share.blogspot.com</a>
Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134
Hi naren -

Thanks for giving me a good start. I am using MS SQL Server with JBoss 3.2.6
Is the connection pool configuration done in the same way? I mean using the same tags?

If not kindly let know how to achieve this as I did not come across godo examples on the internet. I found one but that was for JBoss 2.4.

Reagrds,
Hari Priya
Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134
Hi all -

The getConnection () method that I use to create connection is given below. So, when I need a connection, do i simply have to call this method or do I have to implement anything else? I have modified the mssql-ds.xml as needed.



Reagrds,
Hari Priya
[ October 28, 2004: Message edited by: Hari priya ]
Narendran Nair
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
hi Hari priya -

there is no problem in using MS Sql Server .. You only need that ds.xml file correctly filled and put it in the deploy directory
make sure that u have the correct driver-class in the xml file

In the program u only need to above getConnection method the Datasource should be javax.sql.DataSource

thats all
regards
Narendran
Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134
Thanks Naren for your reply. I will try working with it and get back if I have problems.
Hari priya
Ranch Hand

Joined: Mar 11, 2004
Posts: 134
Hi -

I am having a question here. Do I just have to modify teh appropriate ds for mssql and place it in the deploy directory or do I have to modify or do i have to change the
standardjbosscmp-jdbc.xml and jbosscmp-jdbc.xml too? I have modified all the three files.

mssql-ds.xml
<datasources>
<local-tx-datasource>
<jndi-name>MSSQLDS</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Test</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>x</user-name>
<password>y</password>

</local-tx-datasource>

</datasources>

standardjbosscmp-jdbc.xml

<jbosscmp-jdbc>

<defaults>
<datasource>java:/MSSQLDS</datasource>
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>

jbosscmp-jdbc.xml

<jbosscmp-jdbc>
<defaults>
<datasource>java:/MSSQLDS</datasource>
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>
Narendran Nair
Ranch Hand

Joined: Sep 25, 2003
Posts: 35
Hello

to tell the truth i edited only the ds.xml file to put a oracle connection pool to Jboss. and if u need a little more security u can edit the login-config.xml file.

this doesnt mean that you mustn't touch these files .. if the need arises to make your connection pool as the default then i you need to edit the above files...

regards
Narendran
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: connection pool with jboss
 
Similar Threads
Connection Pooling for my web application
Connection Pool
Connection pooling
Connection Pool
Connection closing - pooling, without pooling.