开发者

Java DB Schema 'TEST' does not exist

Hy!!!

I want to ma开发者_如何学编程ke a small DB Demo.

My Error is: Schema 'TEST' does not exist

Picture:

Java DB Schema 'TEST' does not exist


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


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

Envoy


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.


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

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜