0 Replies Latest reply on Sep 13, 2007 7:12 AM by srinu reddy

    Could not create connection; - nested throwable: (java.sql.S

    srinu reddy Newbie

      hello
      jboss4.2.1 is throwing following exception while connecting to oracle10g, i am testing datasource through ejb
      the following are the files

      jbosscmp-jdbc.xml
      -----------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.0//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd">
      <jbosscmp-jdbc>

      java:/OracleDS
      <datasource-mapping>Oracle9i</datasource-mapping>
      <create-table>false</create-table>
      <remove-table>false</remove-table>
      <pk-constraint>true</pk-constraint>
      <preferred-relation-mapping>foreign-key</preferred-relation-mapping>


      <enterprise-beans>
      <!-- orders -->

      <ejb-name>orders</ejb-name>
      <table-name>ordersoracle</table-name>

      <cmp-field>
      <field-name>order_no</field-name>
      <column-name>orderno</column-name>
      <not-null/>
      </cmp-field>
      <cmp-field>
      <field-name>order_desc</field-name>
      <column-name>orderdesc</column-name>
      </cmp-field>
      <cmp-field>
      <field-name>order_date</field-name>
      <column-name>orderdate</column-name>
      </cmp-field>


      </enterprise-beans>

      </jbosscmp-jdbc>
      -----------------------------------------------------
      ejb-jar.xml
      ----------------------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <enterprise-beans>
      <display-name>orders</display-name>

      <display-name>orders</display-name>
      <ejb-name>orders</ejb-name>
      orderentity.ordersHome
      orderentity.orders
      <ejb-class>orderentity.ordersBean</ejb-class>
      <persistence-type>Container</persistence-type>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>ordersschema</abstract-schema-name>
      <primkey-field>order_no</primkey-field>
      <prim-key-class>java.lang.Integer</prim-key-class>
      <cmp-field><field-name>order_no</field-name></cmp-field>
      <cmp-field><field-name>order_desc</field-name></cmp-field>
      <cmp-field><field-name>order_date</field-name></cmp-field>


      <ejb-name>TestSession</ejb-name>
      orderentity.TestSessionHome
      orderentity.TestSession
      <ejb-class>orderentity.TestSessionBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>



      </enterprise-beans>
      </ejb-jar>

      ---------------------------------------------
      jboss.xml
      ------------------------------------------------------
      <?xml version='1.0' encoding='UTF-8' ?>

      <enterprise-beans>

      <ejb-name>orders</ejb-name>
      <jndi-name>orders/ordersHome</jndi-name>


      <ejb-name>TestSession</ejb-name>
      <jndi-name>TestSession/TestSessionHome</jndi-name>

      </enterprise-beans>


      -----------------------------------
      and
      oracle-ds.xml
      ------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- $Id: oracle-ds.xml 63175 2007-05-21 16:26:06Z rrajesh $ -->
      <!-- ==================================================================== -->
      <!-- Datasource config for Oracle originally from Steven Coy -->
      <!-- ==================================================================== -->



      <local-tx-datasource>
      <jndi-name>OracleDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
      <!--

      Here are a couple of the possible OCI configurations.
      For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm

      <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
      or

      <connection-url>jdbc:oracle:oci:@(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=orcl)))</connection-url>

      Clearly, its better to have TNS set up properly.
      -->
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>system</user-name>
      srinivasulu
      <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
      <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
      <!-- Checks the Oracle error codes and messages for fatal errors -->
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      <!-- sql to call when connection is created
      <new-connection-sql>some arbitrary sql</new-connection-sql>
      -->


      <check-valid-connection-sql>select * from orders1</check-valid-connection-sql>


      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->

      <type-mapping>Oracle9i</type-mapping>

      </local-tx-datasource>






      pls.. look into those files and help me out


      regards
      srinu