I am trying out to find out how many Schemas are there in a Database.
[code=java]
ResultSet schema_rs = db_metadata.get Schemas();
while(schema_rs .next()){
String schema_name = schema_rs.getSt ring("TABLE_SCH EM");
System.out.prin tln("Schema Name: " + schema_name);
}
System.out.prin tln("Yahoo: " + schema_rs.getSt atement());
schema_rs.getSt atement().close ();
[/code]
Actually i read out API there it is told that if the ResultSet generated some other way as for example, through DatabaseMeta then it returns null.
Here it matches the condition.
Here no Schemas found ...and here I am using MySQL.
If i tried with some other database so far I tried with PostgreSQL and Sybase.
There I found some Schemas and there the ResultSet.getSt atement does not return null as it generated through DatabaseMetadat a.
Is it database dependent?Or if no schemas found then it happens.
Or it is a specific problem with MySQL?
Debasis Jana.
[code=java]
ResultSet schema_rs = db_metadata.get Schemas();
while(schema_rs .next()){
String schema_name = schema_rs.getSt ring("TABLE_SCH EM");
System.out.prin tln("Schema Name: " + schema_name);
}
System.out.prin tln("Yahoo: " + schema_rs.getSt atement());
schema_rs.getSt atement().close ();
[/code]
Actually i read out API there it is told that if the ResultSet generated some other way as for example, through DatabaseMeta then it returns null.
Here it matches the condition.
Here no Schemas found ...and here I am using MySQL.
If i tried with some other database so far I tried with PostgreSQL and Sybase.
There I found some Schemas and there the ResultSet.getSt atement does not return null as it generated through DatabaseMetadat a.
Is it database dependent?Or if no schemas found then it happens.
Or it is a specific problem with MySQL?
Debasis Jana.
Comment