M
Matthias Brück
Guest
I've got a problem Establishing a connection to an OpenEdge database including the property option resultSetMetaDataOptions. For programming purposes I need to set this option to 1 to be able to get the table names of the fetched columns due to using a JOIN in my SQL queries.
I'm adding the property into my java.util.Property Object:
props.put("RESULTSETMETADATAOPTIONS", 1);
I'm establishing a connection with:
DriverManager.getConnection(url, props);
When I check the returned java.sql.Connection the property was added to props object. With my established connection I execute the SQL query and get my java.sql.ResultSet what I finally use to get my java.sql.ResultSetMetaData:
ResultSetMetaData meta = resultSet.getMetaData();
but
for (int i = 1; i <= meta.getColumnCount(); i++) {
String tablename = meta.getTableName(i);
System.out.println(tablename);
}
always prints out an empty tablename.
What I also tried is establishing a connection to the database using SquirrelSQL and set the property resultSetMetaDataOptions to 1 while connecting. I clicked on the schema and used the connection String given at getUrl for establishing my own Connection via JDBC but did not set the resultSetMetaDataOptions to 1 in my Property Object since it was already added to the connection URL by SquirrelSQL. The result was the same: Just an empty tablename.
Am I doing something wrong? Is there another way to try getting the tablename of a column?
Continue reading...
I'm adding the property into my java.util.Property Object:
props.put("RESULTSETMETADATAOPTIONS", 1);
I'm establishing a connection with:
DriverManager.getConnection(url, props);
When I check the returned java.sql.Connection the property was added to props object. With my established connection I execute the SQL query and get my java.sql.ResultSet what I finally use to get my java.sql.ResultSetMetaData:
ResultSetMetaData meta = resultSet.getMetaData();
but
for (int i = 1; i <= meta.getColumnCount(); i++) {
String tablename = meta.getTableName(i);
System.out.println(tablename);
}
always prints out an empty tablename.
What I also tried is establishing a connection to the database using SquirrelSQL and set the property resultSetMetaDataOptions to 1 while connecting. I clicked on the schema and used the connection String given at getUrl for establishing my own Connection via JDBC but did not set the resultSetMetaDataOptions to 1 in my Property Object since it was already added to the connection URL by SquirrelSQL. The result was the same: Just an empty tablename.
Am I doing something wrong? Is there another way to try getting the tablename of a column?
Continue reading...