db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Myrna van Lunteren <m.v.lunte...@gmail.com>
Subject Re: how to use schema names , it allways return error for me.
Date Sun, 06 Nov 2005 03:24:07 GMT
On 11/5/05, Legolas Woodland <legolas.w@gmail.com> wrote:
> hi
> Thank you for reading my post.
> i tried to execute following statement but it return the exception that
> the table does not exists ,
> i tried several cobination of " and ' around the schema and table name
> with no luck.
>   "INSERT INTO APP.table2 ( data, data2 ) VALUES ( ?, ? )"
>   This statement return
>   Table 'APP.TABLE2' does not exist.
>  can some one help me ?
>  is there any way to pass schema name in connection url ? or set the
> schema to a default one?
Your table2 is probably not in the APP schema like you expect.
If you log on using a username, that username is assumed to be the desired
schema for things to get created in.
If you do not want that to be your schema, you need to explicitly switch to
another schema (and possibly create it first), or explicitly qualify each
create with the intended schemaname.
Else, if you create a table (not necessarily other database objects, but I
think that was a bug), a new schema will automatically be created.
APP is the default schema, it always exists.
set schema schemaname is the ij SQL to set/switch to a named schema.
create schema schemaname would explicitly create a non-existing schema
 You can select things from sys.systables joined with sysschemas to see in
which schema your table2 ended up. something like this:
select t.tablename, s.schemaname from sys.systables t, sys.sysschemas s
where t.schemaid=s.schemaid;

View raw message