Skip to main content

Posts

Q) How to implement batch updates in a JDBC applications?

A) ->java.sql.statement and java.sql.prepared statement interfaces have methods to support batch processing. 1) addbatch (Strinf dml) :             This method used to add an SQL statement to the batch. 2) int [ ] executebatch() :             this method is used to submit the group of (batch of) SQL statements at a time to the DBMS.
Recent posts

Q) What is Batch updates?

A) ->Batch updates is a formality given by JDBC using which, DML SQL statement can be grouped physically into one unit and at a time submitted to the DBMS for processing as a batch. ->Batch updates mechanism improves performance some times by reducing the number of client/server interaction. ->we have 2 kinds of business Systems. 1) OLTPS (Online Transaction Processing Systems) 2) Batch processing System. To support batch processing systems, batch updates is given in JDBC. ->In case of OLTP, end user waits the system responds after giving input into the system. ->in case of batch processing system, end user doesn’t wait for the systems responds. ATM application is an example for OLTP. ->At the end of every month, all accounts must be created by their earned interest is an example use case of batch processing.

Q) Develop a JDBC application / project that prompts the end-user to enter the table name and that displays all the column names of the table.

A) ->ResultSet interface doesn’t have any methods directly to know about column details. For that purpose we need to use “java.sql.ResultSetMetaData” interface. ->it has methods to deal with column details. 1) getColumnCount() 2) getColumnName(int no ) ->Here no means column number. ->ResultSetMetaData object is created as fallows resultSetMetaData rsmd=rs.getMetaData(); Example: // columndetailsexample.java import java.sql.*; import java.util.Scanner; class columndetailsexample {        public static void main(String[] args) throws ClassNotFoundException   ,SQLException{               Scanner s= new Scanner(System. in );               System. out .println( "Enter table name" );               String table=s.next();               Class. forName ( "sun.jdbc.odbc.JdbcOdbcDriver" );               Connection con=DriverManager. getConnection ( "jdbc:odbc:prince" , "scott" , "tiger" );               Statement st=con.crea

Q) What are some important shortcuts to interact with MyEclipse

A) Ctrl+s for saving Ctrl+m For minimizing / maximizing Syso+ctrl+spacebar For System.out.println() Ctrl+w For closing a file Ctrl+shift+w For closing all files Ctrl+/ For connecting or un connecting Ctrl+d For deletion of a line which the cursor is pointing Ctrl+shift+o For organizing imports. The means un import things are import and un necessary imports are removed Ctrl+shift+f For formatting the code Ctrl+z For undo Ctrl+y For redo