5 Replies Latest reply on Jul 15, 2002 4:23 AM by tdang

    How to configure a ConnectionPool?

    tdang

      Hi!

      I am learning using JBoss. I have the following question:

      I am using JBoss 3.0. I want to configure a datasource (is it a connection pool in JBoss?). I have a database named TestDB in DB2. How and in which file must I configure a connection pool? Is there any documentation about this?

      Regards,
      Dang

        • 1. Re: How to configure a ConnectionPool?
          mccaffc

          You need to describe your DB2 database to JBoss. Look in the deploy directory of your server, you'll see an example one for hsqldb: it's called hsqldb-service.xml

          You need to create one for DB2: look at this location for examples:
          http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jbosscx/src/etc/example-config/
          There's one called db2-service.xml

          Add any specific driver details, put in your target host, username and password (the dbrealm stuff's doesn't seem essential if you're starting out and appears to be commented out anyway).

          Put this file in your deploy directory as MyVeryOwn-db2-service.xml and watch the log as it deploys. (Pretty cool). Fix any minor errors.

          You'll need to make sure you have the JDBC driver for DB2 : put this jar file in the jboss server's lib directory (e.g. server/default/lib)

          I'd write a bean or something to check the database access as well, just to be certain you've set everything up properly end-to-end.

          There really should be a sort of HOWTO for this, but I haven't found one that gathers the details in one place. I don't really understand the structure of the service files and most people seem to just copy examples.

          Cheers,

          Chris

          • 2. Re: How to configure a ConnectionPool?
            tdang

            Hi mccaffc!

            First, thanks a lot for your very helpful answer. I downloaded the db2-service from this site http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jbosscx/src/etc/example-config/
            and I could test my bean very well. I want to ask you if JBoss support MS-Access too? Is there any service file for this database system.

            Regards

            • 3. Re: How to configure a ConnectionPool?
              mccaffc

              Hi,

              Glad that worked.

              I don't see any reason why you couldn't connect to Access. I haven't done it myself, but I guess with JDBC it's just another database. I remember reading you had 2 options: the JDBC-ODBC bridge or a native Access JDBC driver (if one exists). Either way, it just boils down to changing the connection url in the xxx-service.xml file and making sure the driver jar is on jboss' class path.

              All the basic xxx-service.xml files in the example-config directory are pretty similar - only the 'XA' style files are different (they are there to handle distributed transactions I believe).

              If you get it working, why not post the file in the forums?

              Cheers,

              Chris

              • 4. Re: How to configure a ConnectionPool?
                tdang

                I just downloaded the file from the above website and replaced the database source in the file. So I did not have any big changes

                • 5. Re: How to configure a ConnectionPool?
                  tdang

                  Is there a dtd for xxx-service.xml?