11 Replies Latest reply on Mar 16, 2010 2:31 PM by 715399

    Jena connection pooling

    691732
      Does anybody have suggestions regarding pooling of JDBC connections with the Oracle-Jena adaptor? We're using Jena in a web application, and at the moment we're using the oracle.spatial.rdf.client.jena.Oracle(String jdbcUrl, String username, String password) constructor. I'm assuming that under the covers this instantiates a brand-new JDBC connection. Is there significant overhead in setting up this connection? I notice that there is another constructor which will wrap an existing Oracle JDBC connection, which would allow us to manage our own connection pool. Would such an approach be worth our while?
        • 1. Re: Jena connection pooling
          alwu-Oracle
          Hi,

          When Oracle(String jdbcUrl, String username, String password) constructor is used, a brand new connection is created. It is considered heavy duty. That is why a different constructor that accepts OracleConnection is provided.

          In an application server environment, you may want to create a pool of Oracle objects and reuse them to serve requests.

          Cheers,

          Zhe Wu
          1 person found this helpful
          • 2. Re: Jena connection pooling
            malcolm83
            If you are using your JEE container to manage connection pools, then the interface that takes
            oracle.jdbc.OracleConnection is still not sufficient. Container pooling mechanisms don't return the
            physical connection when a connection is obtained from the pool. What you get is a container
            specific connection wrapper, that implements the java.sql.Connection interface.

            Clearly, the adaptor requires the Oracle semantic extensions, but is there any reason why it can't
            use the standard JDBC connection interface? This would facilitate things like use of container-managed
            connection pools as well as other types of JDBC wrappers. I've developed a wrapper that allows me
            to use OLS security with pooled connections, but I don't give the application direct access to the
            oracle.jdbc.OracleConnection instance.

            It's not clear from the Javadocs if the oracle.jdbc.OracleConnection passed to the Oracle constructor
            can be reused at some point.

            If the adaptor isn't making explict calls to the OracleConnection API is cleaning up the connection state
            at the end, then it should probably be changed to accept a standard JDBC connection object.
            • 3. Re: Jena connection pooling
              alwu-Oracle
              The new constructor of Oracle class now takes Connection object as input. You can get it when next version is released.

              Cheers,

              Zhe Wu
              • 4. Re: Jena connection pooling
                malcolm83
                That's great. Do you have a timeframe for the next version?
                • 5. Re: Jena connection pooling
                  alwu-Oracle
                  Let's take this offline. Please send an email to alan dot wu at oracle dot com.

                  Thanks,

                  Zhe Wu
                  • 6. Re: Jena connection pooling
                    759822
                    I am having the exact same issue. I want to run Jena from glassfish, and set up my connection pool from the container.
                    What is the timeframe for the release of the patched code ?
                    • 7. Re: Jena connection pooling
                      715399
                      Support for connection pooling has been added in the Jena Adapter for Oracle 11 g Release 2. See this for more details:
                      http://forums.oracle.com/forums/ann.jspa?annID=1179

                      Note that OC4J and WebLogic server are supported as web servers/application containers for this Jena Adapter release. If you encounter any problems with deploying Jena Adapter/Joseki in GlassFish, you might want to try OC4J or WebLogic Server.

                      Cheers,
                      Vladimir
                      • 8. Re: Jena connection pooling
                        759822
                        Thanks,

                        Which Oracle datasource class should I use when trying to configure the pool in my container ?

                        And can you point me to the javadoc for OraclePool ?

                        Edited by: user2570981 on 12-Mar-2010 10:17
                        • 9. Re: Jena connection pooling
                          alwu-Oracle
                          Hi,

                          Please check Section 7.2.1 Creating the Required Data Source Using WebLogic Server of the following document.
                          http://download.oracle.com/docs/cd/E11882_01/appdev.112/e11828/sem_jena.htm

                          The data source we use is "oracle.jdbc.pool.OracleDataSource"

                          To find the Javadoc, go to http://www.oracle.com/technology/software/tech/semantic_technologies/index.html
                          click on "Download the Jena Adaptor for Oracle Database 11g Release 2" link. The javadoc is in the release zip package.

                          Thanks,

                          Zhe Wu
                          • 10. Re: Jena connection pooling
                            759822
                            Is it possible to get the oracle jena adapter working in something other than weblogic ? I can use either glassfish or tomcat.
                            I have tried to configure the OracleSemDS data source in both, but I am not sure how the Oracle java code does the look up. I am not sure of the context...
                            The datasource never gets found in tomcat, and in glassfish it gets found, but the connection is wrapper and not of type OracleConnection.
                            Any suggestions ?

                            I was also wondering whether I could have one joseki deployment and several oracle triple stores referenced by it if there is only one JNDI ?

                            Is there are more recent spatial release that is available that addresses some of these issues ?
                            • 11. Re: Jena connection pooling
                              715399
                              Hi,

                              Let me suggest using OC4J as an application/web server for Joseki. It's part of the Oracle database installation and we have verified that Jena Adapter/Joseki can be setup deployed using it.

                              If you want to pursue the OC4J route, please contact me at vladimir dot kolovski at oracle dot com and I'll help you set it up.

                              As for your other question - with one Joseki deployment you could refer to multiple semantic models within one Oracle database. You can create a separate SPARQL endpoint for each model if you want. You need to modify the Joseki configuration file for this. Please see section 7.2.2. of the Semantic Technologies user guide for more details.

                              The next patch release of Jena Adapter will have Tomcat support; although I did notice someone in the forum already using Tomcat with Jena Adapter:
                              When i run load test on oracle RDF i get the following modelname_RI busy

                              Cheers,
                              Vladimir