Answer the question
In order to leave comments, you need to log in
Error calling getImportedKeys method?
Guys, hello everyone!
You need to get a foreign key.
Class.forName("org.postgresql.Driver");
Connection connection = DriverManager.getConnection(configDataBase.getUrl(), configDataBase.getName(), configDataBase.getPassword());
Statement statement = connection.createStatement();
ResultSet rsSql = statement.executeQuery("select * from table_name limit 5");
while (rsSql.next()) {
System.out.println("Номер в базе " + rsSql.getInt("id"));
}
DatabaseMetaData dm = connection.getMetaData();
ResultSet rsMeta = dm.getImportedKeys( "" , "" , "table_name" );
org.postgresql.util.PSQLException: ERROR: column t1.tgconstrname does not exist
Answer the question
In order to leave comments, you need to log in
Check the versions of the software you are using. Your library providing the getImportedKeys call obviously doesn't know the version of PostgreSQL you're using.
The last release of postgresql where there was a tgconstrname field of the system catalog is far 8.4
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question