- 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 317 Articles for JDBC
201 Views
Grouping related SQL statements into a batch and executing/submitting them at once is known as batch processing.While executing a set of statements one after other the execution switches from the database to program simultaneously.Using batch processing we can reduce this communication overhead and increase the performance of our Java application.For Example, if we have a table named Emp with the following description:+----------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+---------+-------+ | Name | varchar(255) | YES | ... Read More
5K+ Views
The time stamp dataType in MySQL database stores day, month, year, hour, minute, second, fractional seconds. Using this you can represent date and time at once.There are two ways to insert/get current time stamp values while working with JDBC.Using the database default value for a date.Using the getTime() method of the calendar class.Database default valueCreate a table named sample to store time stamps in MySQL database using the following query:CREATE TABLE Sample(Id INT, Current_Time_Stamp TimeStamp);Now describe the table as shown below:+--------------------+-----------+------+-----+-------------------+ | Field | Type | Null | Key | Default ... Read More
3K+ Views
Timestamp datatype in SQL is similar to Date (in SQL) both store day:month:year:hour:minute:second. In addition to this timestamp stores fractional seconds too.Inserting Timestamp in to a databaseThe PreparedStatement interface provides a method named setTimestamp() this method accepts two parameters an integer variable representing the parameter index of the place holder at which you need to store the timestamp and a long variable representing the number of milliseconds from the epoch time(standard base time I.e. January 1, 1970, 00:00:00 GMT) to the required time.ExampleAssume we have a table in the database named dispatches with the following description −+------------------+--------------+------+-----+-------------------+ | Field ... Read More
216 Views
You can insert time values in SQL using the time datatype, The java.sql.Time class maps to the SQL Time type.The PreparedStatement interface provides a method named setTime(). Using this you can insert time into a table. This method accepts two parameters −An integer representing the parameter index of the place holder (?) to which we need to set date value.A Time object representing the time value to be passed. The constructor of java.sql.Time class accepts a variable of long type representing the number of milliseconds from the epoch (standard base time I.e. January 1, 1970, 00:00:00 GMT).ExampleAssume we have created ... Read More
3K+ Views
The ResultSet interface provides a method named getDate() this method accepts an integer parameter representing the index of the column, (or, a String parameter representing the name of the column) from which you need to retrieve the date value. To retrieve date value from a table −Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Connect to the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password (String) as parameters to it.Create a Statement object using the createStatement() method of the Connection interface.Execute ... Read More
6K+ Views
You can insert date values in SQL using the date datatype, The java.sql.Date class maps to the SQL DATE type.The PreparedStatement interface provides a method named setDate(). Using this you can insert date into a table. This method accepts two parameters −An integer representing the parameter index of the place holder (?) to which we need to set date value.a Date object representing the date value to be passed. The constructor of java.sql.Date class accepts a variable of long type representing the number of milliseconds from the epoch (standard base time I.e. January 1, 1970, 00:00:00 GMT).ExampleAssume we have created ... Read More
1K+ Views
You can insert date values in SQL using the date datatype, The java.sql.Date class maps to the SQL DATE type.The PreparedStatement interface provides a method named setDate(). Using this you can insert date into a table. This method accepts two parameters −An integer representing the parameter index of the place holder (?) to which we need to set date value.a Date object representing the date value to be passed. The constructor of java.sql.Date class accepts a variable of long type representing the number of milliseconds from the epoch (standard base time I.e. January 1, 1970, 00:00:00 GMT).ExampleAssume we have created ... Read More
150 Views
A BLOB is binary large object that can hold a variable amount of data with a maximum length of 65535 charactersThese are used to store large amounts of binary data, such as images or other types of files.A CLOB stands for Character Large Object in general, an SQL Clob is a built-in datatype is used to store large amount of textual data. Using this datatype, you can store data up to 2, 147, 483, 647 characters.Blob and Clob data types together are known as LOB (Large Object) datatypes. Following are the restrictions on these datatypes.Cannot compare: We cannot compare CLOB ... Read More
11K+ Views
Blob and Clob together are known as LOB(Large Object Type). The following are the major differences between Blob and Clob data types.BlobClobThe full form of Blob is a Binary Large Object.The full form of Clob is Character Large Object.This is used to store large binary data.This is used to store large textual data.This stores values in the form of binary streams.This stores values in the form of character streams.Using this you can stores files like videos, images, gifs, and audio files.Using this you can store files like text files, PDF documents, word documents etc.MySQL supports this with the following datatypes:TINYBLOBBLOBMEDIUMBLOBLONGBLOBMySQL ... Read More
903 Views
The ResultSet interface provides the methods named getClob() and getCharacterStream() to retrieve Clob datatype, In which the contents of a file are typically stored.These methods accept an integer representing the index of the column (or, a String value representing the name of the column) and retrieves the value at the specified column.The difference is the getClob() method returns a Clob object and the getCgaracterStream() method returns a Reader object which holds the contents of the Clob datatype.ExampleAssume we have created a table named Articles in the database with the following description.+---------+--------------+------+-----+---------+-------+ | Field | Type ... Read More
To Continue Learning Please Login
Login with Google