Subject | Re: How to get list of foreign keys |
---|---|
Author | armenakgrigoryan |
Post date | 2002-09-03T07:48:57Z |
Thanks for the quick response.
Of course it was my first approach, but I got very friendly
message "Not yet implemented". I'm using Firebird JDBC Beta version
(downloaded from web site). May be there was some new release of
Firebird JDBC ?
Of course it was my first approach, but I got very friendly
message "Not yet implemented". I'm using Firebird JDBC Beta version
(downloaded from web site). May be there was some new release of
Firebird JDBC ?
--- In Firebird-Java@y..., Stefan Mühlemann <smue@o...> wrote:
> Hello,
>
> why don't you try
>
> try {
> ResultSet rs = getMetaData(con).getImportedKeys(null, null,
tableName);
> while (rs.next()) {
> System.out.println("\tImported key: " + rs.getString
("PKTABLE_NAME") +
> " / " + rs.getString("PKCOLUMN_NAME") + " --> " +
> rs.getString("FKTABLE_NAME") + " / " +
> rs.getString("FKCOLUMN_NAME"));
> }
> }
> catch (Exception e) {
> System.out.println(e.getMessage());
> }
>
> where tableName is the name of the table you want to inspect.
> This gives you a list of all imported keys of this table.
>
> Greetings
>
> Stefan
>
> armenakgrigoryan wrote:
> >
> > Sorry for the confusion. I'm trying to get the list of column
names
> > that are foreign keys.
> >
> > --- In Firebird-Java@y..., "armenakgrigoryan" <agrigoryan@c...>
wrote:
> > > Hello guys,
> > >
> > > Our company going to use Firebird. Everything seems OK except
> > System
> > > Tables. I came form Oracle world and there was not any problem
to
> > get
> > > any information about database metadata. In Firebird I'm kind of
> > > confusing. Could you please advise me how can I get the list of
> > > foreign keys. I tried to use SQL request like :
> > >
> > > select rc.rdb$constraint_name,
> > > rc.rdb$relation_name,
> > > rc.rdb$constraint_type,
> > > rf.rdb$relation_name
> > > from rdb$relation_constraints rc,
> > > rdb$relation_fields rf
> > > where rc.rdb$constraint_type = "FOREIGN KEY" and
> > > rc.rdb$relation_name = rf.rdb$relation_name
> > >
> > > But the problem is that there is no foreign key describing
> > > relationship between these two tables.
> > >
> > > I would really appreciate your response.
> > >
> > > Thanks,
> > > Armenak Grigoryan
> >
> >
> > To unsubscribe from this group, send an email to:
> > Firebird-Java-unsubscribe@y...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/