Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3753016
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:19:38+00:00 2026-05-19T09:19:38+00:00

I’m looking to add a pretty simple SQLite database to an existing Java EE

  • 0

I’m looking to add a pretty simple SQLite database to an existing Java EE application. I’m very used to using EJBs, ORMs, EntityManager, etc. to work with SQL databases. I’ve never not used some sort of ORM to work with relational DBs in Java.

I’ve been “recommended” to use a Java wrapper for SQLite, rather than a JDBC driver – so I’m kind of naked and ORM-less (right?). I’d like to get this up and running quickly.

Context

I’ve been using an in-memory cache, implemented as a Map, which gets filled with entries linearly over time. At some point, like when the app runs overnight, the cache will use all available heap space. Hence, storing the cache on disk (as a SQLite database) rather than in memory (as a Java Map).

Questions

  • How should I manage resources like SQLiteConnection? Normally I would let the container worry about all this, but since I’m not using JDBC, I have to do all this !@#$%ing, non-value-added stuff manually – right?
  • Is there a way to implement this cleanly and transparently? I’d like to be able to just swap out an implementing class – e.g. replace FooMapCacheImpl with FooSQLiteCacheImpl.
  • “[Most] methods are confined to the thread that was used to open the connection”. Is there a simple, straightforward way to ensure that I don’t try to access a SQLiteConnection from threads other than the one that opened it?
  • …and the flip side of that question: can I avoid creating a new connection every time I want to read from/write to the database? It seems a bona fide PITA to have to manage connections per-thread rather than, say, per instance, which is how I’ve been thinking about communicating with databases in the past.

Basically

I’m rather lost when it comes to working with databases in Java/Java EE, without using an ORM.
What’s the right way to do it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T09:19:38+00:00Added an answer on May 19, 2026 at 9:19 am

    I don’t think It is too hard to make a front end that would implements Map and save everything to a database using JDBC, but before doing it, think twice about it. The performance of the whole system might be affected badly.

    However, if the root cause of your problem is the lack of Heap space, you should take a look at Terracotta’s BigMemory. However, it is a commercial (non-free) product.

    Terracotta has a pretty good cache framework as well (ehcache) which is opensource. Look at the cookbook, it might be inspiring.

    If you want to do everything by hand, and you don’t mind using Spring, try spring-jdbc. It is very easy to integrate with any JDBC driver. Take a look at SimpleJdbcTemplate. It does all the boiler plate code for you. You should probably use a connection pool as well, such as commons-dbcp

    The easiest SQLite JDBC driver to use is this one. Since it doesn’t rely on JNI. It might not be as fast, but for quick testing it is perfect.

    If you aren’t binded to SQLite, you can take a look at other available JDBC solutions such as hsqldb or derby

    I hope this will help you out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm making a simple page using Google Maps API 3. My first. One marker
I'm looking for suggestions for debugging... If you view this site in Firefox or
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
Does anyone know how can I replace this 2 symbol below from the string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.