HI

I am creating a database connection from a datsource in jboss for sqlServer and then using preparedtaement execute a batch which fails with some unique contraint errors. This returns an instance of SQLServerException instead of BatchUpdateException.

My java code does a exception handling on BatchUpdateException.

This works fine on oracle but fails in SqlServer.

But on SQL Server if I get the connection using normal driverManager it work fine.
Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
Connection conn = DriverManager.getConnection("jdbc:sqlserver://my-server:1433;User=user;Password=passwod");

I used a similar datsource configuration file in jboss for getting a datsource connection

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MYDATASOURCE</jndi-name>
<connection-url>jdbc:sqlserver://my-server;databaseName=MYDATABASE</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver </driver-class>
<user-name>user</user-name>
<password>password</password>
<!-- This will be run before a managed connection is removed from the pool for use by a client-->
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<!-- The minimum connections in a pool/sub-pool. Pools are lazily constructed on first use -->
<min-pool-size>10</min-pool-size>
<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>30</max-pool-size>
</local-tx-datasource>
</datasources>

thanks
Sreddy