Found 317 Articles for JDBC

The DatabaseMetaData getResultSetHoldability() method with example

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

58 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.The getResultSetHoldability() method of the DatabaseMetaData interface retrieves the default holdability for the ResultSet objects of the underlying database.This method returns an integer value representing the default ResultSet holdability, which will be either 1 or 2 where, 1 indicates the value HOLD_CURSORS_OVER_COMMIT. If the holdability of the ResultSet object is set to this value. Whenever you commit/save a transaction using the commit() method of the Connection interface, the ResultSet ... Read More

Java DatabaseMetaData getTableTypes() method with example

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

180 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 is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user name, password of a user in the database, ... Read More

Java DatabaseMetaData getTimeDateFunctions() method with example

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

40 Views

This method retrieves the list of time and date functions supported by the current database. The names returned by this method are the Open CLI time and date function names.This method returns a String value holding the list of functions separated by commas (", ").To get the list of the time and date functions supported by the underlying database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass ... Read More

Java Connection getSystemFunctions() method with example

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

78 Views

This method retrieves the list of System functions supported by the current database. The names returned by this method are the Open CLI System function names.This method returns a String value holding the list of functions separated by commas (", ").To get the list of the System functions supported by the underlying database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the database and, user ... Read More

Java Connection getStringFunctions() method with example

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

190 Views

The getStringFunctions() method of the Connection interface retrieves the list of String functions supported by the current database. The names returned by this method are the Open CLI String function names.This method returns a String value holding the list of functions separated by commas (", ").To get the list of the String functions supported by the underlying database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the ... Read More

Java Connection getNumeric() method with example

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

123 Views

The getNumeric() method of the Connection interface retrieves the list of math functions supported by the current database. The names returned by this method are the Open CLI math function names.This method returns a String value holding the list of functions separated by commas (", ").To get the list of the numeric functions supported by the underlying database −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. Pass the URL the ... Read More

Java Connection commit() method with example

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

5K+ Views

The commit() method of the Connection interface saves all the modifications made since the last commit.con.save()If any issue occurs after the commit you can revert all the changes done till this commit by invoking the rollback() method.Con.rollback()To commit a transactionRegister the driver using the registerDriver() method of the DriverManager class as −//Registering the Driver DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get the connection using the getConnection() method of the DriverManager class as −//Getting the connection String url = "jdbc:mysql://localhost/mydatabase"; Connection con = DriverManager.getConnection(url, "root", "password");Turn off the auto-commit using the setAutoCommit() method as −//Setting the auto commit false con.setAutoCommit(false);Commit the transaction using the commit() method as −con.commit();Let us create a table with ... Read More

Java Connection setTransactionIsolation() method with example

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

2K+ 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 transaction.JDBC provides support 5 transaction isolation levels through Connection interface.TRANSACTION_NONE: It is represented by integer value 0 does not support transactions.TRANSACTION_READ_COMMITTED: It is represented by integer value 2 supports transactions allowing Non-Repeatable Reads and, Phantom Reads.TRANSACTION_READ_UNCOMMITTED: It is represented by integer value 1 supports transactions allowing Dirty Reads, Non-Repeatable Reads ... Read More

Java Connection getTransactionIsolation() method with example

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

404 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 transaction.JDBC provides support 5 transaction isolation levels through Connection interface.TRANSACTION_NONE: It is represented by integer value 0 does not support transactions.TRANSACTION_READ_COMMITTED: It is represented by integer value 2 supports transactions allowing Non-Repeatable Reads and, Phantom Reads.TRANSACTION_READ_UNCOMMITTED: It is represented by integer value 1 supports transactions allowing Dirty Reads, Non-Repeatable Reads ... Read More

Java Connection getClientInfo() method with example

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

938 Views

The getClientInfo() method of the Connection interface returns the name and values of the client info properties of the current connection. This method returns a properties object.To retrieve the values of the client info properties file.Register the driver using the registerDriver() method of the DriverManager class as −//Registering the Driver DriverManager.registerDriver(new com.mysql.jdbc.Driver());Get the connection using the getConnection() method of the DriverManager class as −//Getting the connection String url = "jdbc:mysql://localhost/mydatabase"; Connection con = DriverManager.getConnection(url, "root", "password");Create a properties object as −Properties properties = new Properties();Add the required key-value pairs to the above created Properties object as −properties.put("user_name", "new_user"); properties.put("password", "password");Set the above ... Read More

Previous 1 ... 7 8 9 10 11 ... 32 Next
Advertisements