XADataSource in Jboss with Sql Server
gopikrishna Jun 27, 2005 1:04 AMHi Everybody,
I am new to this forum and I would like to seek an help regarding the JBOSS 4.x XAdatasource when connecting to sql server 2000.
I am able to look up the jndi, but getting connection timed out. I am using Inet Merlia sql driver. The following is the code snippet
mssql-xa-ds.xml
<xa-datasource>
<jndi-name>XATdsSample</jndi-name>
<track-connection-by-tx/>
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>com.microsoft.jdbc.sqlserver.SqlServerDataSource</xa-datasource-class>
<xa-datasource-property name="ServerName">IPAddress</xa-datasource-property>
<xa-datasource-property name="DatabaseName">DBName</xa-datasource-property>
<xa-datasource-property name="SelectMethod">cursor</xa-datasource-property>
<!-- not sure if these should be here-->
<user-name>usr</user-name>
pwd
I changed the deafultDS names and corresponding stadardjbosscmp-jdbc.xml and other xml also.
The following is the code snippet:
public abstract class XAEjbBean implements javax.ejb.SessionBean {
private SessionContext context;
private Connection con;
private PreparedStatement pr;
private String dbName = "java:/XATdsSample";
/**
* @ejb.interface-method
* view-type="remote"
**/
public void getConnection(){
if (con != null) return;
InitialContext ic;
try{
ic = new InitialContext();
DataSource ds = null;
ds = (DataSource)ic.lookup( dbName );
con = ds.getConnection();
// pr = con.prepareStatement("INSERT INTO #XATdsSample( id, name) VALUES( ?, ?)");
}catch(NamingException ex){
ex.printStackTrace();
throw new EJBException( ex.getMessage() + "\nCheck the configuration of your application server. You need to add the datasource to the 'default.properties'" );
}catch(Exception e){
e.printStackTrace();
}
I am getting the following error -
INFO [WrapperDataSourceService] Bound connection factory for resource adapter for Connection
Manager 'jboss.jca:name=XATdsSample,service=DataSourceBinding to JNDI name 'java:XATdsSample'
19:28:30,085 WARN [JBossManagedConnectionPool] Unable to fill pool
org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLE
xception: [TDS Driver]Too many connections :3)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(Loc
alManagedConnectionFactory.java:161)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListene
r(InternalManagedConnectionPool.java:508)
at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.fillToMin(InternalManagedCon
nectionPool.java:455)
at org.jboss.resource.connectionmanager.PoolFiller.run(PoolFiller.java:70)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.sql.SQLException: [TDS Driver]Too many connections :3
at com.inet.tds.TdsDriver.a(Unknown Source)
at com.inet.tds.a.(Unknown Source)
at com.inet.tds.r.a(Unknown Source)
at com.inet.tds.TdsDriver.connect(Unknown Source)
at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(Loc
alManagedConnectionFactory.java:151)
... 4 more
I apprepriate your responses. Thanks in advance
Gopi Krishna