Hi Bill,
The schema and table name arguments are case sensitive. In addition,
since you did not use quoted identifiers when you created the table, the
table name is PART_TYPE, not part_type. Try your experiment with an
uppercased table name.
Hope this helps,
-Rick
Wildman wrote:
I am trying to move a Java database application from mySQL to the embedded
version of the Java Database (nee Derby). I successfully create an instance
of the DriverManager and make a connection. Next, I create several tables.
Next I try to use the SYSCS_UTIL.SYSCS_IMPORT utility to load data from a
CSV file into the tables I have just created. I get the following error:
java.sql.SQLException: Table 'BILL.part_type' does not exist.
...even though I have just created the table 'part_type' a few lines above.
Is this possibly related to the 'BILL' schema? When I create the tables, I
don't specify or create any schema, although I do log in as 'Bill' when I
open the database connection.
A version of my source, edited for brevity, follows.
Thanks!
-Bill
- - - - - - - - - - - - - -
Properties props = new Properties();
props.put("user", "Bill");
props.put("password", "******"); // password masked in this copy
String full_url = URL + DEFAULT_DB + ";create=true";
try {
con = DriverManager.getConnection(full_url, props);
} catch (Exception e2) {
JOptionPane.showMessageDialog(this.gui,
"Sorry, got an exception creating the new database: " +
e2,
"Fatal", JOptionPane.INFORMATION_MESSAGE);
e2.printStackTrace(System.out);
return -1;
}
// drop any existing tables - ignore errors
try {
sendSQL("drop table part_type");
} // etc..
try {
sql = "create table part_type ("
+ "part_type_id INTEGER NOT NULL PRIMARY KEY GENERATED
ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),"
+ "partnum varchar(20),"
+ "name varchar(255),"
+ "family varchar(40),"
+ "genus varchar(20),"
+ "image varchar(1)"
+ ")";
sendSQL(sql); // this sends theSQL string to the connection
String infile = getStartDir() + File.separator + "Partsref.csv";
sql = "CALL SYSCS_UTIL.SYSCS_IMPORT_TABLE (null, 'part_type', '"
+ infile + "', null, null, null, 1)";
System.err.println(sql);
sendSQL(sql); // <-- exception here
- - - - - - - - - - - - - - - - - -