Hi again,
I dont know if explain my process will help but maybe:
try (Connection connection = DriverManager.getConnection(dbUrl, dbUser,
dbPwd);
BufferedReader reader = new BufferedReader(
new FileReader("create-tables.sql"));) {
ScriptRunner runner = new ScriptRunner(connection, false, true);
runner.runScript(reader);
connection.close();
} catch (Exception e) {
e.printStackTrace();
throw e;
}
In the sql file, I have all my requests to create all my tables and the
script runner execute one statement by request.
I start to think thats due to the autocommit and so by consequence the
database access.
Regards,
Mathieu
De : mathieu ferlay [mailto:[email protected]]
Envoyé : jeudi 16 mars 2017 15:02
À : [email protected]
Objet : RE: issue wtih foreign keys
Hi,
I have change my request by using alter table do it but I still have some
lost of process. Its look like an infinite loop inside the execute
statement.
I dont know what it could causes that.
Regards,
Mathieu
De : mathieu ferlay [mailto:[email protected]]
Envoyé : jeudi 16 mars 2017 10:05
À : [email protected]
<mailto:[email protected]>
Objet : issue wtih foreign keys
Hi, ill try to create the following table C. I assume that tables A & B are
executed before C. But when I try to execute the statement for the table C,
the process nerver back from the statement.execute(request). Furthermore, I
obtain also the following trace when I force the commit with
connection.commit();
' (line 120): *** ERROR[8838] Unable to receive reply from Compiler,
possibly caused by internal errors when compiling SQL statements, processing
DDL statements, or executing the builtin stored procedures. [2017-03-16
09:02:56]
Could you tell me which kind of reasons could provoked it.
CREATE TABLE IF NOT EXISTS A (
AID VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NOT NULL,
Description VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NULL,
PRIMARY KEY(AID)
)
CREATE TABLE IF NOT EXISTS B (
Name VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NOT NULL,
FirstName VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NOT NULL,
BID VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NOT NULL,
PRIMARY KEY(BID)
)
CREATE TABLE IF NOT EXISTS C (
BID VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NOT NULL,
AID VARCHAR(255) CHARACTER SET utf8 COLLATE DEFAULT NOT NULL,
PRIMARY KEY(AID,BID),
FOREIGN KEY(AID)
REFERENCES A(AID),
FOREIGN KEY(BID)
REFERENCES B(BID)
)
Regards
Mathieu FERLAY