#99 preferredTestQuery fails when schema not yet created

open
nobody
None
5
2011-08-26
2011-08-26
Thomas Hartwig
No

When the schema in the database is not yet created then it is not possible to use the pool when a preferredTestQuery is defined. This will result in a StackOverflowError because of an other bug in c3p0.
I know you might think automatic schema creation might be not a good idea. But Hibernate for instance is quite good in this and I use it.

Discussion

  • Steve Waldman
    Steve Waldman
    2012-05-13

    You can choose a test query that is independent of your schema, e.g. SELECT 1. (In theory, there is some hazard the driver will optimize the query if it is too simple, and respond locally rather than test the Connection. But in practice, does that happen?) I have no problem with automatic schema creation, but it would be unwieldy to try to let users choose a schema-specific test query and then try to track DDL to note when the test queries become workable. Users can, if they wish, use the default test while the schema is underconstruction, and then set a schema-specific test query.

    Also, consider automaticTestTable, which is effectively automatic schema creation for a test schema.