9 Replies Latest reply on Jul 13, 2011 11:29 AM by simas_ch

    JBoss 7 and OracleDriver

    simas_ch

      Hi,

       

      I installed ojdbc6.jar as module.

      This seams to work as I can see:

      Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)

       

      The I created a datasource in standalone.xml

       

      <datasource jndi-name="java:jboss/jdbc/shop" pool-name="ShopDS" enabled="true" use-java-context="true">

        <connection-url>jdbc:oracle:thin:localhost:1521:xe</connection-url>

        <driver>ojdbc6</driver>

        <pool></pool>

        <security>

          <user-name>shop</user-name>

          <password>shop</password>

        </security>

        <validation></validation>

        <timeout></timeout>

        <statement></statement>

      </datasource>   

       

      This seams to work as well and then Hibernate tries to access the data source.

      Then something strange happens. I get a Oracle Exception:

       

      ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

       

      There seams to happen something strange when creating the connection.

       

      Does anybody have JBoss 7 with Oracle Driver up and running?

       

      Thanks for you help.

      Simon

        • 1. Re: JBoss 7 and OracleDriver
          smarlow

          http://forums.oracle.com/forums/thread.jspa?threadID=431363 mentions a few possible issues (google shows other hits as well).  Make sure you started the database server and that its listening on the default 1521 port.  If there is a firewall involved, make sure you can get through it.  You could try connecting with sqlplus or even better with a standalone database Java tool (like http://squirrel-sql.sourceforge.net).

          • 2. Re: JBoss 7 and OracleDriver
            simas_ch

            I have JBoss 6 up and running with the same driver and the same application!

            There must be a problem how the connection is created.

            • 3. Re: JBoss 7 and OracleDriver
              smarlow

              Sure sounds like you are right.  Is the connection-url used with AS7, the same as AS6? 

               

              The "ORA-12505, TNS:listener" error, sounds like we connected to the target database server machine but the tns listener on the db server didn't like the request for some reason. 

               

              I wonder if we have any trace logging (AS6/AS7 or ojdbc6.jar) that would show the connection details being used (if something is missing in what is passed to the Oracle driver in AS7, working backwards from knowing what is missing, would be easiest). 

              • 4. Re: JBoss 7 and OracleDriver
                jesper.pedersen

                Saying it doesn't work won't get you anywhere.

                 

                Provide the log from both servers - both from the JCA and JPA layers - that shows communication from your application down through the different layers to Oracle.

                • 5. Re: JBoss 7 and OracleDriver
                  simas_ch

                  Sure. If you tell me how to switch the logging on...

                  • 6. Re: JBoss 7 and OracleDriver
                    smarlow

                    To get logging, I would enable TRACE logging for everything, get the connect info from the server.log (I believe that org.jboss.jca will show the connect info being passed to the JDBC driver).  There will be a lot of trace output in the AS7 server.log, but you should be able to find the connect error and the connect info should be logged before that point in the server.log.

                     

                    Logging can be enabled by hacking the AS7/standalone/configuration/standalone.xml and changing from INFO to TRACE (just a three line change).  Be sure to turn it back to INFO after...

                     

                    Let us know  if the connect info matches what you would expect.  If your not sure, show us the connect info (with the password removed of course).

                    • 7. Re: JBoss 7 and OracleDriver
                      simas_ch

                      Thanks to the logging I found the error. The connection URL was wrong! There was missing a @ before the server name.

                      Shame on me!

                       

                      Thanks a lot for your help.

                      • 8. Re: JBoss 7 and OracleDriver
                        jaikiran

                        Simon Martinelli wrote:

                         

                        Thanks to the logging I found the error. The connection URL was wrong! There was missing a @ before the server name.

                        That error was being logged at TRACE level? Can you please post the relevant part of that log?

                        • 9. Re: JBoss 7 and OracleDriver
                          simas_ch

                          17:27:53,735 DEBUG [org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$AS7DataSourceDeployer] (MSC service thread 1-7) DataSource=DataSourceImpl [connectionUrl=jdbc:oracle:thin:localhost:1521:xe, driverClass=oracle.jdbc.OracleDriver, driver=ojdbc6, connectionProperties={}, newConnectionSql=null, pool=org.jboss.jca.common.metadata.common.CommonPoolImpl@1ff8506]