Found 4336 Articles for Java 8

What are connected and disconnected Row Sets in JDBC?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

357 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, the RowSet object is scrollable and updatable.A RowSet Object is of two typesConnected Row Sets: A connected RowSet object connects to the database using a JDBC driver. It establishes a connection with the database and, carries out the required operations. The connection is maintained until the RowSet object is closed.Disconnected Row Sets: A disconnected RowSet object connects to the ... Read More

What is CONCUR_READ_ONLY ResultSet in JDBC? Explain?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

2K+ Views

In general, you will pass this as a value to the createStatement() method as a value of ResultSet Concurrency type.Statement createStatement(int resultSetType, int resultSetConcurrency)This type of result set is not updatable. i.e. once you get a ResultSet object you cannot update its contents.ExampleSuppose, we have a table named Employee in the database with the following contents:+----+---------+--------+----------------+ | Id | Name    | Salary | Location       | +----+---------+--------+----------------+ | 1  | Amit    | 3000   | Hyderabad      | | 2  | Kalyan  | 4000   | Vishakhapatnam | | 3  | Renuka  | 6000   ... Read More

What is CONCUR_UPDATABLE ResultSet in JDBC? Explain?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

3K+ Views

It is a constant of the ResultSet class representing the concurrency mode for a ResultSet object that may be updated. In general, you will pass this as a value to the createStatement() method.Statement createStatement(int resultSetType, int resultSetConcurrency);A ResultSet with this as concurrency is updatable. i.e. once you get a ResultSet object you can update its contents.ExampleSuppose, we have a table named Employee in the database with the following contents:+----+---------+--------+----------------+ | Id | Name    | Salary | Location       | +----+---------+--------+----------------+ | 1  | Amit    | 3000   | Hyderabad      | | 2  | Kalyan  | ... Read More

What is ResultSet Concurrency in JDBC?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

1K+ Views

The concurrency of the ResultSet object determines whether its contents can be updated or not.The Connection interface provides 3 variants of the createStatement() method where one of the method's signature is as follows:Statement createStatement(int resultSetType, int resultSetConcurrency)This method accepts two integer type variables where one represents the type of the ResultSet and the other represents the Concurrency of the ResultSet.The ResultSet interface provides two values to specify the concurrency of the ResultSet.CONCUR_READ_ONLY: If you set this as a value of the concurrency while creating the ResultSet object you cannot update the contents of the ResultSet you can only read/retrieve them.CONCUR_UPDATABLE: ... Read More

What is the difference between the TYPE_SCROLL_INSENSITIVE and TYPE_SCROLL_SENSITIVE ResultSets in JDBC?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

1K+ Views

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 ResultSet.Which means if we have established a connection with a database using a JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable. Meanwhile, if we have added some more records to the table (after retrieving getting the ResultSet), these recent changes will not be reflected in the ResultSet object we previously obtained.In the TYPE_SCROLL_SENSITIVE ResultSet, ... Read More

What is TYPE_SCROLL_SENSITIVE ResultSet in JDBC?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

3K+ Views

This represents is a scrollable ResultSet i.e. the cursor moves in forward or backward directions. This type of ResultSet is sensitive to the changes that are made in the database i.e. the modifications done in the database are reflected in the ResultSet.Which means if we have established a connection with a database using a JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable. Meanwhile, if we have added some more records to the table (after retrieving the ResultSet), these recent changes will be reflected in the ResultSet object we previously obtained.Following is an example ... Read More

What is TYPE_SCROLL_INSENSITIVE ResultSet in JDBC?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

2K+ Views

This represents a scrollable ResultSet i.e. 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 ResultSet.Which means if we have established a connection with a database using JDBC program and retrieved a ResultSet holding all the records in a table named SampleTable and, meanwhile if we add some more records to the table (after retrieving getting the ResultSet), these recent changes will not be reflected in the ResultSet object we previously obtained.ExampleConsider we have ... Read More

What is Type_FORWARD_ONLY ResultSet in JDBC?

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

3K+ Views

A ResultSet interface in JDBC represents the tabular data generated by SQL queries. It has a cursor which points to the current row. Initially, this cursor is positioned before the first row.You can retrieve the column value at the current row using the getter methods getInt(), getString(), getDate() etc…To move the cursor and to navigate/iterate through the ResultSet the java.sql.ResultSet interface provides various methods such as next(), Previous(), first(), last(), relative(), absolute(), beforeFirst(), afterLast() etc...Type_FORWARD_ONLY Only ResultSetIn forward only ResultSet you can move the cursor only in forward direction. By default, a ResultSet is of type forward only.Read More

How to check index within a string of a specified substring in JSP?

Samual Sam
Updated on 30-Jul-2019 22:30:25

366 Views

The fn:indexOf() function returns the index within a string of a specified substring.SyntaxThe fn:indexOf() function has the following syntax −int indexOf(java.lang.String, java.lang.String)ExampleFollowing is the example to explain the functionality of the fn:indexOf() function − Using JSTL Functions Index (1) : ${fn:indexOf(string1, "first")} Index (2) : ${fn:indexOf(string2, "second")} You will receive the following result −Index (1) : 8 Index (2) : 13

How to escape characters that can be interpreted as XML markup in JSP?

karthikeya Boyini
Updated on 30-Jul-2019 22:30:25

834 Views

The fn:escapeXml() function escapes characters that can be interpreted as XML markup.SyntaxThe fn:escapeXml() function has the following syntax −java.lang.String escapeXml(java.lang.String)ExampleFollowing is the example to explain the functionality of the fn:escapeXml() function − Using JSTL Functions With escapeXml() Function: string (1) : ${fn:escapeXml(string1)} string (2) : ${fn:escapeXml(string2)} Without escapeXml() Function: string (1) : ${string1} string (2) : ${string2} You will receive the following result −With escapeXml() Function: string (1) : This is first String. string (2) : This is second String. Without escapeXml() Function − string (1) : This is first String. string (2) : This is second String.

Advertisements