Subject Re: [Firebird-Java] metadata column names
Author Rick Fincher
Hi Marco,

This is an Interbase/Firebird feature. If the columns, tables, and views
are originally defined with double quotes they will be case sensitive and
you will have to refer to them with double quotes always. If they were
defined without double quotes, they will be case insensitive (all
uppercase).

Other databases that don't support case sensitivity won't have the problem.

If I remember correctly the Interbase/Firebird designers did this to support
legacy code when lower case names were added to SQL way back.

This is a Firebird situation, not JDBC related. Even so, it crops up now
and then and it might be worth adding it to the FAQ.

Some info from previous posts on the subject below.

Rick

From previous posts:

From Helen:

You *can* define tables, views and columns with double-quoted identifiers,
if you want them to be case-sensitive. You don't have to and, if you don't
define them with d/quotes, they will NOT be case-sensitive.

If you define them case-sensitive you have to use the d/quotes in every
query.

From Roman:

There's no such property. If rewriting the database becomes a must,
you can create views that will convert you names to uppercase. If you
have table:

CREATE TABLE "atable" ("id" INTEGER);

you can create a view for it:

CREATE VIEW atable(id) AS SELECT "id" FROM "atable"

This view will be updatable (see InterBase documentation for more
info) and you will be able to SELECT id FROM atable, as well as INSERT
INTO atable (id) VALUES (1), etc.




----- Original Message -----
From: "Marco Parmeggiani" <marcopar@...>
To: <Firebird-Java@yahoogroups.com>
Sent: Tuesday, March 09, 2004 8:09 AM
Subject: [Firebird-Java] metadata column names


> I'm extracting some metadata from the database.
> I extract the list of tables and then for each table the list of columns
> with a call like this:
>
> ResultSet rs = dbmd.getColumns(null, null, nameOfTheTable, "%");
>
> I've found that the above stuff works well if table names are uppercase,
> if not, that code returns an empty result set. So i wrote this line of
> code and all now works (i've put a couple of double quotes around table
> names):
>
> ResultSet rs = dbmd.getColumns(null, null, "\"" + nameOfTheTables +
> "\"", "%");
>
> i've then used Squirrel SQL with the same database and i've found that
> it works and, looking at the code, it doesn't seem that it adds double
> quotes around table names...
>
> so i'm puzzled about what i'm doing wrong.
>
> ciao
> --
> Seti@Home Java Applets
> http://maruko.webhop.net/
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>