Found 9150 Articles for Object Oriented Programming

Java DatabaseMetaData getTypeInfo() method with example

Alshifa Hasnain
Updated on 24-Feb-2025 18:27:12

594 Views

In this article, we will learn the DatabaseMetaData getTypeInfo() method in Java. The DatabaseMetaData.getTypeInfo() method in Java retrieves information about the supported data types in a database. What is getTypeInfo()? The getTypeInfo() method of the DatabaseMetaData interface returns a ResultSet containing information about all the data types supported by the database. Each row in this result set describes a single data type, including details such as its name, precision, case sensitivity, and whether it supports auto-increment. Syntax ResultSet info = metaData.getTypeInfo(); This method returns a ResultSet object describing the data types supported. This object holds values for the following details ... Read More

The DatabaseMetaData getResultSetHoldability() method with example

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

156 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

349 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 23-Jan-2025 22:53:19

101 Views

In this article, we will learn how to retrieve the list of time and date functions in the database using the getTimeDateFunctions() method of the DatabaseMetaData class in Java. getTimeDateFunctions() The getTimeDateFunctions() 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. Steps to Retrieve Time and Date Functions in Database To get the list of the time and date functions supported by the underlying database − Step 1: Register the Driver: Make sure your database is ... Read More

Java Connection getSystemFunctions() method with example

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

145 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

285 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

213 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

7K+ 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 05-Jul-2024 17:40:49

3K+ 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. Transaction Isolation Levels in Java Connection JDBC (Java Database Connectivity) 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 ... Read More

Java Connection getTransactionIsolation() method with example

Rishi Raj
Updated on 30-Dec-2024 19:13:58

698 Views

In this article, we learn the Connection getTransactionIsolation() method in Java, which allows you to determine a database connection's current transaction isolation level. Transaction isolation levels dictate how transactions interact, particularly regarding data locking during reads or writes. What is the getTransactionIsolation() Method? The getTransactionIsolation() method is part of the Connection Interface in Java. It returns an integer constant representing the current isolation level of the database connection. JDBC provides support for 5 transaction isolation levels through the Connection interface − TRANSACTION_NONE: It is represented by an integer value 0 and does not support transactions. ... Read More

Advertisements