Monday, January 13, 2014

Java JDBC programming Example 12

//Note: create  a DSN in the name of sql that is pointing the table name limbs in the database with three String column  names things,legs,arms



import java.sql.*;
public class Jdbc12{
     public static void main(String s[]) throws Exception
     {
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection c =  DriverManager.getConnection("jdbc:odbc:sql");
        DatabaseMetaData dbm =c.getMetaData();
        
System.out.println("product name :"+dbm.getDatabaseProductName());
        
System.out.println("Product Version :"+dbm.getDatabaseProductVersion());
      
System.out.println("driver name :"+dbm.getDriverName());
       
System.out.println("driver version :"+dbm.getDriverVersion());

        System.out.println("URL :"+dbm.getURL());
System.out.println("User :"+dbm.getUserName());

System.out.println("driver Major version :"+dbm.getDriverMajorVersion());

System.out.println("driver Minor  version :"+dbm.getDriverMinorVersion());
System.out.println("\nDatabase String fns are  :"+dbm.getStringFunctions());
System.out.println("\nDatabase Numeric  fns are:"+dbm.getNumericFunctions());

System.out.println("\nDatabase System fns are:"+dbm.getSystemFunctions());
        
System.out.println("\nDatabase Date Time  fns are:"+dbm.getTimeDateFunctions());
c.close();
         

         }

     
}

No comments: