Connection Pooling in  Jboss

Hi can any one explanin how to configure connection pooling in jBoss server.

DB configurations in JBoss are usually defined in the deploy directory under the server directory, in XML , under <datasources/>.

Similar Messages

  • Connection Pooling in JBoss v5.0

    I am doing a project in eclipse and Jboss v5.0.I need to know how can i do the connection pooling with the database IBM DB2?
    Thanks in advance...

    I suggest you configure a database that you know (such as Oracle) first to see how to configure it and get it to work, and that many other people in this forum is familar with so they can help you. Then try to duplicate the effort with the database you mention.
    Lets assume you have a project called myProject. Here are the basic steps:
    1: go to the home page of the supplier and download the driver. For oracle, search for something like 'oracle java driver'. the jar file is typically called something like classes12.jar
    2: add the jar file to your project (class path).
    3: If your project is called myProject, then you should have a configuration file called myProject.xml. In that file, you specify the url, userID, and path to the database. See Tomcat documentation to see how to do it.
    4: Use JNDI in your servlet to read the myProject.xml file and have it create a datasource.

  • Configuring JCo3 Connection Pool with single sign on on non SAP Java server

    Hi Everyone,
    i have configured a connection pool on JBoss as per JCo3 Documentation and is working great.
    Now I need help to configure this connection pool with single sign on so that RFc on SAP ECC systems are executed using end users credential rather than using single user name password used to configure JCo connection pool.
    On SAP Java stack I am sure its possible within Java WebDynpro    and i assume using JCA resource adapter. But what if we don't want to use SAP Java App server.
    Any help will be appreciated.
    Thanks,
    Divyakumar Jain

    Eason, 你好!
    I have exactly the same problem.  Did you find a solution to this problem?  If so, please let me know!

  • Connection pooling problem in TopLink with JBoss4.0.3

    Hi All
    I am using JBoss4.0.3SP1 with TopLink-10g(9.0.4.5) and Sybase as database. I am implementing connection pooling of JBoss with Sybase. I have done all the changes in JBoss mapping files.
    Now to enable connection pooling in TopLink I have set the <uses-external-connection-pooling> attribute in sessions.xml file to true and I have added <datasource> attribute corresponding to the datasource defined in JBoss. It is working fine but when I delete the username, password...etc attribute from the sessions.xml then I am not able to get the session from datasource.
    Can anyone tell me what to do or where I am making mistake? Any help on this will be appreciated

    I tried that code also but the project object that I am getting is null which is in this line
    DatabaseLogin login = (DatabaseLogin)mySession.getProject().getLogin();
    mySession is an object of oracle.toplink.sessions.Session interface but when I call this method then it returns me a null object of Project class, so I am getting NullPointerException error. I tried to do this stuff by many ways but I am always getting the NullPointereException in setLogin() method of Session. This is the stackTrace of the error.....
    java.lang.NullPointerException
    at oracle.toplink.publicinterface.Session.setLogin(Session.java:2871)
    at com.test.TestCon.executeQurey(TestCon.java:91)
    at org.apache.jsp.Test_jsp._jspService(org.apache.jsp.Test_jsp:55)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Unknown Source)
    Can you please tell me where I am wrong or any other way to do fix this problem.

  • JBoss connection pools

    hi. i just upgraded from jboss 2.2.2 to jboss 2.4.1 and now all of my connection pools are shot.
    here's my jboss.jcml:
    <mbean code="org.jboss.jdbc.JdbcProvider" name="DefaultDomain:service=JdbcProvider">
    <attribute name="Drivers">org.hsql.jdbcDriver,org.enhydra.instantdb.jdbc.idbDriver</attribute>
         <attribute name="Drivers">oracle.jdbc.driver.OracleDriver</attribute>
    </mbean>
    <mbean code="org.jboss.jdbc.XADataSourceLoader" name="DefaultDomain:service=XADataSource,name=pcs/waseca/pcsread">
    <attribute name="PoolName">pcs/waseca/pcsread</attribute>
    <attribute name="DataSourceClass">org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl</attribute>
    <attribute name="URL">jdbc:oracle:thin:@ip:sigid</attribute>
    <attribute name="JDBCUser">user</attribute>
    <attribute name="Password">pass</attribute>
         <attribute name="IdleTimeoutEnabled">true</attribute>
    </mbean>
    and here's the error:
    [Configuration] at org.jboss.Main.main(Main.java:112)
    [XADataSourceLoader] Starting
    [XADataSourceLoader] Stopped
    java.lang.ClassNotFoundException: org.opentools.minerva.jdbc.xa.wrapper.XADataSo
    urceImpl
    at javax.management.loading.MLet.findClass(MLet.java:800)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at org.jboss.jdbc.XADataSourceLoader.startService(XADataSourceLoader.jav
    a:344)
    at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:107
    at java.lang.reflect.Method.invoke(Native Method)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
    28)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(Conf
    igurationService.java:836)
    at $Proxy0.start(Unknown Source)
    at org.jboss.util.ServiceControl.start(ServiceControl.java:81)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:16
    28)
    at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:15
    23)
    at org.jboss.Main.<init>(Main.java:210)
    at org.jboss.Main$1.run(Main.java:116)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.jboss.Main.main(Main.java:112)
    there's no documentation that the syntax has changed from 2.2.2 from 2.4.1, so what's up?

    sheesh. finally got an answer to this one.
    documentation doesn't say it, but you have to use a different class in jboss.jcml
    don't use this one:
    org.opentools.minerva.jdbc.xa.wrapper.XADataSourceImpl
    must use this class:
    org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl
    i hope this helps someone else out there!

  • Jboss connection pool

    Hi
    I am using Jboss AS ver -4.0.5.GA.
    can anyone tell me how to make connection pool with mysql database.
    thanks in advance.

    You do not have to worry about implementing a connection pool, as it has been taken care of by the application server itself, and works "under the covers".
    What you can do is to eventually configure it by setting max and min pool size of the data source, if the defaults values do not suit your application.

  • Reset connections in connection pool

    Hi,
    After DB restart (or connection failure) I try to recover the server. In order to do this, I want to tell to container connection pool to reset (clear) all available connections.
    Does anybody knows how I can tell to container connection pool to reset (clear) all its connections (in standard way, or at least in Jboss)?
    Thanks,
    Igor.

    Am not sure in JBoss....but as far as my knowledge with WL gies...you don't have to do anything....The WL container continuosly tries to sync the connection with the DB....there is a Retry interval if the Connections to the DB fails....Better the Check out the Official Docs

  • Getting the number of active connections in a connection Pool

    Hi,
    I have an application deployed on jboss. DB used is db2. For monitoring purpose i need to get the number of active and idle connections at any point of time. I am trying to use commons-dbcp jar to get this data using BasicDataSourceClass. Following is the piece of code.
    Context initialContext;
    try {
         initialContext = new InitialContext();
         DataSource ds = (DataSource) initialContext.lookup(myjndiname);
         logger.info("************CONNECTION POOL DATA->" + ds.getClass().getName() + "************" + ds.getClass() + "**************");
         BasicDataSource bds = (BasicDataSource) datasource;
              logger.info("************CONNECTION POOL DATA-> ACTIVE CONN=" + bds.getNumActive() + " IDLE CONN=" + bds.getNumIdle() + " INIT SIZE=" + bds.getInitialSize());
    catch (NamingException e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
    This code gave a class cast exception at the point datasource is cast to BasicDataSource. The class name returned by ds is WrapperDataSource. I have few queries on this:-
    1. What configurations do i need so that datasource returned by InitialContext is BasicDataSource? FYI i tried to add the BasicDataSourceFactory in db2-ds.xml. But it still didnt work
    2. Is there any other way to find the number of active connections in a connection pool? I dont want any server specific solution.
    Pls help.
    Thanks

    user13642196 wrote:
    Hi,
    I have an application deployed on jboss. DB used is db2. For monitoring purpose i need to get the number of active and idle connections at any point of time. I am trying to use commons-dbcp jar to get this data using BasicDataSourceClass. Following is the piece of code.
    Context initialContext;
    try {
                 initialContext = new InitialContext();
                 DataSource ds = (DataSource) initialContext.lookup(myjndiname);
                 logger.info("************CONNECTION POOL DATA->" + ds.getClass().getName() + "************" + ds.getClass() + "**************");
                 BasicDataSource bds = (BasicDataSource) datasource;
              logger.info("************CONNECTION POOL DATA-> ACTIVE CONN=" + bds.getNumActive() + "  IDLE CONN=" + bds.getNumIdle() + "   INIT SIZE=" + bds.getInitialSize());
    catch (NamingException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
    }This code gave a class cast exception at the point datasource is cast to BasicDataSource. The class name returned by ds is WrapperDataSource. You can only cast an object to an interface it implements or to a class it extends (directly or indirectly).
    I have few queries on this:-
    1. What configurations do i need so that datasource returned by InitialContext is BasicDataSource? FYI i tried to add the BasicDataSourceFactory in db2-ds.xml. But it still didnt workhttp://commons.apache.org/dbcp/api-1.2.2/org/apache/commons/dbcp/package-summary.html#package_description

  • How do I create a non-JTS sequence connection pool using JTS

    I'm getting all kinds of errors (DB deadlocks and exceptions) using JTS with sequences. From reading several posts, it is necessary to create a separate non-JTS connection pool.
    I've seen several postings on how to do this in the sessions.xml file, but how do I do this in Java code?
    What I am trying is:
    SequencingControl seqCtrl = ((oracle.toplink.publicinterface.DatabaseSession)serverSession).getSequencingControl();
    seqCtrl.setShouldUseSeparateConnection(true);
    seqCtrl.setLogin(sequenceLogin);
    I've also tried:
    serverSession.addConnectionPool("sequencing", sequenceLogin, 2,5);
    but neither work. The problem with these settings is that the sequence properties on my DatabaseLogin are not honored.
    My table name is T_SEQUENCES and my preAllocation size is 5. However the SQL that is generated by this setup is:
    "UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + 50 WHERE SEQ_NAME = 'T_GROUPS_SEQ'"
    I'm guessing these may be default values, but I don't know where else to override these except for on the DatabaseLogin I am passing in.
    I know this setup works, because it is the same DatabaseLogin I use for non-JTS configuration.
    Could someone provide me a code-snippet on how to do this?
    Thanks,
    Nate

    I'm not using XML files, all of my setup is in code. I'm not sure how I would use the setLoginAndApplySequenceProperties(DatabaseLogin) call or if it would address my larger problem.
    The main issue I don't want to lose here is, I've got an application where I'm trying to use JTS with JBoss and SQL Server. It's a SessionBean/POJO architecture. The problem I was having that started this thread is that sequence number allocation causes a database deadlock.
    My thought was if I opened a 2nd connection pool dedicated to sequences, it might resolve the issue. I was able to do this with the workaround I posted, but it didn't fix anything. I now get a different error related to my newly inserted objects.
    From working with this off-and-on over the last several months, I would say that I don't think TopLink/JBoss/SQL Server using JTA can be made to work.
    I know that TopLink has a plug-in architecture and in theory if I implemented ExternalTransactionController and SynchronizationListener for JBoss correctly, it should all work.
    But, I've got the JBoss 4.0.0 source that I can step through, I've got all the recent updates to SQL Server and the JDBC driver, and I'm following everything I've been told so far on how to make this all work.
    It plain doesn't work.
    Furthermore, I haven't found anyone (this group, JBoss group) that has gotten this to work (TopLink/JBoss/JTA). This is an important item to us, we'd like to get this to work, and we would be happy to work with Oracle Consulting on this or whatever it takes (already opened a TAR on this).
    Are there any other support options available to making this work?
    Nate

  • Connection pooling in netbeans5.0

    hi,any of u can guide me to use container managed connection pooling
    in netbeans5.0,any examples??????????

    container manager pooling doesn't depend on the IDE, it depends on your application server.
    Tomcat:
    http://tomcat.apache.org/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    JBoss
    http://docs.jboss.com/jbossas/guides/j2eeguide/r2/en/html_single/#ch7.jdbc.sect
    Resin
    http://www.caucho.com/resin-3.1/doc/config-database.xtp
    hth

  • Connection Pooling  How To ?

    Hi All ,
    i am developing a struts based web-application with JBoss 4.0.5 as Application Server and Oracle 10g Express edition .
    I am configuring my application for connection pooling .
    I have tried following methods :
    1. Oracle Connection Pooling following thius link http://www.lc.leidenuniv.nl/awcourse/oracle/java.920/a96654/connpoca.htm
    2. Configuring Jboss's Internal Container Level Connection pooling simply creating the datasources
    3. JDBC level Connection Pooling
    but unluckily did not succeed in any of these method .
    The application works OK with Second method but When it is being hit with 200 request/second The pool gets exhaulsted .
    i am unable to decide which approach i should be using as my application can receive large no. of requests around 1000/sec ?
    Please help me out ,
    Tell some useful link if possible ..
    Regards Jasdeep

    The pool can't do magic. If your database operations take ten seconds each, you get 1000 requests a second, and you have a pool size of 200, the pool will effectively empty instantly.
    You need to get some measurements of how long the typical transactions last and figure out an appropriate pool size for that. If it's more than the database can handle then you're going to have to upgrade.
    It's that simple.

  • Regarding Connection Pooling in Struts

    Hi All,
    I m using Struts for my web application. Now I want to use the Connection Pooling for my applicaiton.
    I m using JBoss, and Oracle 10gXE.
    My question are :
    1. Do I need to use Oracle Specific Connection Pooling or commons DBCP & Pool.
    2. Do I need to JNDI to bind my data source using mydatasource.xml in deploy folder of JBoss or
    define the datasource in struts-config.xml of my application.
    Which will be the efficient way?
    Presently I m defining my datasource in struts-config.xml. like :
    <data-sources>
           <data-source type="org.apache.commons.dbcp.BasicDataSource" key="msgds">
              <set-property property="description" value="OracleXE Data Source" />
              <set-property property="driverClassName" value="oracle.jdbc.OracleDriver" />
              <set-property property="url" value="jdbc:oracle:thin:@192.168.1.8:1521:XE" />
              <set-property property="minCount" value="2" />
              <set-property property="maxCount" value="50" />
              <set-property property="maxWait" value="5000" />
              <set-property property="username" value="ashish" />
              <set-property property="password" value="ashish" />
              <set-property property="autoCommit" value="true" />
              <set-property property="readOnly" value="false" />          
         </data-source>
    </data-sources>  
    3. How can i change it to an mydatasource.xml for JNDI. If is it like this,what is the error:
         <datasources>
           <local-tx-datasource>
             <jndi-name>msgds</jndi-name>
             <connection-url>jdbc:oracle:thin:@192.168.1.8:1521/XE</connection-url>
             <driver-class>oracle.jdbc.OracleDriver</driver-class>   
             <user-name>ashish</user-name>
              <password>ashish</password>
             <min-pool-size>5</min-pool-size>
             <max-pool-size>100</max-pool-size> 
           </local-tx-datasource>
         </datasources>Please if somebody have idea of it, plz help. If U have code for this plz send it to me.
    If u don't want to publish you can send it to my email id: [email protected].

    Just make sure all the JARS are in the classpath. BTW I use Iplanet but does that matter much ? Configure the Struts-config file for the datasource by adding the below tag text.
    <data-sources>
         <data-source type="org.apache.commons.dbcp.BasicDataSource" key="DBSTR">
              <set-property property="description" value="OracleXE Data Source" />
              <set-property property="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
              <set-property property="url" value="jdbc:oracle:thin:@155.136.118.169:1521:DBSID" />
              <set-property property="minCount" value="2" />
              <set-property property="maxCount" value="10" />
              <set-property property="maxWait" value="10000" />
              <set-property property="username" value="USER" />
              <set-property property="password" value="PASSWORD" />
              <set-property property="autoCommit" value="false" />
              <set-property property="readOnly" value="false" />          
         </data-source>
    and then access from your action or servlet by executing the below java code.
    dataSource = getDataSource(request,"DBSTR");
    conn = dataSource.getConnection();
    stmt = conn.createStatement();
    rs = stmt.executeQuery("select object_name from user_objects");
    while ( rs.next() ) {
    tmp = tmp + ": " + rs.getString("object_name");
    Piece of cake.

  • Problem to call a procedure while using External connection pooling in TopL

    HI all,
    I have implemented external connection pooling in TopLink with JBoss 4.0.3SP1 and it is working fine. But after the connection pooling I am getting error while executing stored procedure with TopLink on Sybase. This is the error I am getting......
    Stored procedure 'P_InsReleaseToManufact' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.
    I got one solution to this problem as to set a tag in sybase-ds.xml file(which is used in JBoss to enable connection pooling) ..............
    <connection-property name="SQLINITSTRING">set chained off</connection-property>
    but still it is not working.
    Can some one please tell me about the solution.

    Try
    session.getLogin().handleTransactionsManuallyForSybaseJConnect();

  • Connection pool issues with Mysql

    Hi,
    I have defined sufficient read connections (50) in the toplink configuration, I am finding toplink is not releasing the connections in Mysql, this is when run from Jboss App server.
    Is anyone aware of toplink connection pool issues with MySql?
    thanks

    TopLink always closes connections, I cannot see how this could occur.
    Please include your persistence.xml or sessions.xml. Also ensure you are closing your EntityManager or ClientSession, especially if using exclusive connections.
    Also include the exception you are getting.
    James : http://www.eclipselink.org

  • JSTL, Connection Pooling

    I am busy setting up connection pooling in my jboss.
    Our applications are not that hardcore, so we mostly use JSTL and JavaBeans. But we never used pooling before.
    Can i still use connection pooling with my jstl >
    <sql:query dataSource="PostgresDS"/>
    or must i do all my db connections in a javabean?
    where can i find an example of how to use connection pooling?

    The server will handle the connection pooling aspect for you.
    It looks like you are already using a JNDI datasource lookup method.
    As long as the dataSource specified is a "connection pooling datasource" it will be connection pooling.
    No code change should be required.

Maybe you are looking for

  • Unreported Transaction timeout on commit (Oracle)

    I'm expecting an Oracle error upon commit using "deferred constraints" and           executing an INSERT that should result in a constraint violation. I am not           seeing an error but the transaction hangs for 30seconds (JTA timeout           s

  • Scale on x axis for radians

    Hi, I'm trying to make a cosine plot and have run into trouble. I've described the issues in this thread: http://discussions.apple.com/thread.jspa?messageID=12507456#12507456 The main issue is that I have 24 points on the abscissa, which run from 0 t

  • The problem with downloading from the App store

    Welcome. I have a problem with downloading and installing programs from the App Store. I am logged into the App Store, and when I click on install it does not react like the makings download eg OS X Maverics it kind of gets but nothing goes. Button i

  • Making my animation stop looping (it should be really simple, right?)

    I am trying to achieve a simple thing really; I have made an animation and want it to stop looping at the end. A quick search of the internet reassured me that this is simply a matter of putting in a stop(); command in the script. Great! Errr.. no. H

  • Query iView Does Not Display Sql Server Tables

    I have a system connected to a SQL Server (2000 Enterprise) and the Connection Tests works properly. When I start to create a Query iView, I get to the point where I must select a JDBC system and select tables from it. When I select the tree node of