Java DB 架构“测试”不存在

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5831202/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 13:00:32  来源:igfitidea点击:

Java DB Schema 'TEST' does not exist

javajavadb

提问by user547995

Hy!!!

嗨!!!

I want to make a small DB Demo.

我想做一个小的DB Demo。

My Error is: Schema 'TEST' does not exist

我的错误是: Schema 'TEST' does not exist

Picture: enter image description here

图片: 在此处输入图片说明

回答by dunni

Run a "CREATE SCHEMA TEST" one time to create the schema.

运行一次“CREATE SCHEMA TEST”以创建模式。

回答by Manuel

perhaps it is to late but it can be useful for other people who read this site to know the solution to this problem.

也许为时已晚,但对于阅读此站点的其他人来说,了解此问题的解决方案可能很有用。

You have to enable the APP Schema : right klick on APP and then click => Set as default Schema

您必须启用 APP 架构:右键单击 APP,然后单击 => 设置为默认架构

Envoy

使者

回答by Joseph Ottinger

I was able to establish a connection with an uninitialized database, using that user, with the following code:

我能够使用该用户使用以下代码与未初始化的数据库建立连接:

package derby;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class DerbyTest {
public static void main(String[] args) throws SQLException, ClassNotFoundException {
    Connection connection= DriverManager.getConnection("jdbc:derby:testdb;create=true", "test", "test");
    Statement s=connection.createStatement();
    s.execute("create table test_table (name varchar(128))");
    connection.close();
}
}

The main difference between your code and mine is that I used the embedded driver, not the network client, and I created a table in the test, of course. I was not able to replicate the problem you describe.

你的代码和我的主要区别在于我使用的是嵌入式驱动程序,而不是网络客户端,当然,我在测试中创建了一个表。我无法复制您描述的问题。

回答by user5759784

Its very simple You Have to write APP.TESTdon't write simple TEST(as test schema does not exist).

它非常简单,您必须编写 APP.TEST不要编写简单TEST(因为测试模式不存在)。

For example you created a table test in database as you show snapshot then

例如,您在显示快照时在数据库中创建了一个表测试然后

INSERT INTO TEST (.....) STATEMENT 

will not work.

不管用。

Instead

反而

INSERT INTO APP.TEST (....) 

will work.

将工作。