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 6150579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:38:05+00:00 2026-05-23T19:38:05+00:00

I use the in-memory database that comes with Play Framework, when I have db=mem

  • 0

I use the in-memory database that comes with Play Framework, when I have db=mem in the configuration file, for development.

How can I connect to this database using JDBC? and not the JPA that is the default way.

I have tried with this method in my controller:

public static void addToDB() {
    try {
        Connection conn = DriverManager.getConnection("jdbc:h2:mem:play");
        Statement stmt = conn.createStatement();
        stmt.execute(sql);
        stmt.close();
        conn.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}

But I get an error message that I need to provide an username and password:

org.h2.jdbc.JdbcSQLException: Wrong user name or password [8004-149]

If I visit the web-console on /@db the username sa is used and no password.


Now I logged in via the /@db interface and created a table users.

Then I connected to the database in a controller method and used this jdbc-string: jdbc:h2:mem:play:sa and then tried to insert to the table users but I get this error message:

org.h2.jdbc.JdbcSQLException: Table "USERS" not found; SQL statement:

How should I connect to the in-memory H2 database in Play Framework using JDBC?

  • 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-23T19:38:05+00:00Added an answer on May 23, 2026 at 7:38 pm

    DB.getConnection(), should do the job.

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

Sidebar

Related Questions

Can I use shared memory on Windows in order to have a common memory
I have an application that loads lots of data into memory (this is because
I'm importing data from a CSV file that comes from excel, but i can't
I have an Access database that I use for reporting. After I do the
I have an MEMORY MYSQL database that contains a table with 200k+ rows. I
I am trying to understand my embedded Linux application's memory use. The /proc/pid/maps utility/file
Can I set rails to use mysql with MEMORY as the DB engine? I
Can you please tell me how can I use valgrind for memory profile? The
I have a static std::vector in a class. When I use Microsoft's memory leak
I have a csv file that has 3.5 million codes in it. I should

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.