Visual Studio Code JDBC Acess to Derby Database

时间:2018-11-13 07:48:16

标签: java jdbc visual-studio-code derby

I am trying to run a java program (demo program included in the Apache Derby installation folder called SimpleApp) that connects to a Derby database using JDBC, in Visual Studio Code (with an integrated terminal), but I keep getting the same error message:

>java SimpleApp

SimpleApp starting in embedded mode
----- SQLException -----
   SQL State: 08001
   Error Code: 0
   Message: No suitable driver found for jdbc:derby:derbyDB;create=true
SimpleApp finished

I ran the SimpleApp java file in the command prompt and it worked just fine:

>java SimpleApp

SimpleApp starting in embedded mode
Connected to and created database derbyDB
Created table location
Inserted 1956 Webster
Inserted 1910 Union
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Verified the rows
Dropped table location
Committed the transaction
Derby shut down normally
SimpleApp finished

I am using the following:

I have the following settings:

  • JDK path in VS Code:
    "java.home": "C:\\Program Files\\Java\\jdk-11.0.1"
  • JAVA_HOME system variable:
    C:\Program Files\Java\jdk-11.0.1
  • DERBY_HOME system variable:
    C:\Program Files\Apache\db-derby-10.14.2.0-bin
  • CLASSPATH system variable:
    .;%JAVA_HOME%\lib;%DERBY_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbytools.jar;
  • In the Path system variable:
    %JAVA_HOME%\bin and %DERBY_HOME%\bin

Some notes from the SimpleApp java file:

This sample program is a minimal Java application showing JDBC access to a Derby database. Derby applications can run against Derby running in an embedded or a client/server framework. When Derby runs in an embedded framework, the JDBC application and Derby run in the same Java Virtual Machine (JVM). The application starts up the Derby engine. When Derby runs in a client/server framework, the application runs in a different JVM from Derby. The connectivity framework (in this case the Derby Network Server) provides network connections. The client driver is loaded automatically.

0 个答案:

没有答案