import java.sql.*;
import java.io.*;
public class JavaDemo127{
public static void main(String ar[])throws Exception{
ResultSet rs=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test","system","123456");
DatabaseMetaData md=con.getMetaData();
String s[]={"TABLE"};
rs=md.getTables(null,"TEST",null,s);
while(rs.next()){
System.out.println(rs.getString(1));
}
System.out.println(" Schemas ");
rs=md.getSchemas();
while(rs.next()){
System.out.println(rs.getString(1));
}
System.out.println(" Catalog ");
rs=md.getCatalogs();
while(rs.next()){
System.out.println(rs.getString(1));
}
System.out.println(" Tables type ");
rs=md.getTableTypes();
while(rs.next()){
System.out.println(rs.getString(1));
}
}
}
import java.io.*;
public class JavaDemo127{
public static void main(String ar[])throws Exception{
ResultSet rs=null;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:test","system","123456");
DatabaseMetaData md=con.getMetaData();
String s[]={"TABLE"};
rs=md.getTables(null,"TEST",null,s);
while(rs.next()){
System.out.println(rs.getString(1));
}
System.out.println(" Schemas ");
rs=md.getSchemas();
while(rs.next()){
System.out.println(rs.getString(1));
}
System.out.println(" Catalog ");
rs=md.getCatalogs();
while(rs.next()){
System.out.println(rs.getString(1));
}
System.out.println(" Tables type ");
rs=md.getTableTypes();
while(rs.next()){
System.out.println(rs.getString(1));
}
}
}
Comments