Rishi Raj has Published 119 Articles

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

Rishi Raj

Rishi Raj

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

738 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

1K+ 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

17K+ 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

9K+ 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

6K+ 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

How to delete all records from a table in Oracle using JDBC API?

Rishi Raj

Rishi Raj

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

2K+ Views

The SQL TRUNCATE statement is used to delete all the records from a table.SyntaxTRUNCATE TABLE table_name;To delete all the records from a table from using JDBC API you need to −Register the Driver: Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as ... Read More

Can we return Result sets in JDBC?

Rishi Raj

Rishi Raj

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

1K+ Views

Yes, just like any other objects in Java we can pass a ResultSet object as a parameter to a method and, return it from a method.Let us create a table with name MyPlayers in MySQL database using CREATE statement as shown below −CREATE TABLE MyPlayers(    ID INT,    First_Name VARCHAR(255),   ... Read More

What is RSVP (Resource Reservation Protocol)?

Rishi Raj

Rishi Raj

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

7K+ Views

RSVP is a transport layer protocol that is used to reserve resources in a computer network to get different quality of services (QoS) while accessing Internet applications. It operates over Internet protocol (IP) and initiates resource reservations from the receiver’s end.FeaturesRSVP is a receiver oriented signalling protocol. The receiver initiates ... Read More

C-style parser for command line options in Python

Rishi Raj

Rishi Raj

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

347 Views

Python’s sys module provides access to any command-line arguments via the sys.argv. sys.argv is the list of command-line arguments and sys.argv[0] is the program ie. the script name.Save following code as args.pyimport sys print ('argument list', sys.argv)Execute above script from command line as follows:C:\python37>python args.py 11 22 argument list ['args.py', ... Read More

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