
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 9150 Articles for Object Oriented Programming

7K+ Views
An interface in Java is similar to class but, it contains only abstract methods and fields which are final and static.A static method is declared using the static keyword and it will be loaded into the memory along with the class. You can access static methods using class name without instantiation.Static methods in an interface since java8Since Java8 you can have static methods in an interface (with body). You need to call them using the name of the interface, just like static methods of a class.ExampleIn the following example, we are defining a static method in an interface and accessing ... Read More

1K+ Views
Indexes in a table are pointers to the data, these speed up the data retrieval from a table. If we use indexes, the INSERT and UPDATE statements get executed in a slower phase. Whereas SELECT and WHERE get executed with in lesser time.Creating an indexCTREATE INDEX index_name on table_name (column_name);Displaying the IndexesSHOW INDEXES FROM table_name;Dropping an indexDROP INDEX index_name;Following JDBC program creates a table with name Emp in JavaDB. creates an index on it, displays the list of indexes and, deletes the created index.Exampleimport java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; public class IndexesExample { public static void main(String ... Read More

698 Views
The default methods in an interface in Java are also known as defender methods or, virtual methods.The defender/virtual methods are those that will have a default implementation in an interface. You can define defender/virtual methods using the default keyword as −default void display() { System.out.println("This is a default method"); }There is no need to implement these defender/virtual methods in the implementing classes you can call them directly.If you have an interface which is implemented by some classes and if you want to add a new method int it.Then, you need to implement this newly added method in all the ... Read More

168 Views
You can create a table in a database using the CREATE TABLE query.SyntaxCREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ..... columnN datatype, PRIMARY KEY( one or more columns ) );To create a table in a database using JDBC API you need to −Register the driver − Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection − Connect ot the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password (String) as parameters to it.Create Statement − Create a Statement ... Read More

210 Views
You can create a table in JavaDB database using the CREATE TABLE statement.SyntaxCREATE TABLE table_name ( column_name1 column_data_type1 constraint (optional), column_name2 column_data_type2 constraint (optional), column_name3 column_data_type3 constraint (optional) );To create a table in JavaDB using JDBC API you need to −Register the driver − The forName() method of the class, Class accepts a String value representing a class name loads it in to the memory, which automatically registers it. Register the driver using this method.Establish a connection − Connect ot the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password (String) ... Read More

1K+ Views
The java.sql.DriverManager class manages JDBC drivers in your application. This class maintains a list of required drivers and load them whenever it is initialized.Therefore, you need to register the driver class before using it. However, you need to do it only once per application.One way to register a driver class object to Driver manager is the registerDriver() method of the DriverManager class. To this method you need to pass the Driver object as a parameter.//Instantiating a driver class Driver driver = new com.mysql.jdbc.Driver(); //Registering the Driver DriverManager.registerDriver(driver);List of all the DriversYou can get the list of all the drivers registered ... Read More

680 Views
The java.sql.DriverManager class manages JDBC drivers in your application. This class maintains a list of required drivers and load them whenever it is initialized.Therefore, you need to register the driver class before using it. However, you need to do it only once per application.You can register a new Driver class in two ways −Using the registerDriver() method of the DriverManager class. To this method you need to pass the Driver object as a parameter.//Instantiating a driver class Driver driver = new com.mysql.jdbc.Driver(); //Registering the Driver DriverManager.registerDriver(driver);Using the forName() method of the class named Class. To this method you need to ... Read More

3K+ Views
CLOB stands for Character Large Object. in general, an SQL Clob is a built-in datatype which is used to store large amount of textual data. Using this datatype, you can store data up to 2, 147, 483, 647 characters. MYSQL database provides support Clob datatype TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.The java.sql.Clob interface of the JDBC API represents the CLOB datatype. Since the Clob object in JDBC is implemented using an SQL locator, it holds a logical pointer to the SQL CLOB (not the data).Inserting Data into a column of Clob typeYou can insert a CLOB type value using the setCharacterStream() or, ... Read More

6K+ Views
Clob datatypeCLOB stands for Character Large Object. in general, an SQL Clob is a built-in datatype which is used to store large amount of textual data. Using this datatype, you can store data up to 2, 147, 483, 647 characters. MYSQL database provides support Clob datatype TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT.The java.sql.Clob interface of the JDBC API represents the CLOB datatype. Since the Clob object in JDBC is implemented using an SQL locator, it holds a logical pointer to the SQL CLOB (not the data).Reading Data from a column of datatype ClobYou can read CLOB value (character stream data) from a ... Read More

939 Views
You can get the properties of a driver using the getPropertyInfo() method of the Driver interface.DriverPropertyInfo[] info = driver.getPropertyInfo(mysqlUrl, null);This method accepts a two parameters: A String variable representing the URL of the database, an object of the class Properties and, returns an array of the DriverPropertyInfo objects, where each object holds information about the possible properties of the current driver.From a DriverPropertyInfo object you can get the information such as name of the property, value of the property, description, choices and, if it is required or not, using its fields name, value, description, choices, required, respectively.DriverPropertyInfo[] info = driver.getPropertyInfo(mysqlUrl, ... Read More