- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 316 Articles for JDBC

Updated on 29-Jun-2020 13:12:06
While creating a table, in certain scenarios, we need values to column such as ID, to be generated/incremented automatically. Various databases support this feature in different ways.In MySQL database you can declare a column auto increment using the following syntax.CREATE TABLE table_name( ID INT PRIMARY KEY AUTO_INCREMENT, column_name1 data_type1, column_name2 data_type2, column_name3 data_type3, column_name4 data_type4, ............ ........... );MySQL query to create a table with auto-incremented column.CREATE TABLE Sales( ID INT PRIMARY KEY AUTO_INCREMENT, ProductName VARCHAR (20) NOT NULL, CustomerName VARCHAR (20) NOT NULL, DispatchDate date, DeliveryTime timestamp, Price ... Read More 
Updated on 30-Jul-2019 22:30:26
While creating a table, in certain scenarios, we need values to column such as ID, to be generated/incremented automatically. Various databases support this feature in different ways.In MySQL database you can declare a column auto increment using the following syntax.CREATE TABLE table_name( ID INT PRIMARY KEY AUTO_INCREMENT, column_name1 data_type1, column_name2 data_type2, column_name3 data_type3, column_name4 data_type4, ............ ........... );While inserting records in a table there is no need to insert value under the auto-incremented column. These will be generated automatically.For example, in a table if we have a column with name ID and data type ... Read More 
Updated on 29-Jun-2020 13:17:46
While creating a table, in certain scenarios, we need values to column such as ID, to be generated/incremented automatically. Various databases support this feature in different ways.In MySQL database you can declare a column auto increment using the following syntax.CREATE TABLE table_name( ID INT PRIMARY KEY AUTO_INCREMENT, column_name1 data_type1, column_name2 data_type2, column_name3 data_type3, column_name4 data_type4, ............ ........... );While inserting records in a table there is no need to insert value under the auto-incremented column. These will be generated automatically.For example, in a table if we have a column with name ID and data type ... Read More 
Updated on 30-Jul-2019 22:30:26
A Json array is an ordered collection of values that are enclosed in square brackets i.e. it begins with ‘[’ and ends with ‘]’. The values in the arrays are separated by ‘, ’ (comma).Sample JSON array{ "books": [ Java, JavaFX, Hbase, Cassandra, WebGL, JOGL] }The json-simple is a light weight library which is used to process JSON objects. Using this you can read or, write the contents of a JSON document using Java program.JSON-Simple maven dependencyFollowing is the maven dependency for the JSON-simple library − com.googlecode.json-simple json-simple ... Read More 
Updated on 30-Jul-2019 22:30:26
A Json array is an ordered collection of values that are enclosed in square brackets i.e. it begins with ‘[’ and ends with ‘]’. The values in the arrays are separated by ‘, ’ (comma).Sample JSON array{ "books": [ Java, JavaFX, Hbase, Cassandra, WebGL, JOGL] }The json-simple is a light weight library which is used to process JSON objects. Using this you can read or, write the contents of a JSON document using Java program.JSON-Simple maven dependencyFollowing is the maven dependency for the JSON-simple library − com.googlecode.json-simple json-simple ... Read More 
Updated on 30-Jul-2019 22:30:26
The SQL Count() function returns the number of rows in a table. Using this you can get the number of rows in a table.select count(*) from TABLE_NAME;Let us create a table with name cricketers_data in MySQL database using CREATE statement as shown below −CREATE TABLE cricketers_data( First_Name VARCHAR(255), Last_Name VARCHAR(255), Date_Of_Birth date, Place_Of_Birth VARCHAR(255), Country VARCHAR(255), );Now, we will insert 5 records in cricketers_data table using INSERT statements −insert into cricketers_data values('Shikhar', 'Dhawan', DATE('1981-12-05'), 'Delhi', 'India'); insert into cricketers_data values('Jonathan', 'Trott', DATE('1981-04-22'), 'CapeTown', 'SouthAfrica'); insert into cricketers_data values('Kumara', 'Sangakkara', DATE('1977-10-27'), 'Matale', 'Srilanka'); insert into cricketers_data values('Virat', 'Kohli', DATE('1988-11-05'), 'Delhi', ... Read More 
Updated on 30-Jul-2019 22:30:26
Yes, just like any other objects in Java we can pass a ResultSet object as a parameter to a method and, return it from a method.Let us create a table with name MyPlayers in MySQL database using CREATE statement as shown below −CREATE TABLE MyPlayers( ID INT, First_Name VARCHAR(255), Last_Name VARCHAR(255), Date_Of_Birth date, Place_Of_Birth VARCHAR(255), Country VARCHAR(255), PRIMARY KEY (ID) );Now, we will insert 7 records in MyPlayers table using INSERT statements −insert into MyPlayers values(1, 'Shikhar', 'Dhawan', DATE('1981-12-05'), 'Delhi', 'India'); insert into MyPlayers values(2, 'Jonathan', 'Trott', DATE('1981-04-22'), 'CapeTown', 'SouthAfrica'); insert into MyPlayers values(3, 'Kumara', 'Sangakkara', ... Read More 
Updated on 30-Jul-2019 22:30:26
The SQL TRUNCATE statement is used to delete all the records from a table.SyntaxTRUNCATE TABLE table_name;To delete all the records from a table from 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 to 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 object using the createStatement() method of the Connection interface.Execute the Query: Execute the query using the execute() method of the Statement interface.Following JDBC program ... Read More 
Updated on 30-Jul-2019 22:30:26
Stored procedures are sub routines, segment of SQL statements which are stored in SQL catalog. All the applications that can access Relational databases (Java, Python, PHP etc.), can access stored procedures.Stored procedures contain IN and OUT parameters or both. They may return result sets in case you use SELECT statements. Stored procedures can return multiple result sets.To create a stored procedure in (MySQL) 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 to the database using the getConnection() method ... Read More 
Updated on 30-Jul-2019 22:30:26
You can remove a particular record from a table in a database using the DELETE query.SyntaxDELETE FROM table_name WHERE [condition];To delete a record from a table 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 to 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 object using the createStatement() method of the Connection interface.Execute the Query: Execute the query using the executeUpdate() method of the ... Read More Advertisements