This topic was brought up 17 May 2000 but I'm not certain why there is a
problem in this case.
(I'm new to both SQL and JDBC and have been fooling around with InstantDB
3.20 beta 1 with MRJ 2.2.2/MacOS 9.0.4 with one of the tutorials from Java
Developer Connection. Please forgive me if this has an obvious solution.)
When I make all the appropriate changes to CreateJoltData.java (*.prp file,
JDBC driver), compile and run the CreateJoltData program, I get the following
error:
problems with SQL sent to jdbc:idb:cafejolt.prp: create table JoltData
(programmer varchar (32), day varchar (3), cups integer);
Don't understand SQL after: ";"
Expected: "UNIQUE" found: ";"
If I take out all of the ";" from all the statements in the source code (see
below), it compiles and runs perfectly. This also happens when reading
examples that have a prepared *.sql file; if I take out the ";", then
everything runs okay...otherwise I get a single or multiple errors such as
the one above.
This doesn't make any sense to me based on what I've read. Does someone have
an idea as to what might be wrong? The prp file is the same as sample.prp
with the name modified.
Here is the offending CreateJoltData.java file:
import java.sql.*; //import all the JDBC classes
public class CreateJoltData {
static String[] SQL = {
"create table JoltData ("+
"programmer varchar (32), "+
"day varchar (3), "+
"cups integer);",
"insert into JoltData values ('Gilbert', 'Mon', 1);",
"insert into JoltData values ('Wally', 'Mon', 2);",
"insert into JoltData values ('Edgar', 'Tue', 8);",
"insert into JoltData values ('Wally', 'Tue', 2);",
"insert into JoltData values ('Eugene', 'Tue', 3);",
"insert into JoltData values ('Josephine', 'Wed', 2);",
"insert into JoltData values ('Eugene', 'Thu', 3);",
"insert into JoltData values ('Gilbert', 'Thu', 1);",
"insert into JoltData values ('Clarence', 'Fri', 9);",
"insert into JoltData values ('Edgar', 'Fri', 3);",
"insert into JoltData values ('Josephine', 'Fri', 4);",
};
public static void main(String[] args) {
String URL = "jdbc:idb:cafejolt.prp";
String username = "";
String password = "";
try {
Class.forName("org.enhydra.instantdb.jdbc.idbDriver");
} catch (Exception e) {
System.out.println("Failed to load instantDB JDBC driver.");
return;
}
Statement stmt = null;
Connection con=null;
try {
con = DriverManager.getConnection (
URL,
username,
password);
stmt = con.createStatement();
} catch (Exception e) {
System.err.println("problems connecting to " + URL);
}
try {
for (int i = 0; i < SQL.length; i ++) {
stmt.execute( SQL[ i ] );
}
con.close();
} catch (Exception e) {
System.err.println("problems with SQL sent to " + URL +
": "+e.getMessage());
}
}
}
-----------------------------------------------------------------------------
To unsubscribe from this mailing list, send email to majordomo@enhydra.org
with the text "unsubscribe instantdb" in the body of the email.
If you have other questions regarding this mailing list, send email to
the list admin at owner-instantdb@enhydra.org.
|