You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by cdarling <cd...@126.com> on 2013/07/04 08:52:05 UTC

prob. report in tutorial: space in classpath cause prob. in windows8

Hi,
I'm new to derby and I'm tring out its amazing features (under the guidance of "http://docs.oracle.com/javadb/10.8.2.2/getstart/getstartderby.pdf").
I've encountered a problem and I‘ve (fortunately) get over it. I'm writing to share my experience and hoping (possiblly) to improve the pdf document.

I'm using windows 8 and doing activity 3/4, my classpath of derbyrun/derbyclient contains a space as "Program Files" folder contains one. In such case the program can be compiled but complaints when running it. Details as follows:

C:\Users\Delin\Documents\MATLABprog\derbytutor>set classpath="c:\Program Files\J
ava\jdk1.7.0_21\db\lib\derbyclient.jar";.

C:\Users\Delin\Documents\MATLABprog\derbytutor>java WwdClient
ClassNotFoundException: org.apache.derby.jdbc.ClientDriver

    >>> Please check your CLASSPATH variable   <<<

 . . . exception thrown:

---SQLException Caught---

SQLState:   08001
Severity: 0
Message:  No suitable driver found for jdbc:derby://localhost:1527/jdbcDemoDB;cr
eate=true
java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/
jdbcDemoDB;create=true
        at java.sql.DriverManager.getConnection(DriverManager.java:604)
        at java.sql.DriverManager.getConnection(DriverManager.java:243)
        at WwdClient.main(WwdClient.java:72)
Getting Started With Derby JDBC program ending.

And so I copied the jar files to my personal folder and it works. Details as follows:

C:\Users\Delin\Documents\MATLABprog\derbytutor>set classpath=c:\Users\Delin\Docu
ments\MATLABprog\derbytutor\lib\derbyclient.jar;.

C:\Users\Delin\Documents\MATLABprog\derbytutor>javac WwdClient.java

C:\Users\Delin\Documents\MATLABprog\derbytutor>java WwdClient
org.apache.derby.jdbc.ClientDriver loaded.
Connected to database jdbcDemoDB
 . . . . creating table WISH_LIST
Enter wish-list item (enter exit to end):
Manual for Loving Couples
  __________________________________________________
On 2013-07-04 14:36:21.231 I wished for Manual for Loving Couples
  __________________________________________________
Enter wish-list item (enter exit to end):
Guide for Dayly Living
  __________________________________________________
On 2013-07-04 14:36:21.231 I wished for Manual for Loving Couples
On 2013-07-04 14:36:37.191 I wished for Guide for Dayly Living
  __________________________________________________
Enter wish-list item (enter exit to end):
exit
Closed connection
Getting Started With Derby JDBC program ending.
Hoping this help others.
And if there are any better work around for this issue please kindly let me know.

Thanks

Delin

Re: prob. report in tutorial: space in classpath cause prob. in windows8

Posted by Knut Anders Hatlen <kn...@oracle.com>.
cdarling <cd...@126.com> writes:

> Hi,
> I'm new to derby and I'm tring out its amazing features (under the
> guidance of
> "http://docs.oracle.com/javadb/10.8.2.2/getstart/getstartderby.pdf").
> I've encountered a problem and I‘ve (fortunately) get over it. I'm
> writing to share my experience and hoping (possiblly) to improve the
> pdf document.
>
> I'm using windows 8 and doing activity 3/4, my classpath of
> derbyrun/derbyclient contains a space as "Program Files" folder
> contains one. In such case the program can be compiled but complaints
> when running it. Details as follows:
>
>     C:\Users\Delin\Documents\MATLABprog\derbytutor>set
>     classpath="c:\Program Files\J
>     ava\jdk1.7.0_21\db\lib\derbyclient.jar";.

Hi Delin,

I think that on Windows the CLASSPATH variable shouldn't contain double
quotes, even if the directory name contains a space.

The following seems to work for me:

C:\Users\khatlen\wwd>set CLASSPATH=c:\Program Files\Java\jdk1.7.0_25\db\lib\derbyclient.jar;.

C:\Users\khatlen\wwd>java WwdClient
org.apache.derby.jdbc.ClientDriver loaded.
Connected to database jdbcDemoDB
 . . . . creating table WISH_LIST
Enter wish-list item (enter exit to end):
(...)

Hope this helps,

-- 
Knut Anders