You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Brian Taylor <br...@briantaylor.us> on 2010/04/07 20:32:02 UTC

ServiceMix JNDI: MS SQL Server JNDI Setup

Hello,

I'm trying to connect to an MS SQL Server 2008 RDBMS using JNDI in
ServiceMix 3.3.1 with the following entry in jndi.xml:

<entry key="java:comp/env/jdbc/db">
		<bean id="DataSourceBean"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
			<property name="driverClassName"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
			<property name="url"
value="jdbc:sqlserver://localhost:1433;databaseName=db;integratedSecurity=true"/>
                       <property name="username" value=""/>
        	       <property name="password" value=""/>
		</bean>
    </entry>

I've successfully connected to a MySQL database using the following jndi.xml
entry:

<entry key="java:comp/env/jdbc/db">	
		<bean id="DataSourceBean"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        	<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
        	<property name="url" value="jdbc:mysql://localhost/db"/>
        	<property name="username" value="johndoe"/>
        	<property name="password" value="pass"/>       
    	</bean>
    </entry>

The jndi reference "java:comp/env/jdbc/db" is being referenced in an
xbean.xml deployed in an SU in CXF SE 2009.01 as follows:

<!-- JNDI Data Source -->
<bean id="DataSourceBean"
class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/db"/>
</bean>

<bean id="TransactionManagerBean"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="DataSourceBean"/>
</bean>
	
<bean id="DAOFactoryBean" class="com.company.db.DAOFactoryJdbc">
	<property name="transactionManager" ref="TransactionManagerBean"/>
	<property name="dataSource" ref="DataSourceBean"/>
</bean>

The problem is that we're getting an exception in the CXF SE at the point of
ServiceInvocation (in the stack - unable to get debug info further) and the
only thing we changed was the first configuration above from the second
configuration above (MS SQL Server from MySQL JNDI configuration).

The sqljdbc4.jar is in the lib directory and the JVM in use is 1.6.

This works fine in Tomcat 6.0 using its context.xml as such:

 <Resource name="jdbc/db" auth="Container" type="javax.sql.DataSource"
username="" password=""
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost:1433;databaseName=db;integratedSecurity=true"
maxActive="8" maxIdle="4" maxWait="10000" /> 

Thx ahead,
Brian
-- 
View this message in context: http://old.nabble.com/ServiceMix-JNDI%3A-MS-SQL-Server-JNDI-Setup-tp28169136p28169136.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.