db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: problem with embedded driver
Date Wed, 20 Apr 2011 07:09:59 GMT
steve lescure <stevelescure@yahoo.com> writes:

> thanks that was a great big help! never would have figured all that
> out.
> i can now connect to the database............now i've encounter yet
> another mystery.
> It keeps telling me it can't find my table JOBS....i've read that
> NETBEANS should create a default schema NBUSER (the id I used to when
> i created the db). When i check the properties of the database, the
> schema is indeed NBUSER. however, to create a table i have to use the
> APP schema (NBUSER is not in the list). I did that, but NETBEANS can't
> find the table even if i use APP.JOBS... I've tried JOBS APP.JOBS
> NBUSER.JOBS all fail.
> any thoughts?
>         try {
>             Properties props = new Properties(); // connection properties
>             props.put("user", "nbuser");
>             props.put("password", "nbuser");
>             String dbName = "DEMAND"; // the name of the database
>             conn = DriverManager.getConnection(protocol + dbName
>                     + ";create=false", props);
>             System.out.println("Connected to database " + dbName);
>             conn.setAutoCommit(true);
>             s = conn.createStatement();
>             statements.add(s);
>             rs = s.executeQuery(
>                     "SELECT JOBNAME, USERID FROM APP.JOBS");
>             (dies here) 

Did you set derby.system.home to ~/.netbeans-derby for your application.
If you didn't, the code above will connect to a database in the current
working directory (if there is one with that name) instead of the
database in ~/.netbeans-derby.

Alternatively, you can specify the full path to the database in the
connection URL:


If you've already done this and it doesn't work, you could make your
application print all your tables and which schema they're in by
changing your query to:

    rs = s.executeQuery(
        "select schemaname || '.' || tablename from " +
        "sys.systables t, sys.sysschemas s " +
        "where t.schemaid=s.schemaid and schemaname not like 'SYS%'");
    while (rs.next()) {

Knut Anders

View raw message