I am trying to execute a simple CREATE TABLE query on an oracle10g database using java. This is what I am doing:
Connection conn = //create connection //open connection. No errors/warnings are generated so I assume this succeeds Statement statement = conn.createStatement(); ResultSet rs = statement.executeQuery("CREATE TABLE t1 (c1 INTEGER NOT NULL, c2 VARCHAR(100), c3 INTEGER NULL, CONSTRAINT m_pk PRIMARY KEY (c1));"); ... //close connection. No errors again so I assume it succeeds.
When I execute the command (copying and pasting into terminal window) directly on the command line, it succeeds. When I run the above java code, this is the error I get:
java.sql.SQLSyntaxErrorException: ORA-00911: invalid character
I dont understand how I could have an invalid character since copying and pasting it into terminal works perfectly fine.