Found 4336 Articles for Java 8

Java ResultSetMetaData getColumnCount() method with example?

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

1K+ Views

The getColumnCount() method of the ResultSetMetaData (interface) retrieves the number of the columns of the current ResultSet object.This method returns an integer value representing the number of columns.To get the ResultSetMetaData object, you need to:Register the Driver: Select the required database register the Driver class of the particular database using the registerDriver() method of the DriverManager class or, the forName() method of the class named Class.DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get connection: Create a connection object by passing the URL of the database, username and password of a user in the database (in string format) as parameters to the getConnection() method of the DriverManager class.Connection mysqlCon = ... Read More

Java ResultSet wasNull() method with example

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

6K+ 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The wasNull() method of the ResultSet interface determines whether the last column read had a Null value. i.e. whenever you read the contents of a column of the ResultSet using the ... Read More

The ResultSet updateRow() method with example

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

2K+ 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The updateRow() method of the ResultSet interface updates the contents of the current row to the database. For example if we have updated the values of a particular record using the updateXXX() ... Read More

Java ResultSet relative() method with example

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

666 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The relative() method of the ResultSet interface moves the ResultSet pointer/cursor n number of rows from the current position.This method returns an integer value representing the current row number to which the ResultSet pointer ... Read More

Java ResultSet afterLast() method with example

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

973 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The afterLast() method of the ResultSet interface moves the pointer/cursor of the current ResultSet object to next position of the last row.rs.afterLast();Let us create a table with name MyPlayers in MySQL ... Read More

Java ResultSet beforeFirst() method with example

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

3K+ 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The beforeFirst() method of the ResultSet interface moves the pointer of the current (ResultSet) object to the default position (before first), from the current position.Statement stmt = con.createStatement(); ResultSet rs = ... Read More

Java ResultSet deleteRow() method with example

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

2K+ 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The deleteRow() method of the ResultSet interface deletes the current row from the ResultSet object and from the table.rs.deleteRow();Let us create a table with name MyPlayers in MySQL database using CREATE statement as ... Read More

Java ResultSet findColumn() method with example

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

1K+ 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The findColumn() method of the ResultSet interface maps the column label to column index. Using this you can find the index of a particular column in the result set.This method accepts a String ... Read More

Java ResultSet getDriverMajorVersion() method with example

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

87 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The first() method of the ResultSet interface moves the pointer of the current (ResultSet) object to the first row, from the current position.This method returns a boolean value specifying whether the ResultSet cursor ... Read More

Java ResultSet getMetaData() method with example

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

5K+ 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 ResultSet object has a cursor/pointer which points to the current row. Initially this cursor is positioned before first row.The ResultSetMetaData provides information about the obtained ResultSet object like, the number of columns, names of the columns, datatypes of the columns, name of the table etc…The getMetaData() method of ResultSet interface ... Read More

Advertisements