1 Reply Latest reply on Jun 27, 2002 5:18 PM by Jamie Burns

    Datasource error

    quitejack Newbie

      Hi all

      When I use a datasource to get a connection, it throws a exception like this:
      java.sql.SQLException: ResourceException javax.resource.ResourceException: Wrong
      ManagedConnectionFactory sent to allocateConnection!

      My mssql-service.xml is placed on deploy folder and seems like this
      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- ======================================================================-->
      <!-- New ConnectionManager setup for Microsoft SQL Server 2000 driver -->
      <!-- You may download the latest Microsoft JDBC driver from *Microsoft* -->
      <!-- http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml&frame=true -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- ===================================================================== -->

      <!-- Include a login module configuration named MSSQLDbRealm.
      Update your login-conf.xml, here is an example for a

      <application-policy name = "MSSQLDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal">yourprincipal</module-option>
      <module-option name = "userName">yourusername</module-option>
      <module-option name = "password">yourpassword</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MSSQLDS</module-option>


      NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
      module-option name = "managedConnectionFactoryName"
      must match the object name of the ConnectionManager you are configuring here.
      <!--comment out this line if you want component managed security or want
      to use the default values in the ManagedConnectionFactoryProperties -->


      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      <config-property name="ConnectionURL" type="java.lang.String">jdbc:microsoft:sqlserver://mocha:1433;DatabaseName=FlowEngineWork</config-property>
      <config-property name="DriverClass" type="java.lang.String">com.microsoft.jdbc.sqlserver.SQLServerDriver</config-property>
      <config-property name="UserName" type="java.lang.String">sa</config-property>
      <config-property name="Password" type="java.lang.String"></config-property>

      <!--Below here are advanced properties -->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper

      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->

      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports

      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager

      <!--make the rar deploy! hack till better deployment-->

      Does anyone could help ?
      Have I done all the thing for a datasource ?

        • 1. Re: Datasource error
          Jamie Burns Newbie

          I want to use MS SQL Server 2000 with JBoss 3.0. If you got this working could you post what has to be done to make it work. Where do the MS SQL Server jars go? Is mssql-service.xml the only file that needs to be configured?

          In your original post it looks like you are pooling (?) the microsoft jdbc driver - you specified the driver com.microsoft.jdbc.sqlserver.SQLServerDriver. Can this be done using com.microsoft.jdbcx.sqlserver.SQLServerDataSource which manages its own connection pooling?

          I want to bind the DataSource into a JNDI namespace. Is that done in mssql-service.xml? If so, how is it done? If not, where is this done and how is it done?