---
title: "problem related to image.."  
description: "problem related to image.."  
author: "Anonymous User"  
published: 2010-12-18  
updated: 2010-12-20  
canonical: https://www.mindstick.com/forum/128/problem-related-to-image  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# problem related to image..

![problem related to image..](https://www.mindstick.com/app_images/htmleditor.icons/eusa_clap.gif)i am creating [web application](https://www.mindstick.com/articles/13069/progressive-web-application-pwas-all-you-need-to-know-about) in j2ee, and i used [oracle](https://www.mindstick.com/articles/13016/alter-table-statement-or-command-in-oracle) in backend\
i have [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) the [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in oracle by using [blob](https://www.mindstick.com/articles/11906/working-with-blob-binary-large-objects) [datatype](https://www.mindstick.com/forum/160266/explain-the-datatype-data-annotation-and-its-significance-in-data-entry-and-display)\
[problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) in fetching the image from oracle\
how we write the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) in [java](https://www.mindstick.com/articles/12214/web-development-company-in-india-laid-on-the-foundation-of-concrete-java-programming) to fetching the image and show in image box. ![problem related to image..](https://www.mindstick.com/app_images/htmleditor.icons/eusa_wall.gif)\

## Replies

### Reply by Amit Singh

we use the following syntax :\
ps.setBinaryStream(int parameterIndex, InputStream x, int length) \
where ps is the object of prepared statement\
\
use this code \
example:\

```
file=new File("C:/Picture/Sun.jpg");
fleInStream=new FileInputStream(file);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
c=DriverManager.getConnection("Jdbc:Odbc:image","scott","tiger");
s=c.createStatement();
ps=c.prepareStatement("insert into tblImage values(?,?)");
ps.setInt(1,2);
ps.setBinaryStream(2,fleInStream,(int)file.length());
System.out.println("success");
ps.execute();
ps.close();
c.close();
```


---

Original Source: https://www.mindstick.com/forum/128/problem-related-to-image

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
