Subject | Re: DatabaseMetaData.getTables() : Unrecognized transaction ??? |
---|---|
Author | Roman Rokytskyy |
Post date | 2004-05-20T09:14:11Z |
Hi,
queries is somewhat suspicious, but it works in all cases for me.
Here's a simple Java application that works without any problems on my
laptop (it is based on your code). Can you please modify it so that
problem is reproduced?
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
public class TestMetaData {
public static void main(String[] args) throws Exception {
Class.forName("org.firebirdsql.jdbc.FBDriver");
Connection con = DriverManager.getConnection(
"jdbc:firebirdsql:localhost/3050:c:/database/employee.gdb",
"sysdba",
"masterkey");
try {
con.setAutoCommit(false);
checkMetaData(con);
con.setAutoCommit(true);
checkMetaData(con);
} finally {
con.close();
}
}
private static void checkMetaData(Connection con) throws Exception {
DatabaseMetaData dmd = con.getMetaData();
String catalog = null;
ResultSet rs = dmd.getSchemas();
while (rs.next()) {
String sn = rs.getString(1);
System.out.println(".getAllTables() schema="+sn);
}
rs.close();
rs = dmd.getCatalogs();
while (rs.next()) {
String sn = rs.getString(1);
System.out.println(".getAllTables() catalogs="+sn);
}
rs.close();
rs = dmd.getTables(null, null, "%", new String[]{"TABLE"});
System.out.println(".getAllTables() rs="+rs);
while (rs.next()) {
String tn = rs.getString("TABLE_NAME");
String tt = rs.getString("TABLE_TYPE");
String remarks = rs.getString("REMARKS");
System.out.println(".getAllTables() found table"+tn+
", type="+tt+", remarks="+remarks);
}
}
}
Thanks!
Roman
> I hope it helps.I'm still not able to reproduce a bug. The code that does meta-data
> My guess is that it is trying to autocommit the transaction on
> doQuery(), but I have tried with and without setting the auto-comit
> to true and false with no effect.
queries is somewhat suspicious, but it works in all cases for me.
Here's a simple Java application that works without any problems on my
laptop (it is based on your code). Can you please modify it so that
problem is reproduced?
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
import java.sql.ResultSet;
public class TestMetaData {
public static void main(String[] args) throws Exception {
Class.forName("org.firebirdsql.jdbc.FBDriver");
Connection con = DriverManager.getConnection(
"jdbc:firebirdsql:localhost/3050:c:/database/employee.gdb",
"sysdba",
"masterkey");
try {
con.setAutoCommit(false);
checkMetaData(con);
con.setAutoCommit(true);
checkMetaData(con);
} finally {
con.close();
}
}
private static void checkMetaData(Connection con) throws Exception {
DatabaseMetaData dmd = con.getMetaData();
String catalog = null;
ResultSet rs = dmd.getSchemas();
while (rs.next()) {
String sn = rs.getString(1);
System.out.println(".getAllTables() schema="+sn);
}
rs.close();
rs = dmd.getCatalogs();
while (rs.next()) {
String sn = rs.getString(1);
System.out.println(".getAllTables() catalogs="+sn);
}
rs.close();
rs = dmd.getTables(null, null, "%", new String[]{"TABLE"});
System.out.println(".getAllTables() rs="+rs);
while (rs.next()) {
String tn = rs.getString("TABLE_NAME");
String tt = rs.getString("TABLE_TYPE");
String remarks = rs.getString("REMARKS");
System.out.println(".getAllTables() found table"+tn+
", type="+tt+", remarks="+remarks);
}
}
}
Thanks!
Roman