Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 55568 invoked from network); 20 Apr 2010 15:26:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 20 Apr 2010 15:26:15 -0000 Received: (qmail 93554 invoked by uid 500); 20 Apr 2010 15:26:15 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 93522 invoked by uid 500); 20 Apr 2010 15:26:15 -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 93515 invoked by uid 99); 20 Apr 2010 15:26:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Apr 2010 15:26:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 20 Apr 2010 15:26:13 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o3KFPpe4013962 for ; Tue, 20 Apr 2010 15:25:51 GMT Message-ID: <23937524.90391271777151605.JavaMail.jira@thor> Date: Tue, 20 Apr 2010 11:25:51 -0400 (EDT) From: "Chris Dolan (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-4622) Specify "database:" URL prefix in documentation In-Reply-To: <8723207.88741271773729999.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858939#action_12858939 ] Chris Dolan commented on DERBY-4622: ------------------------------------ Hmm, I didn't know about the 1-character special case. It looks like I got myself in trouble by using the path part of a file:// url: Caused by: java.sql.SQLException: Invalid value for property 'databaseName'='/C:/AppData/local/Avid/uddi_eclipse/juddiDB/'. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:45) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:87) at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:93) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Util.java:179) at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:484) at org.apache.derby.jdbc.EmbeddedDataSource.getConnection(EmbeddedDataSource.java:423) at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69) at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423) ... 15 more If I massage the file:// URL into a File instance and use File.getAbsolutePath() which gets rid of the leading "/" then you're right and the code works as you have described. So it looks like this is about 90% user error. Possible code/doc changes: * explicitly support a new "file" sub-subprotocol in addition to the basic "directory", "classpath", "jar", "http", and "https" * add a 2-char exception for "/[a-zA-z]:" * add a message to the tutorial that states that the implicit default protocol is "directory:" and mention a few of the others Thank you! > Specify "database:" URL prefix in documentation > ----------------------------------------------- > > Key: DERBY-4622 > URL: https://issues.apache.org/jira/browse/DERBY-4622 > Project: Derby > Issue Type: Bug > Components: Documentation > Reporter: Chris Dolan > Priority: Trivial > > The tutorial step titled "Activity 3: Run a JDBC program using the embedded driver" at the following URL (http://db.apache.org/derby/docs/10.4/getstart/getstart-single.html#tgsactivity3_Setup) recommends this syntax for specifying a directory-based datasource: > > String connectionURL = "jdbc:derby:" + dbName + ";create=true"; > For Windows users who need to specify an absolute path to the database, this is a problem because the connection interprets "c:/path/to/db" as non-existent protocol "c" and a database name of "/path/to/db". Better documentation would be explicitly specify the protocol: > String connectionURL = "jdbc:derby:directory:" + dbName + ";create=true"; > (this would have saved me about a day of troubleshooting...) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.