Himanshu Bhardwaj
2013-03-19 08:40:42 UTC
Himanshu Bhardwaj [https://community.jboss.org/people/him-bhar] created the discussion
"Datasource in JBoss not picking the right class"
To view the discussion, visit: https://community.jboss.org/message/803506#803506
--------------------------------------------------------------
Hi All,
I am facing a very weird problem using JBoss 6.
The problem is basically I have configured, a data source in standalone.xml
           <datasource jndi-name="java:jboss/jdbc/ejb/testconn" pool-name="test-cluster-Pool" enabled="true" use-java-context="true">
               <connection-url>jdbc:sqlserver://127.0.0.1:1433;databaseName=testdb;</connection-url>
               <driver>sqlserver-jdbc</driver>
               <pool>
                   <min-pool-size>10</min-pool-size>
                   <max-pool-size>100</max-pool-size>
                   <prefill>true</prefill>
               </pool>
               <security>
                   <user-name>sa</user-name>
                   <password>sa</password>
               </security>
               <statement>
                   <prepared-statement-cache-size>32</prepared-statement-cache-size>
                   <share-prepared-statements>true</share-prepared-statements>
               </statement>
           </datasource>
This is the configuration of the driver, I have installed the same as a module:
           <drivers>
               <driver name="h2" module="com.h2database.h2">
                   <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
               </driver>
               <driver name="sqlserver-jdbc" module="com.himanshu.jdbc">
                   <datasource-class>com.himanshu.jdbcdriver.datasource.DataSource</datasource-class>
               </driver>
           </drivers>
com.himanshu.jdbcdriver.datasource.DataSource class basically extends com.microsoft.sqlserver.jdbc.SQLServerDataSource:
But when I run a test, I can conclude that its not using the datasource-class that I have mentioned. Because for the two method,
@Override
public Connection getConnection() throws SQLServerException {
   System.out.println("TRYING TO GET CONNECTION");
   return null;
}
@Override
public Connection getConnection(String arg0, String arg1)
       throws SQLServerException {
   System.out.println("TRYING TO GET CONNECTION");
   return null;
}
h3. And so Ideally the connection should have returned null, but neither the connection is returned as null nor I get these SOP printed, so can't understand where I am actually wrong.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/803506#803506]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]
"Datasource in JBoss not picking the right class"
To view the discussion, visit: https://community.jboss.org/message/803506#803506
--------------------------------------------------------------
Hi All,
I am facing a very weird problem using JBoss 6.
The problem is basically I have configured, a data source in standalone.xml
           <datasource jndi-name="java:jboss/jdbc/ejb/testconn" pool-name="test-cluster-Pool" enabled="true" use-java-context="true">
               <connection-url>jdbc:sqlserver://127.0.0.1:1433;databaseName=testdb;</connection-url>
               <driver>sqlserver-jdbc</driver>
               <pool>
                   <min-pool-size>10</min-pool-size>
                   <max-pool-size>100</max-pool-size>
                   <prefill>true</prefill>
               </pool>
               <security>
                   <user-name>sa</user-name>
                   <password>sa</password>
               </security>
               <statement>
                   <prepared-statement-cache-size>32</prepared-statement-cache-size>
                   <share-prepared-statements>true</share-prepared-statements>
               </statement>
           </datasource>
This is the configuration of the driver, I have installed the same as a module:
           <drivers>
               <driver name="h2" module="com.h2database.h2">
                   <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
               </driver>
               <driver name="sqlserver-jdbc" module="com.himanshu.jdbc">
                   <datasource-class>com.himanshu.jdbcdriver.datasource.DataSource</datasource-class>
               </driver>
           </drivers>
com.himanshu.jdbcdriver.datasource.DataSource class basically extends com.microsoft.sqlserver.jdbc.SQLServerDataSource:
But when I run a test, I can conclude that its not using the datasource-class that I have mentioned. Because for the two method,
@Override
public Connection getConnection() throws SQLServerException {
   System.out.println("TRYING TO GET CONNECTION");
   return null;
}
@Override
public Connection getConnection(String arg0, String arg1)
       throws SQLServerException {
   System.out.println("TRYING TO GET CONNECTION");
   return null;
}
h3. And so Ideally the connection should have returned null, but neither the connection is returned as null nor I get these SOP printed, so can't understand where I am actually wrong.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/803506#803506]
Start a new discussion in Datasource Configuration at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2077]