Rishi Raj has Published 127 Articles

Java Connection getTransactionIsolation() method with example

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

453 Views

In a database system where more than one transaction is being executed simultaneously and in parallel, the property of isolation states that all the transactions will be carried out and executed as if it is the only transaction in the system. No transaction will affect the existence of any other ... Read More

Java DatabaseMetaData getTableTypes() method with example

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

213 Views

The getTableTypes() method of the DatabaseMetadata interface is used to find out the type of tables supported by the underlying database.This method returns a ResultSet object holding the names of table types in each row in String format, under the column TABLE_TYPE.To get the description DatabaseMetadata object.Make sure your database ... Read More

Java ResultSet isAfterLast() method with example

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

573 Views

When we execute certain SQL queries (SELECT query in general) they return tabular data.The java.sql.ResultSet interface represents such tabular data returned by the SQL statements.i.e. the ResultSet object holds the tabular data returned by the methods that execute the statements which quires the database (executeQuery() method of the Statement interface in general).The ... Read More

How to move the ResultSet cursor to the previous row in JDBC?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

680 Views

Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general).The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).You can move the cursor ... Read More

How can you move the cursor in scrollable result sets in JDBC?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

495 Views

In JDBC there are two scrollable ResultSets namely, scrollable sensitive and, scrollable insensitive.In the TYPE_SCROLL_INSENSITIVE ResultSet the cursor moves in forward or backward directions. This type of ResultSet is insensitive to the changes that are made in the database i.e. the modifications done in the database are not reflected in the ... Read More

How to close the ResultSet cursor automatically, after commit in JDBC?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

903 Views

ResultSet holdability determines whether the ResultSet objects (cursors) should be closed or held open when a transaction (that contains the said cursor/ ResultSet object) is committed using the commit() method of the Connection interface.ResultSet interface provides two values to specify the holdability namely CLOSE_CURSORS_AT_COMMIT and HOLD_CURSORS_OVER_COMMITIf the holdability of the ... Read More

How to get all the column names from a ResultSet using JDBC

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

14K+ Views

You can get the name of a particular column using the getColumnName() method of the ResultSetMetadata interface.This method accepts an integer value representing the index of a column and returns a String value representing the name of the specified column.Let us create a table with name MyPlayers in MySQL database using CREATE statement ... Read More

Java ResultSetMetaData getColumnName() method with example

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

1K+ Views

The getColumnName() method of the ResultSetMetaData (interface) retrieves and returns the name of the specified column in the current ResultSet object.This method accepts an integer value representing the index of a column and, returns a String value representing the name of the specified column.To get the ResultSetMetaData object, you need ... Read More

How to get the row count from ResultSet in JDBC

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

8K+ Views

Whenever we execute SQL statements using the executeQuery() method, it returns a ResultSet object which holds the tabular data returned by the SELECT queries(in general). The ResultSet object contains a cursor/pointer which points to the current row. Initially this cursor is positioned before first row (default position).The ResultSet interface provides ... Read More

How to sql insert items from a list or collection in to table using JDBC?

Rishi Raj

Rishi Raj

Updated on 30-Jul-2019 22:30:26

5K+ Views

To insert the contents of a database to a collection, Connect to the database and retrieve the contents of the table into a ResultSet object using the SELECT Query.DriverManager.registerDriver(new com.mysql.jdbc.Driver()); String mysqlUrl = "jdbc:mysql://localhost/mydatabase"; Connection con = DriverManager.getConnection(mysqlUrl, "root", "password"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery("select * from ... Read More

Previous 1 ... 6 7 8 9 10 ... 13 Next
Advertisements