[ 
https://issues.apache.org/jira/browse/DERBY-3306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kristian Waagan updated DERBY-3306:
-----------------------------------

    Attachment: derby-3306-1a-create_db_by_default.diff

'derby-3306-1a-create_db_by_default.diff' is a suggestion for how the problem 
can be solved.
The data sources will now by default have the createDatabase property set to 
'create', and a database will be created if it does not exist. This is in line 
with how TestConfiguration.openDefaultConnection behaves.

I have verified that jdbc4.StatementEventsTest can be run individually with the 
patch applied, and now I'm running the regression tests to ensure the patch 
does not break any other test.
One thing that can cause problems, is if a data source is used to test what 
happens when you try to connect to a non-existing databases. If there are such 
tests, these have to explicitly (un)set createDatabase.

Note that the patch will affect both JDBCDataSource and J2EEDataSource.

Patch ready for comments / review.

> jdbc4.StatementEventsTest cannot be run individually in a clean environment
> ---------------------------------------------------------------------------
>
>                 Key: DERBY-3306
>                 URL: https://issues.apache.org/jira/browse/DERBY-3306
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.4.0.0
>            Reporter: Kristian Waagan
>            Assignee: Kristian Waagan
>            Priority: Minor
>         Attachments: derby-3306-1a-create_db_by_default.diff
>
>
> jdbc4.StatementEventsTest cannot be run individually in a clean environment 
> because the test database is not created if it does not exist.
> Excerpt of output from JUnit:
> 32) 
> testErrorEventOnClosedConnection_pooled_prepared(org.apache.derbyTesting.functionTests.tests.jdbc4.StatementEventsTest)java.sql.SQLNonTransientConnectionException:
>  The connection was refused because the database wombat was not found.
>         at 
> org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:70)
>         at 
> org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:362)
>         at 
> org.apache.derby.client.ClientPooledConnection.<init>(ClientPooledConnection.java:89)
>         at 
> org.apache.derby.client.ClientPooledConnection40.<init>(ClientPooledConnection40.java:47)
>         at 
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newClientPooledConnection(ClientJDBCObjectFactoryImpl40.java:73)
>         at 
> org.apache.derby.jdbc.ClientConnectionPoolDataSource.getPooledConnectionX(ClientConnectionPoolDataSource.java:100)
>         at 
> org.apache.derby.jdbc.ClientConnectionPoolDataSource.getPooledConnection(ClientConnectionPoolDataSource.java:63)
>         at 
> org.apache.derbyTesting.functionTests.tests.jdbc4.StatementEventsTest.setUp(StatementEventsTest.java:125)
>         at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:96)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
>         at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
>         at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
>         at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
>         at junit.extensions.TestSetup.run(TestSetup.java:25)
> Caused by: org.apache.derby.client.am.DisconnectException: The connection was 
> refused because the database wombat was not found.
>         at 
> org.apache.derby.client.net.NetConnectionReply.parseRDBNFNRM(NetConnectionReply.java:1022)
>         at 
> org.apache.derby.client.net.NetConnectionReply.parseAccessRdbError(NetConnectionReply.java:448)
>         at 
> org.apache.derby.client.net.NetConnectionReply.parseACCRDBreply(NetConnectionReply.java:306)
>         at 
> org.apache.derby.client.net.NetConnectionReply.readAccessDatabase(NetConnectionReply.java:133)
>         at 
> org.apache.derby.client.net.NetConnection.readSecurityCheckAndAccessRdb(NetConnection.java:887)
>         at 
> org.apache.derby.client.net.NetConnection.flowSecurityCheckAndAccessRdb(NetConnection.java:799)
>         at 
> org.apache.derby.client.net.NetConnection.flowUSRIDPWDconnect(NetConnection.java:620)
>         at 
> org.apache.derby.client.net.NetConnection.flowConnect(NetConnection.java:435)
>         at 
> org.apache.derby.client.net.NetConnection.initialize(NetConnection.java:296)
>         at 
> org.apache.derby.client.net.NetConnection.<init>(NetConnection.java:280)
>         at 
> org.apache.derby.client.net.NetConnection40.<init>(NetConnection40.java:125)
>         at 
> org.apache.derby.client.net.ClientJDBCObjectFactoryImpl40.newNetConnection(ClientJDBCObjectFactoryImpl40.java:260)
>         at 
> org.apache.derby.client.ClientPooledConnection.<init>(ClientPooledConnection.java:75)
>         ... 29 more
> FAILURES!!!
> Tests run: 32,  Failures: 0,  Errors: 32

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to