3 Replies Latest reply on May 9, 2002 10:41 PM by davidjencks

    SQL Server 2000 Binding or lack thereof

    chriscoy

      Spent all week on this, please help!!

      I have attached my configs... The problem is that after trying various ideas found on the forums here, I can't seem to bind my datasource. Either I get a not bound message, or I get an invalid name when using the prefixes java:/xxxx or java:/jdbc/xxxx

      When using the JndiName of SQLSRV, I get a not bound error in my calling class.

      1. I see that JBoss 3.0 beta does deploy my service.xml file.

      2. In JndiView, I do not see the datasource anywhere.

      3. The corresponding error on the server console is a socket reset by peer by the OIL Service (connection failure(1))

      4. I have had little luck with 2.4.4 and 3.0, the 2.4.4 problems were various.

      5. My sql server is running in mixed mode, and I am running Windows 2000 Server.

      6. The classes that are trying to call the datasource are running from a command line, and are not being loaded from within JBoss. If I need to load these as user services, I am not sure how, as it is simply a mutlithreading telnet service that logs the output of the different machines to the database.

      *****************************
      source of my service file
      *****************************
      <?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
      ConfiguredIdentityLoginModule:

      <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=SQLSRV</module-option>
      </login-module>

      </application-policy>

      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 -->
      MSSQLDbRealm

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


      MSSQLDS



      <config-property name="ConnectionURL" type="java.lang.String">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tribes2stats</config-property>
      <config-property name="DriverClass" type="java.lang.String">com.microsoft.jdbc.sqlserver.SQLServerDriver</config-property>
      <!--set these only if you want only default logins, not through JAAS
      <config-property name="UserName" type="java.lang.String"></config-property>
      <config-property name="Password" type="java.lang.String"></config-property>
      -->



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



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


      0
      50
      5000
      15
      <!--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
      reauthentication)-->
      ByContainer



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

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

      java:/TransactionManager
      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer






      ***********************************
      Source of my login-conf.xml
      <partial......>
      <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=SQLSRV</module-option>
      </login-module>

      </application-policy>

        • 1. Re: SQL Server 2000 Binding or lack thereof
          davidjencks

          1. Upgrade to jboss 3 rc2. I don't support earlier versions, and there are many fewer problems.

          2. In all JBoss versions, datasources are only accessible from within the jboss vm.

          3. If you don't see your datasource in jndi view, there's no point running a program that uses it. Fix the problem that is preventing it from deploying properly.

          • 2. Re: SQL Server 2000 Binding or lack thereof
            chriscoy

            Ok, I can see in JNDI view now, and it's bound to java:/SQLSRV according to the log. However, running on the same machine I can't get to the datasource; tells me that it's not bound. Shouldn't attaching to JNDI provide me access to a datasource? Anyway, I downloaded the most recent version two nights ago, I hope that this is RC2.

            Would you suggest writing a session bean that performs the statements and returns resultsets or just executes?

            • 3. Re: SQL Server 2000 Binding or lack thereof
              davidjencks

              I'd write a session bean that looks up the ds, gets a connection, gets dbmetadata, and verifies it is the database vendor you expect. If you can see it in jndiview, your session bean should be able to see it too, under the exact same name.