-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQLsetup
More file actions
27 lines (15 loc) · 734 Bytes
/
SQLsetup
File metadata and controls
27 lines (15 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Before starting,I would like to thank Ms. Harmeet singh (http://harmeetsingh13.blogspot.in/2013/03/insert-and-retrieve-images-from-mysql.html) for her wonderfull SQL related tutorials.
So,for inserting images in sql ,first of all you should have sql(any version,i am using MySql) and its driver along with java installed.
SQL query:-
create table image(id varchar(45),size int,image longblob);
/*From MySQL documentation:, section Storage Requirements for String Types:
TINYBLOB
L+1 bytes, where L < 28 (256 bytes)
BLOB
L+2 bytes, where L < 216 (65 kilobytes)
MEDIUMBLOB
L+3 bytes, where L < 224 (16 megabytes)
LONGBLOB
L+4 bytes, where L < 232 (4 gigabytes)
*/
thus you can also store largeimages in mysql using longblob