Found 4336 Articles for Java 8

Java DatabaseMetaData getDefaultTransactionIsolation() method with example

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

83 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.The getDefaultTransactionIsolation() method of the DatabaseMetaData interface returns the default isolation level of the underlying database in integer format.To know the default transaction isolation of 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 ... Read More

Java DatabaseMetaData getColumns() method with example

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

3K+ Views

This method retrieves the description of the columns of a table. It accepts 4 parameters −catalog - A string parameter representing the name (or, name pattern) of the catalog (database in general) in which the table (that contains the columns of which you need to retrieve the description about) exists. pass "" to get the description of the columns in tables with no catalog and, pass null if you don't want to use catalog and thus narrow the search.schemaPattern - A String parameter representing the name (or, name pattern) of the schema of the table, pass "" if in case ... Read More

Java DatabaseMetaData getDatabaseMajorVersion() method with example

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

178 Views

The getDatabaseMajorVersion() method of the DatabaseMetaData interface returns the major version of the underlying database in integer format.To get major version of 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 name, password of a user in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the getMetaData() method of the Connection ... Read More

Java DatabaseMetaData getDatabaseMinorVersion() method with example

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

71 Views

The getDatabaseMinorVersion() method of the DatabaseMetaData interface returns the minor version of the underlying database in integer format.To get the list of minor version of 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 name, password of a user in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the getMetaData() method ... Read More

Java DatabaseMetaData getDatabaseProductName() method with example

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

665 Views

The getDatabaseProductName() method of the DatabaseMetaData interface returns the name of the underlying database in String format.To know the name of 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 name, password of a user in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the getMetaData() method of the Connection interface.Finally ... Read More

Java DatabaseMetaData getDatabaseProductVersion() method with example

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

218 Views

The getDatabaseProductVersion() method of the DatabaseMetaData interface returns the version number of the underlying database in String format.To get the version of 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 name, password of a user in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the getMetaData() method of the Connection ... Read More

Java DatabaseMetaData getCatalogs() method with example

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

540 Views

In general a catalog is a directory which holds information about data sets, file or, a database. Whereas in a database catalog holds the list of all the databases, base tables, views (virtual tables), synonyms, value ranges, indexes, users, and user groups.The getCatalogs() method of the DatabaseMetaData interface returns the name of the underlying database in String format.To get the list of catalogs of the database at an instance −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 ... Read More

Java DatabaseMetaData getDriverMajorVersion() method with example

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

146 Views

The getDriverMajorVersion() method of the DatabaseMetaData interface returns the major version of the JDBC driver used.To get the major version of the JDBC driver used to connect with the 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 name, password of a user in the database, as String variables.Get the DatabaseMetaData object with respect to the current connection using the ... Read More

How to reorder the columns of a table in JDBC?

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

184 Views

You can reorder the columns of a table in MySQL database using the ALTER TABLE command.SyntaxALTER TABLE table_name MODIFY column_name datatype AFTER another_columnAssume we have a table named dispatches_data in the database with 7 columns namely ProductName, CustomerName, DispatchDate, DeliveryTime, Price, Location and, ID with description as −//Retrieving the Time object Time timeObj = rs.getTime("DeliveryTime"); //Converting the Time object to String format String time = timeObj.toString();ExampleLet us create a table with name dispatches in MySQL database using CREATE statement as follows −CREATE TABLE dispatches(    ProductName VARCHAR(255),    CustomerName VARCHAR(255),    Price INT,    Location VARCHAR(255),    DispatchTimeStamp timestamp);Now, we will ... Read More

Java sql.Time valueOf() method with example

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

1K+ Views

The valueOf() method of the java.sql.Time class accepts a String value representing a time in JDBC escape format and converts the given String value into Time object.Time time = Time.valueOf("time_string");ExampleLet us create a table with name dispatches in MySQL database using CREATE statement as follows −CREATE TABLE dispatches(    ProductName VARCHAR(255),    CustomerName VARCHAR(255),    DispatchDate date,    DeliveryTime time,    Price INT,    Location VARCHAR(255));Now, we will insert 5 records in dispatches table using INSERT statements −insert into dispatches values('Key-Board', 'Raja', DATE('2019-09-01'), TIME('11:00:00'), 7000, 'Hyderabad'); insert into dispatches values('Earphones', 'Roja', DATE('2019-05-01'), TIME('11:00:00'), 2000, 'Vishakhapatnam'); insert into dispatches values('Mouse', 'Puja', ... Read More

Advertisements