db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ruzal Yumaev <ruzalse...@gmail.com>
Subject [No Subject]
Date Wed, 25 Mar 2015 19:55:23 GMT
Hello!
I'm creating table USERS where primary key ID has autogenerating column:
 ID INT NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT
BY 1) PRIMARY KEY
After inserting second or more row ID column increment to 100 and
"INCREMENT BY 1" - it's multipling for one hundred.
Example from table:

ID FIO BIRTHDAY GROUPNUM
1 Name 2012-12-21 21312
101 Name 2001-12-21 23412
201 Name 2001-12-02 21323
I attach log file  and maven dependency is
<dependency>
    <groupId>org.apache.derby</groupId>
    <artifactId>derby</artifactId>
    <version>10.11.1.1</version>
</dependency>



Code:

String dbURL1 = "jdbc:derby:bd;create=true";
Connection conn1 = null;
try {
    conn1 = DriverManager.getConnection(dbURL1);
    if (conn1 != null) {
        System.out.println("Connected to database");
    }
    Statement statement = conn1.createStatement();
    try {
        System.out.println("Create table USERS");
        statement.executeUpdate("CREATE TABLE USERS (ID INT NOT NULL
GENERATED ALWAYS AS IDENTITY(START WITH 1, INCREMENT BY 1) PRIMARY
KEY, FIO VARCHAR(255) NOT NULL,BIRTHDAY DATE, GROUPNUM VARCHAR(15))");
        System.out.println("Table USERS created");
    } catch (SQLException e) {
        System.out.println("Table USERS already exists");
    }

Mime
View raw message