有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Visual Studio代码JDBC访问Derby数据库

我试图运行一个java程序(包含在名为SimpleApp的Apache Derby安装文件夹中的演示程序),该程序使用Visual Studio代码(带有集成终端)使用JDBC连接到Derby数据库,但我一直收到相同的错误消息:

>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

我在命令提示符下运行了SimpleApp java文件,它运行得很好:

>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

我正在使用以下工具:

我有以下设置:

  • VS代码中的JDK路径:
    "java.home": "C:\\Program Files\\Java\\jdk-11.0.1"
  • JAVA_主系统变量:
    C:\Program Files\Java\jdk-11.0.1
  • DERBY_主系统变量:
    C:\Program Files\Apache\db-derby-10.14.2.0-bin
  • CLASSPATH系统变量:
    .;%JAVA_HOME%\lib;%DERBY_HOME%\lib\derby.jar;%DERBY_HOME%\lib\derbytools.jar;
  • 在路径系统变量中:
    %JAVA_HOME%\bin%DERBY_HOME%\bin

SimpleApp java文件中的一些注释:

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) 个答案