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

how it initialize for sqlite #12

Open
GF-Huang opened this issue May 3, 2016 · 4 comments
Open

how it initialize for sqlite #12

GF-Huang opened this issue May 3, 2016 · 4 comments

Comments

@GF-Huang
Copy link

GF-Huang commented May 3, 2016

sqlite do not need localhost
System.setProperty("norm.serverName", "localhost");

@ccleve
Copy link
Member

ccleve commented May 3, 2016

Ok. Does it work for sqllite otherwise?

@GF-Huang
Copy link
Author

GF-Huang commented May 3, 2016

never try other, because i'm using sqlite and i must use it in my environment.

@ccleve
Copy link
Member

ccleve commented May 3, 2016

No, what I mean is, does it work ok for sqllite? Are you having any
problems?

On Tue, May 3, 2016 at 1:28 PM, Great Fire Wall [email protected]
wrote:

never try other, because i'm using sqlite and i must use it in my
environment.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub
#12 (comment)

@GF-Huang
Copy link
Author

GF-Huang commented May 3, 2016

it's not work for sqlite.
but I see https://github.com/brettwooldridge/HikariCP/issues/393, and make my code like this, it work fine.
code:

import com.dieselpoint.norm.Database;

public final class Db extends Database {
    @Override
    protected DataSource getDataSource() throws SQLException {
        HikariConfig config = new HikariConfig();
        config.setDriverClassName("org.sqlite.JDBC");
        config.setJdbcUrl("jdbc:sqlite:file.db");
        config.setConnectionTestQuery("SELECT 1");
        config.setMaximumPoolSize(100);
        config.setInitializationFailFast(true); // optional

        return new HikariDataSource(config);
    }
}

main here:
    Db db = new Db();
    db.getConnection();  // work fine, and file.db will create.

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

No branches or pull requests

2 participants