Is it possible to establish a jdbc connection within the jar.
The jar I will be using has the database file.

For eg.
The database used is sqlite. (uses file). The file is been archieved with the jar.
How to initialize a jdbc connection with the db file in the jar.

Thanks in advance.

Recommended Answers

All 3 Replies

Why is it packaged inside the jar? Can't you just have it sitting "near" the jar? I think that would make your job significantly easier...

> Is it possible to establish a jdbc connection within the jar.
> The jar I will be using has the database file.

Just reference the file inside your jar [in your case required for a standalone database like SQLite] like any other resource. Read this.

One thing you need to keep in mind, you can not add/delete/edit database entries if the database file is inside the JAR. You can only query DB about existing entries

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.