Subject Re: Table references in SQL queries
Author cedric_maucourt
--- In, "Adam" <s3057043@y...> wrote:
> --- In, "cedric_maucourt"
> <cedric.maucourt1@m...> wrote:
> >
> > Hello,
> >
> > First I apologize for my poor english... :)
> >
> > I would like to use the embedded version of Firebird server in
order to
> > do an application migration from WSAD/DB2 to Tomcat/free database
> > server. Firebird seems to work fairly well but I encountered a
> > problem : all the SQL queries in the application to migrate refer
> > tables with the syntax "database_name.table_name".
> > Here's an example : INSERT INTO AFDZAC.FDZQTA01
> > The problem is that for different reasons we cannot change the
> > and Firebird seems to reject this syntax and accepts just the
name of
> > the table. This syntax works on DB2 (and MySQL too) and I wonder
> > there is a way to force Firebird to accept it too.
> No
> If you quoted the table names, you could probably create a table
> called "AFDZAC.FDZQTA01", but then you would need to use the
> quotations to refer to it.

I thought to this solution too but just like you said I would need to
use the quotations to refer to it, so I would need to change the
queries. Moreover the queries have to stay compatible with DB2 and
DB2 doesn't accept these quotes in the queries.

> >With aliases?
> Well if you could use table name aliases (which is what I am
> you mean), then it would be just as easy to change the queries.

Sorry I didn't mean table name aliases. Actually there is a concept
of database aliases in DB2 and that's why we prefix table names with
an alias name. But with MySQL you can prefix table names with the
database name they belong too and that's not possible with Firebird.
I was just looking for an other solution.

For example, I'm currently trying to use HSQLDB and with HSQLDB I can
create schemas. When you create a table inside a schema, you can
refer to this table with "shema_name.table_name". So that's a
solution. However Firebird doesn't seem to support schemas. I'm just
looking for this kind of trick with Firebird...