Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HikariCP as JNDI Datasource #8

Closed
rsinelle opened this issue Dec 10, 2013 · 3 comments
Closed

HikariCP as JNDI Datasource #8

rsinelle opened this issue Dec 10, 2013 · 3 comments

Comments

@rsinelle
Copy link

I have trying to test HikariCP as jndi datasource, but i cannot find the way to add it as jndi datasource in tomcat 7.
If it's possible can you provide the configuration or if not can you add this feature ?

@brettwooldridge
Copy link
Owner

Configuration of JNDI is outside of the control of a pooling provider. Here is a link to the Tomcat JNDI configuration documentation.

http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example

Specifically, the Context Configuration section is what you need. And this is the full documentation for Tomcat JNDI, specifically the Using Resources section may interest you.

http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html

@fabian
Copy link

fabian commented Mar 20, 2014

The problem is that com.zaxxer.hikari.HikariDataSource is not usable with the org.apache.naming.factory.BeanFactory provided by Tomcat.

We had to write our own wrapper for the HikariDataSource which looks like this:

public class TomcatHikariDataSource extends HikariDataSource
{
    public void setUser(String user)
    {
        addDataSourceProperty("user", user);
    }

    public void setPassword(String password)
    {
        addDataSourceProperty("password", password);
    }

    public void setUrl(String url)
    {
        addDataSourceProperty("url", url);
    }
}

@brettwooldridge
Copy link
Owner

Checkout the dev branch. It has support for username, password, jdbcUrl, and driverClassName now.

git clone https://github.com/brettwooldridge/HikariCP.git
cd HikariCP
git checkout dev
mvn install

Then use HikariCP-1.3.4-SNAPSHOT.jar or 1.3.4-SNAPSHOT as a pom dependency. Let me know if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants