db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: Derby Db tables returned in uppercase???
Date Mon, 23 Apr 2007 20:24:53 GMT
Hi Dustin,

Table and column names are called SQL identifiers and, according to the 
SQL standard, they are case-insensitive. Like many databases, Derby 
stores table and column names in uppercase.

You can get the behavior you want by double-quoting your table and 
column names. If you double quote these identifiers, then Derby, like 
other databases, will honor your casing. Here is some script output 
which demonstrates this behavior.

Hope this helps,

ij> drop table t;
0 rows inserted/updated/deleted
ij> drop table "t";
0 rows inserted/updated/deleted
ij> create table t( a int );
0 rows inserted/updated/deleted
ij> create table "t" ( "a" int );
0 rows inserted/updated/deleted
ij> insert into t( a ) values ( 1 );
1 row inserted/updated/deleted
ij> insert into "t" ( "a" ) values ( 2 );
1 row inserted/updated/deleted
ij> select * from t;

1 row selected
ij> select * from "t";

1 row selected

Dustin S Houck wrote:
> Hello,
> I have been playing around with derby to determine if we want to use it in
> a project at my work.  I have the db set up and populating the db with
> table and am able to connect to the db using jdbc.  But after playing
> around with it and completing some queries it appears the derby returns
> query results with table names and column names in all caps (even though I
> created then in lower case using the ij tool).
> Is this correct? Has derby been implemented to always return table names
> and column names in uppercase?  (this seems odd to me, since the derby db
> is “case sensitive”)
> Are there any settings/workarounds to fix this??
> Dustin S. Houck
> Software Engineer II
> Raytheon Technical Services Company, LLC

View raw message