db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bernt M. Johnsen" <Bernt.John...@Sun.COM>
Subject Re: how to use schema names , it allways return error for me.
Date Sun, 06 Nov 2005 14:25:57 GMT
>>>>>>>>>>>> Legolas Woodland wrote (2005-11-06 14:15:56):
> Thank you for reply
> I found a part of problem.
> 1-SELECT field1, field2 FROM APP.table2
> the above statement will never works , i tried to execute it and it return
> no table found.
> but the followiing statement works OK .
> 2-select * from "APP"."table2"
>  as i test them in netbeans IDE SQL designer , now i do not know how i can
> have something like 2 as an String variable to pass it to sql Statement or
> preparedStatement.
>  can some one help me about it ?

SQL is case-insensitive, and everything is converted to upper case,
unless quoted. Thus

app.table2 is converted to APP.TABLE2, but "app"."table2" will remain
as is. In your case, the scheman name is APP (which may be written
app), but the table name is "table2". So, app."table2" will also work.

In Java, you can write e.g. 

prepareStatement("select * from app.\"table2\"");

Bernt Marius Johnsen, Database Technology Group, 
Sun Microsystems, Trondheim, Norway

View raw message