Configure Stardog as JNDI for WAS

2 views
Skip to first unread message

justforthe...@gmail.com

unread,
Apr 18, 2016, 8:58:30 AM4/18/16
to Stardog
We have been looking for information all around but couldn't find anything.

Is there any example to configure a JNDI connection over a WAS (like Tomcat 8)?



We have seen the examples to create the connection pool with code, but in a Web project, the server should manage it for us (this is how we have it with our relational database). Basically we need to know how to fill this structure:

<Context>
    <Resource name="...." type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000" 
        url="...."
        driverClassName="???"
        username="admin" password="admin" />
</Context>

Thank you in advance.

NOTE: We have seen there is a Spring project, but we don't use Spring.

Kendall Clark

unread,
Apr 18, 2016, 9:04:06 AM4/18/16
to Stardog
What version of Stardog are you using? Developer or Community?
--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

justforthe...@gmail.com

unread,
Apr 18, 2016, 9:34:54 AM4/18/16
to Stardog
Community.

Thanks.

justforthe...@gmail.com

unread,
Apr 21, 2016, 3:58:38 AM4/21/16
to Stardog, justforthe...@gmail.com
Anybody has experience with this?  Or can share a pointer to the right information source?

Any help is greatly appreciated

Zachary Whitley

unread,
Apr 21, 2016, 6:41:20 AM4/21/16
to sta...@clarkparsia.com
I haven't done it myself but I'd start here [1]

You'd need to register either a ConnectionPool or Connection which is probably going to take a little work to get just right. It would be great if you could post the results for anyone interested in following in your footsteps. Let me know if you have any trouble and I'll try to help. 



---
You received this message because you are subscribed to the Google Groups "Stardog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.

Jeremy Iron

unread,
Apr 21, 2016, 7:01:48 AM4/21/16
to stardog
Thanks for your help, I will update my results.

I knew about your pointer, that is how normally you will load MySQL for example. But when it comes to Stardog we are a bit lost... Because as seen at [http://tomcat.apache.org/tomcat-8.0-doc/jndi-resources-howto.html#JDBC_Data_Sources]  this information has to be provided:

<Context>
    <Resource name="...." type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000" 
        url="...."
        driverClassName="???"
        username="admin" password="admin" />
</Context>

As the documentation says, "Use of the JDBC Data Sources JNDI Resource Factory requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application.". Normally the driverClassName is a single JAR file provided by, for example, MySQL, Oracle or MSSQL. So I am a bit lost about what to use in the case of Stardog.

I have found some hints "NOTE: Stardog does not ship with JDBC drivers." at [https://github.com/Complexible/stardog-docs/blob/master/src/doc/virtual-graphs.ad], but it doesn't seem to apply to my case, since it is about Stardog Virtual Graphs using relational databases.





---
You received this message because you are subscribed to a topic in the Google Groups "Stardog" group.
To unsubscribe from this topic, visit https://groups.google.com/a/clarkparsia.com/d/topic/stardog/fJvAOQ8HOIo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stardog+u...@clarkparsia.com.

Zachary Whitley

unread,
Apr 21, 2016, 7:17:24 AM4/21/16
to sta...@clarkparsia.com


On Apr 21, 2016, at 7:01 AM, Jeremy Iron <justforthe...@gmail.com> wrote:

Thanks for your help, I will update my results.

I knew about your pointer, that is how normally you will load MySQL for example. But when it comes to Stardog we are a bit lost... Because as seen at [http://tomcat.apache.org/tomcat-8.0-doc/jndi-resources-howto.html#JDBC_Data_Sources]  this information has to be provided:

<Context>
    <Resource name="...." type="javax.sql.DataSource"
        maxActive="100" maxIdle="30" maxWait="10000" 
        url="...."
        driverClassName="???"
        username="admin" password="admin" />
</Context>

As the documentation says, "Use of the JDBC Data Sources JNDI Resource Factory requires that you make an appropriate JDBC driver available to both Tomcat internal classes and to your web application.". Normally the driverClassName is a single JAR file provided by, for example, MySQL, Oracle or MSSQL. So I am a bit lost about what to use in the case of Stardog.


I know they make it very easy to work with jdbc data sources but I don't think it can only be used with them. 

I have found some hints "NOTE: Stardog does not ship with JDBC drivers." at [https://github.com/Complexible/stardog-docs/blob/master/src/doc/virtual-graphs.ad], but it doesn't seem to apply to my case, since it is about Stardog Virtual Graphs using relational databases.

You'd need to set that up in Stardog assuming your running it as a stand alone instance and not in the server container which would probably require even more configuration to set up. 

Zachary Whitley

unread,
Apr 21, 2016, 7:20:56 AM4/21/16
to sta...@clarkparsia.com

I don't think you mentioned what version of tomcat you're targeting. 

On Apr 21, 2016, at 7:01 AM, Jeremy Iron <justforthe...@gmail.com> wrote:

Jeremy Iron

unread,
Apr 21, 2016, 8:20:51 AM4/21/16
to stardog
Mmmm.. I will check these days if this works with a Custom resource factory. I have used that before, but just to provide objects. This will supply only connections and keep a static ConnectionPool. Not sure if a close/destroy method can be implemented too (I have experienced before having a pool in Java still active while it has been closed by Stardog). Will check and will get back.

I'm using v8, but v7 is fine too.

Jeremy Iron

unread,
Apr 21, 2016, 8:27:25 AM4/21/16
to stardog

Al Baker

unread,
Apr 21, 2016, 8:33:26 AM4/21/16
to stardog
The DataSource in the Spring extension was modeled after matching the typical JDBC workflow common to Tomcat/Spring apps. There is a corresponding SnarlTemplate that mirrors JdbcTemplate.

Pull requests welcome too :)

Al

Jeremy Iron

unread,
Apr 21, 2016, 8:54:09 AM4/21/16
to stardog
Thanks Al. I think that code will help me as well.
Reply all
Reply to author
Forward
0 new messages