You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Chris Dolan (JIRA)" <ji...@apache.org> on 2010/04/20 16:28:49 UTC

[jira] Created: (DERBY-4622) Specify "database:" URL prefix in documentation

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.


[jira] Closed: (DERBY-4622) Specify "database:" URL prefix in documentation

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan closed DERBY-4622.
----------------------------------


Closing.

> 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.


[jira] Commented: (DERBY-4622) Specify "database:" URL prefix in documentation

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858925#action_12858925 ] 

Kristian Waagan commented on DERBY-4622:
----------------------------------------

Hi Chris,

I'm pretty sure Derby expects the protocol to be longer than one char. In that case, this isn't a doc issue, but a bug.
Can you post the exception (and the stack trace if any [1]) you get?
What's the Derby version you are using?
And for good measure, which Windows version?

On Windows XP with Derby 10.5.3 I can connect to the database below in ij:
  ij> connect 'jdbc:derby:c:/test/kwdb;create=true'
If I specify s instead of c (non-existing drive), I get:
  ERROR XBM0H: Directory S:\test\kwdb cannot be created.


Thanks,
--

[1] With ij, specify -Dij.exceptionTrace=true

> 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.


[jira] Commented: (DERBY-4622) Specify "database:" URL prefix in documentation

Posted by "Chris Dolan (JIRA)" <ji...@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.


[jira] Commented: (DERBY-4622) Specify "database:" URL prefix in documentation

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859374#action_12859374 ] 

Bryan Pendleton commented on DERBY-4622:
----------------------------------------

There's something funky about the leading C: in Windows file paths, and the Java URL syntax.

I seem to remember that you need extra slashes in the front, along the lines of

   ///c:/AppData/local/etc.

If indeed this works, we could put it in the docs somewhere.

> 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.


[jira] Commented: (DERBY-4622) Specify "database:" URL prefix in documentation

Posted by "Kim Haase (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859359#action_12859359 ] 

Kim Haase commented on DERBY-4622:
----------------------------------

I am hesitant to add information about special cases and protocols to the Getting Started guide, since the instructions there work fine for the elementary tutorial. The more advanced information is in the Developer's Guide ("Derby JDBC database connection URL") and should probably stay there. Users who are performing tasks beyond the tutorial level need to refer to the more advanced Derby documentation in any case. So I would suggest that we refer people to the topic in the Dev Guide rather than duplicate the information here.

> 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.


[jira] Resolved: (DERBY-4622) Specify "database:" URL prefix in documentation

Posted by "Chris Dolan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4622?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Dolan resolved DERBY-4622.
--------------------------------

    Resolution: Not A Problem

Kim: Fair enough.  Resolving as user error.

> 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.