Re: Foreign Keys and getImportedKeys(..)

Поиск
Список
Период
Сортировка
От Dave Cramer
Тема Re: Foreign Keys and getImportedKeys(..)
Дата
Msg-id 041401c1aa8c$eeb18800$c201a8c0@inspiron
обсуждение исходный текст
Ответ на Foreign Keys and getImportedKeys(..)  (Ashvin Lad <akl98@doc.ic.ac.uk>)
Список pgsql-jdbc
You can get this functionality out of the new driver. It can be found at
http://jdbc.postgresql.org

Dave

-----Original Message-----
From: pgsql-jdbc-owner@postgresql.org
[mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Ashvin Lad
Sent: Thursday, January 31, 2002 1:29 PM
To: pgsql-jdbc@postgresql.org
Subject: [JDBC] Foreign Keys and getImportedKeys(..)


  Hi All,

After getting a metadata object from a PostgreSQL connection, I can use
the getPrimaryKeys() method
to display a table's primary keys but I can't use the getImportedKeys()
method to get its foreign keys. Can anyone help?

This works:

    ResultSet pksRS = dbmd.getPrimaryKeys(null, null, tableName);
    while(pksRS.next())
    {
        ... pksRS.getString("COLUMN_NAME");
    }

But this does not:

    ResultSet fksRS = dbmd.getImportedKeys(null, null, tableName);
    while(fksRS.next())
    {
        ... fksRS.getString("FKCOLUMN_NAME");
    }

I get a NullPointerException because fksRS is null, but I don't know
why. This is not the case when I use MS SQL Server...it does work. Is
this because the JDBC driver provided with PostgreSQL doesn't support
this function?

Thanks,

Ash.


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html



В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Ashvin Lad
Дата:
Сообщение: Foreign Keys and getImportedKeys(..)
Следующее
От: "Amanda K. Martino"
Дата:
Сообщение: No suitable driver found exception