Double Bonanza Offer - Upto 30% Off + 1 Self Paced Course Free | OFFER ENDING IN: 0 D 0 H 0 M 0 S

Log In to start Learning

Login via

Post By Admin Last Updated At 2020-06-15
ResultSetMetaData
ResultSetMetaData :The metadata implies information about information i.e. we can get additional data from the information.In the event that you need to get metadata of a table like aggregate number of segment, section name, segment sort and so forth, ResultSetMetaData interface is helpful in light of the fact that it gives strategies to get metadata from the ResultSet question.METHODS OF RESULTSETMETADATA :Methods of ResultSetMetaData

object of ResultSetMetaData:

The getMetaData() method of ResultSet interface returns proceeds the entity of ResultSetMetaData

Syntax:

  public ResultSetMetaData getMetaData()throws SQLException

 DatabaseMetaData:

DatabaseMetaData interface gives techniques to get meta information of a database, for example, database item name, database item form, driver name, name of aggregate number of tables, name of aggregate number of perspectives and so forth.

 Methods of DatabaseMetaData:
  • public String getDriverName()throws SQLException
  • public String getDriverVersion()throws SQLException
  • public String getUserName()throws SQLException
  • public String getDatabaseProductName()throws SQLException
  • public String getDatabaseProductVersion()throws SQLException
  • public ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)throws SQLException
Object of DatabaseMetaData:
The getMetaData() method of link line returns the object of DatabaseMetaData.Syntax:public DatabaseMetaData getMetaData()throws SQLExceptionExample:

import java.sql.*;

class Dbmd2{

try{

Class.forName("oracle.jdbc.driver.OracleDriver");

public static void main(String args[]){

Connection con=DriverManager.getConnection(

"jdbc:oracle:thin:@localhost:1521:xe","system","oracle");

DatabaseMetaData dbmd=con.getMetaData();

String table[]={"TABLE"};

ResultSet rs=dbmd.getTables(null,null,null,table);

while(rs.next()){

System.out.println(rs.getString(3));

}  con.close();

}catch(Exception e){ System.out.println(e);}

}

}

Transaction Management:

Exchange speaks to a solitary unit of work. The ACID properties depicts the exchange administration well. Corrosive stands for Atomicity, Consistency, confinement and toughness.

Atomic implies either all effective or none. Consistency guarantees bringing the database starting with one reliable state then onto the next predictable state. Confinement guarantees that exchange is disconnected from other exchange. Toughness implies once an exchange has been conferred, it will remain along these lines, even in case of blunders, control misfortune and so on.

 Methods:

void setAutoCommit(boolean status)

void rollback()

void commit()