0 Replies Latest reply on Apr 19, 2002 1:07 AM by Scott Hodson

    Defining SQL Server connection pool for 2.4.4

    Scott Hodson Newbie

      Does anybody know how to use the Beta 2 driver and set up a connection pool
      in JBoss 2.4.x?

      I'd like to see

      1) Config settings and which files have to be applied
      2) Java code that creates a connection from the pool

      So far I have the following code and it's not working. When it tries to create a connection, it can't bind to the JNDI resource, either because it's either not bound properly or I'm referencing it improperly. I don't get any JBoss errors when the server starts.

      In jboss.jcml I have
      ========================





      ConnectionURL=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=dbname;
      user=user;password=pwd;SelectMethod=cursor
      DriverClass=com.microsoft.jdbc.SQLServerDriver


      MyServerPool
      java:/TransactionManager
      <depends optional-attribute-name="ResourceAdapterName">
      jboss.jca:service=RARDeployment,name=Minerva JDBC LocalTransaction
      ResourceAdapter

      <depends optional-attribute-name="ConnectionManagerFactoryLoaderName">

      jboss.jca:service=ConnectionManagerFactoryLoader,name=MinervaSharedLocalCMFa
      ctory


      BlockingTimeoutMillis=50000
      IdleTimeoutMinutes=30
      MinSize=10
      MaxSize=20
      CleanupIntervalMinutes=10
      MaxIdleTimeoutPercent=1.0


      org.jboss.resource.security.ManyToOnePrincipalMapping


      userName=user
      password=pwd



      ===========
      and I try to create the connection in a Java DAO like this
      ===============================================

      Context ctx = new InitialContext();
      ConnectionPoolDataSource ds = (ConnectionPoolDataSource)
      ctx.lookup("jdbc/MyServerPool");
      PooledConnection pooledConnection = ds.getPooledConnection();
      Connection connection = pooledConnection.getConnection();
      ===========

      I get an error on the ctx.lookup() call, the error message is "MyServerPool not found". I've tried all combinations of removing and adding the "jdbc/" both in the Java code and in the jboss.jcml JndiName attribute. I've also tried "java/" as well to no avail. I'm also not sure if I have the correct ConnectionManagerProperties, I got these from a sample I found but using the Avenir JDBC driver for SQL Server sample.