db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wildman <wle...@nycap.rr.com>
Subject SQLException Table does not exist although just created
Date Mon, 14 Dec 2009 21:30:15 GMT

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
- - - - - - - - - - - - - - - - - -

-- 
View this message in context: http://old.nabble.com/SQLException-Table-does-not-exist-although-just-created-tp26780099p26780099.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.


Mime
View raw message