- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6702 Articles for Database
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
247 Views
We have two types of ResultSet objects namely, forward Only and, bi-directional as the names suggest you can move in only one direction (forward) in forward only ResultSet and, in bidirectional ResultSet you can move the pointer in both directions. The ResultSet interface provides several methods to navigate through both types of ResultSet objects.Following table lists various methods to navigate through ResultSet object.MethodDescriptionnext()This method moves the resultset pointer one row forward.Previous() This method moves the resultset pointer one row backward.first()This method moves the resultset pointer to the first row.last()This method moves the resultset pointer to the last row.relative()This method accepts an ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
1K+ Views
The escape syntax gives you the flexibility to use database specific features unavailable to you by using standard JDBC methods and properties.The general SQL escape syntax format is as follow:{keyword 'parameters'}Following are various escape syntaxes in JDBC:d, t, ts Keywords: They help identify date, time, and timestamp literals. As you know, no two DBMSs represent time and date the same way. This escape syntax tells the driver to render the date or time in the target database's format{d 'yyyy-mm-dd'}Where yyyy = year, mm = month; dd = date. Using this syntax {d '2009-09-03'} is March 9, 2009.Example//Create a Statement object ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
89 Views
To update the contents of the ResultSet you need to create a statement by passing the ResultSet type updatable, as://Creating a Statement object Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);Just like getXXX() and setXXX() methods ResultSet interface also provides methods to update the contents of a row in a result set updateXXX().These methods accept integer values representing the index or, a String value representing the column label, of the row to be updated.Note that if you need to update the contents of a ResultSet the table should have a primary key.ExampleAssume we have a table named Employees with 5 records as shown ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
227 Views
A RowSet is a wrapper around a ResultSet Object. It can be connected, disconnected from the database and can be serialized. It maintains a JavaBean component by setting the properties. You can pass a RowSet object over the network. By default, RowSet object is scrollable and updatable and it is used to make a ResultSet object scrollable and updatable.You Can get a RowSet using theRowSetProvider.newFactory().createJdbcRowSet() method.ExampleAssume we have a table named dataset in the database as:+--------------+-----------+ | mobile_brand | unit_sale | +--------------+-----------+ | Iphone | 3000 | | Samsung | 4000 ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
3K+ Views
Following are the advantages of stored procedures:Since stored procedures are compiled and stored, whenever you call a procedure the response is quick.you can group all the required SQL statements in a procedure and execute them at once.Since procedures are stored on the database server which is faster than client. You can execute all the complicated quires using it, which will be faster.Using procedures, you can avoid repetition of code moreover with these you can use additional SQL functionalities like calling stored functions.Once you compile a stored procedure you can use it in any number of applications. If any changes are ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
3K+ Views
Following are the differences between RowSet and ResultSet:ResultSetRowSetA ResultSet always maintains connection with the database.A RowSet can be connected, disconnected from the database.It cannot be serialized.A RowSet object can be serialized.ResultSet object cannot be passed other over network.You can pass a RowSet object over the network.ResultSet object is not a JavaBean objectYou can create/get a result set using the executeQuery() method.ResultSet Object is a JavaBean object.You can get a RowSet using the RowSetProvider.newFactory().createJdb cRowSet() method.By default, ResultSet object is not scrollable or, updatable.By default, RowSet object is scrollable and updatable.Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
152 Views
The next() method of the ResultSet interface moves the pointer/Cursor of the current ResultSet object to the next row from the current position. This method returns a boolean value. If there are no rows next to its current position this method returns false, else it returns true.Therefore, using this method in the while loop you can iterate the contents of the ResultSet object.while(rs.next()){ }Getting the column values of each recordThe ResultSet interface (also) provides getter methods (getXXX()) to retrieve values in each column of a row, each getter methods has two variants:getXXX(int columnIndex): Accepts an integer value representing the index ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
210 Views
An SQLException can occur both in the driver and the database. When such an exception occurs, an object of type SQLException will be passed to the catch clause.The passed SQLException object has the following methods available for retrieving additional information about the exception:MethodDescriptiongetErrorCode( )Gets the error number associated with the exception.getMessage( )Gets the JDBC driver's error message for an error, handled by the driver or gets the Oracle error number and message for a database error.getSQLState( )Gets the XOPEN SQLstate string. For a JDBC driver error, no useful information is returned from this method. For a database error, the five-digit ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
4K+ Views
There are two types of result sets namely, forward only and, bidirectional.Forward only ResultSet: The ResultSet object whose cursor moves only in one direction is known as forward only ResultSet. By default, JDBC result sets are forward-only result sets.You can move the cursor of the forward only ResultSets using the next() method of the ResultSet interface. It moves the pointer to the next row from the current position. This method returns a boolean value. If there are no rows next to its current position it returns false, else it returns true.Therefore, using this method in the while loop you can ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
2K+ Views
If you commit a database, it saves all the changes that have been done till that particular point.You can commit a database using the commit() method. Whenever any issue occurs you can revert the database to this point using the rollback() method. By default, some databases commit the databases automatically. But, while managing transactions you need to commit the database manually.In this scenario you can use the setAutoCommit() method. This method belongs to the Connection interface and, it accepts a boolean value.If you pass true to this method it turns on the auto-commit feature of the database and, if you ... Read More