Warning when using Apache Derby in memory
Asked Answered
T

1

9

I have a number of unit tests, which use Apache Derby in memory. My connection url is: jdbc:derby:memory:srf.derby;create=true

I discovered that each time, when a method marked as @Transactional is finishing, I receive a Derby warning

12:53:28:5328 [org.hibernate.util.JDBCExceptionReporter] [main] WARN  - SQL Warning: 10000, SQLState: 01J01
12:53:28:5328 [org.hibernate.util.JDBCExceptionReporter] [main] WARN  - Database 'memory:srf.derby' not created, connection made to existing database instead.

Why is it? What I'm doing wrong?

Thank you

Tongue answered 24/3, 2011 at 10:59 Comment(1)
Is it Spring's @Transactional?Peafowl
D
10

You're not doing anything wrong. You're passing ';create=true' each time, but the database is only created the first time your program accesses it. Since it's in-memory, the database then hangs around until your program exits, at which point it disappears.

You could avoid the warning by passing ';create=true' only on the first test in your test suite, and then subsequent tests do not need to pass that value.

Or, you could just not worry about the warning.

Dall answered 24/3, 2011 at 13:43 Comment(2)
I see that the problem is not database creation. During the same test, each time I execute a transactional method this warning is printed. I switched to a file based embedded DB, but still have the same warningTongue
To be precise, each time you connect to a Derby database which already exists, using a connection URL that contains ";create=true", you will get the warning. It's not because it's in-memory, it's because it already exists and you are telling Derby to create it.Dall

© 2022 - 2024 — McMap. All rights reserved.