Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: Java Oracle
Hi all,
Am trying a sample application in java using Spring framework. The task
is to store am image into Database a byte array. For this am declaring the image field type as BLOB (in Oracle).
And in the java am executing following code to convert image to byte array.
File file = new File(path);
	        byte[] bFile = new byte[(int) file.length()];
	        try {
	        	FileInputStream fis=new FileInputStream(path);
	    		bFile = new byte[fis.available()+1];
	        } catch (Exception e) {
where "path" is the path to the image.
But when I try to see the data in the table am getting an error saying:
ORA-00932: inconsistent datatypes: expected NUMBER got BLOB
Can you provide any suggestion or solution to solve this issue?

Posted 5-Apr-12 18:59pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

your database expects a number (int-value) and you are delivering a blob.
Prepare your DB to be able to store a blob. The rest is fine.[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 530
1 Sergey Alexandrovich Kryukov 330
2 BillWoodruff 299
3 PIEBALDconsult 230
4 CPallini 220
0 Sergey Alexandrovich Kryukov 10,615
1 Maciej Los 5,354
2 OriginalGriff 5,254
3 CPallini 3,719
4 BillWoodruff 3,476

Advertise | Privacy | Mobile
Web02 | 2.8.141029.1 | Last Updated 10 Apr 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100