Click here to Skip to main content
15,845,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?


1 solution

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.[^]
Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900