- 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 317 Articles for JDBC
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
4K+ Views
In general, the contents of a file are stored under Clob (TINYTEXT, TEXT, MEDIUMTEXT, LONGTEXT) datatype in MySQL database.JDBC provides support for the Clob datatype, to store the contents of a file in to a table in a database.The setCharacterStream() method of the PreparedStatement interface accepts an integer representing the index of the parameter and, a Reader object as a parameter.And sets the contents of the given reader object (file) as value to the parameter (place holder) in the specified index.Whenever you need to send very large text value you can use this method.Storing text file using JDBC:If you need to ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
478 Views
The ResultSet interface provides the method named getClob() to retrieve clob datatype from a table in a database. In addition to this it also provides a method named getCharacterStream()Like getClob() this method also accepts 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 unlike the getClob() method (which returns a Clob object) this method returns an object of the Reader class.ExampleAssume we have created a table named MyData in the database with the following description.+---------+--------------+------+-----+---------+-------+ | Field | Type ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
2K+ Views
Assume we already have a table named MyData in the database with the following description.+---------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------+--------------+------+-----+---------+-------+ | Name | varchar(255) | YES | | NULL | | | Article | longtext | YES | | NULL | | +---------+--------------+------+-----+---------+-------+If you need to insert ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
10K+ Views
CLOB stands for Character Large Object in general, an SQL Clob is a built-in datatype and is used to store large amount of textual data. Using this datatype, you can store data up to 2, 147, 483, 647 characters.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).MYSQL database provides support for this datatype using four variables.TINYTEXT: A CLOB type with a maximum of 28-1 (255) characters.TEXT: A CLOB type with a maximum of 216-1 ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
10K+ Views
A BLOB is binary large object that can hold a variable amount of data with a maximum length of 65535 characters.These are used to store large amounts of binary data, such as images or other types of files. Fields defined as TEXT also hold large amounts of data. The difference between the two is that the sorts and comparisons on the stored data are case sensitive on BLOBs and are not case sensitive in TEXT fields. You do not specify a length with BLOB or TEXT.Storing blob in to databaseTo store Blob datatype to database, using JDBC program follow the ... Read More
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
189 Views
JDBC provides support for almost all the SQL datatypes Whenever the JDBC driver receives a call from a Java application it converts the Java datatypes in it to the corresponding SQL data types. The conversion process follows default mapping. Following is the list of data types supported by JDBC and their corresponding SQL datatypes.SQLJDBC/JavaVARCHARjava.lang.StringCHARjava.lang.StringLONGVARCHARjava.lang.StringBITbooleanNUMERICjava.math.BigDecimalTINYINTbyteSMALLINTshortINTEGERintBIGINTlongREALfloatFLOATfloatDOUBLEdoubleVARBINARYbyte[ ]BINARYbyte[ ]DATEjava.sql.DateTIMEjava.sql.TimeTIMESTAMPjava.sql.TimestampCLOBjava.sql.ClobBLOBjava.sql.BlobARRAYjava.sql.ArrayREFjava.sql.RefSTRUCTjava.sql.Struct
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
1K+ Views
The setFetchSize(int) method defines the number of rows that will be read from the database when the ResultSet needs more rows. setFetchSize(int) affects how the database returns the ResultSet data.Whereas, setMaxRows(int) method of the ResultSet specifies how many rows a ResultSet can contain at a time. setMaxRows(int) affects the client side JDBC object.
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
687 Views
The setBlob() method is used to set value for Blob datatype in the database. It has three variants as follows:void setBlob(int parameterIndex, Blob x): Sets the given Blob value to the parameter at the specified index.void setBlob(int parameterIndex, InputStream inputStream): Sets the contents of the given input stream as a value to the parameter at the specified index.void setBlob(int parameterIndex, InputStream inputStream, long length): Sets the contents of the given input stream as a value to the parameter at the specified index.The setBinaryStream() method is used to set the contents of the given InputStream as a value for the parameter ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
5K+ Views
To hold an image in Oracle database generally blob type is used. Therefore, make sure that you have a table created with a blob datatype as:Name Null? Type ----------------------------------------- -------- ---------------------------- NAME VARCHAR2(255) IMAGE BLOBTo insert an image in to Oracle database, follow the steps given below:Step 1: Connect to the databaseYou can connect to a database using the getConnection() method of the DriverManager classConnect to the Oracle database by passing the Oracle URL which is jdbc:oracle:thin:@localhost:1521/xe (for express edition), username and password as parameters to the getConnection() method.String oracleUrl = "jdbc:oracle:thin:@localhost:1521/xe"; Connection con = DriverManager.getConnection(oracleUrl, "user_name", "password");Step 2: Create ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
456 Views
The ResultSet interface provides the method named getBlob() to retrieve blob datatype from a table in the database. In addition to this, it also provides a method named getBinaryStream()Like getBlob() this method also accepts 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 unlike the getBlob() method (which returns a Blob object) this method returns an InputStream object which holds the contents of the blob datatype in the form of un-interpreted bytes.ExampleAssume we have created a table named MyTable in ... Read More