Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 66806 invoked from network); 16 Feb 2011 21:50:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 16 Feb 2011 21:50:46 -0000 Received: (qmail 16735 invoked by uid 500); 16 Feb 2011 21:50:46 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 16696 invoked by uid 500); 16 Feb 2011 21:50:45 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 16684 invoked by uid 99); 16 Feb 2011 21:50:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Feb 2011 21:50:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Feb 2011 21:50:44 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6B99C1AA475 for ; Wed, 16 Feb 2011 21:50:24 +0000 (UTC) Date: Wed, 16 Feb 2011 21:50:24 +0000 (UTC) From: "Kathey Marsden (JIRA)" To: derby-dev@db.apache.org Message-ID: <180335083.1136.1297893024437.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <11618647.184591290124273613.JavaMail.jira@thor> Subject: [jira] Commented: (DERBY-4907) EmbeddedXADataSource with ;create=true attribute set in setDatabaseName fails with java.sql.SQLException: Database not available MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-4907?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995536#comment-12995536 ] Kathey Marsden commented on DERBY-4907: --------------------------------------- It would be a good performance optimization to set a shortDatabaseName field on set rather than parsing databaseName on every connection. I think the current implementation is ok too as I don't think it creates that big a hit. I have always combined code and test in the patch, but it actually would be nice to have them separate so the reviewer could run the test first and see that it fails and then with the code change to see that it passes. Maybe I'll start doing that #:) On shortName() vs getShortName() I think the name is ok. I am concerned that often reflection is used to get the bean properties on DataSources and don't want this one to show up but perhaps if it is not public that is not an issue. I am just not sure. Also as it is currently implemented it is not just a straight getter and does some manipulation so the name is ok in that regard too. > EmbeddedXADataSource with ;create=true attribute set in setDatabaseName fails with java.sql.SQLException: Database not available > -------------------------------------------------------------------------------------------------------------------------------- > > Key: DERBY-4907 > URL: https://issues.apache.org/jira/browse/DERBY-4907 > Project: Derby > Issue Type: Bug > Components: JDBC > Affects Versions: 10.1.3.1, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.3.0, 10.6.2.1 > Reporter: Kathey Marsden > Assignee: Siddharth Srivastava > Priority: Minor > Labels: derby_triage10_8 > Attachments: derby4907.diff, derby4907.diff, derby4907.txt, derby4907_final.diff > > > Setting the ;create=true attribute in setDatabaseName with EmbededXADataSource and EmbeddedXADataSource40 fails with > $ java TestDerbyCreate > Exception in thread "main" java.sql.SQLException: Database not available > at org.apache.derby.jdbc.EmbeddedXADataSource.setupResourceAdapter(Embe > dedXADataSource.java:175) > at org.apache.derby.jdbc.EmbeddedXADataSource.getXAConnection(EmbeddedX > DataSource.java:101) > at TestDerbyCreate.main(TestDerbyCreate.java:18) > > using the create attributie in databaseName works fine with EmbeddedDataSource. > Using setCreateDatabase("create") with EmbeddedXADataSource is a good work around and I think generally preferable. > import java.sql.*; > import javax.sql.*; > public class TestDerbyCreate > { > public static void main(String[] args) throws Throwable > { > org.apache.derby.jdbc.EmbeddedXADataSource ds = > new > org.apache.derby.jdbc.EmbeddedXADataSource(); > ds.setDatabaseName("TestDB;create=true"); > ds.setUser("dbuser1"); > ds.setPassword("dbpwd1"); > PooledConnection pooledConn = ds.getXAConnection(); > Connection conn = pooledConn.getConnection(); > System.out.println("Database product: " + > conn.getMetaData().getDatabaseProductName()); > System.out.println("Database version: " + > conn.getMetaData().getDatabaseProductVersion()); > System.out.println("Driver name: " + > conn.getMetaData().getDriverName()); > System.out.println("Driver version: " + > conn.getMetaData().getDriverVersion()); > System.out.println("JDBC driver major ve -- This message is automatically generated by JIRA. - For more information on JIRA, see: http://www.atlassian.com/software/jira