Saving images into database
Hi All,
I have a table with 3 BLOB columns to store images and a NUMBER type column to store the image id_no. I am using database 10g and Forms 6i
My problem is I recently updated the database from 8i to 10g, and since then I am unable to update or insert the new images in these BLOB columns. When I update the existing image or insert new image record through forms, It does save the changes in existing or new record. But It does not show these images while query the record. and also does not give any error while executing the query in forms.
But while trying to retrive the image from updated records or new record in reports, It throughs the error that image is format is unreadable or currupt.
There wasn't any problem in 8i, i could update the record as many times I wanted or create as many records as needed.
Is anybody have any clue about this problem! Any help in this regard will be highly appriciated.
Thanking you and Best Regards.
You should not save an image to database, since it'll make database slow, and difficult to write a web page to load image.
Save an image to specific location, and save image location to database.
Then, use <img> tag to call an image in web page.
Similar Messages
-
hello, i have been fighting with this for some days, i have a picture that i load with de filerence.load method. and then,
i use the filereference.data to show the picture into the image control.
i need to save the image into database, but i can't. i don't know how i can convert the bytearray into hexa string or binary!!!Hi Sai,
I am getting the error ArgumentError: Error #2015: Invalid
BitmapData. When I am trying to change the image into byteArray using
BitMapData.
Below is the code i am using for this scenario. I am trying to get
byteArray of the image after the image is completely loaded in the
onComplete().
private function initFunction(event:Event):void{
uploadFile =new FileReference();
imgTypes=new FileFilter("images(.JPG,.JPEG,.PNG,.GIF)",*
".JPG;.JPEG,.PNG;.GIF;"*);
private function browseFile():*void
uploadFile.addEventListener(Event.SELECT, onFileSelected);
*try
uploadFile.browse();
catch(err:Error)
logData(err.message);
private function onFileSelected(event:Event):*void
uploadFile.addEventListener(ProgressEvent.PROGRESS, onProgress);
uploadFile.addEventListener(Event.COMPLETE, onComplete);
uploadFile.load();
private function onProgress(event:ProgressEvent):*void
logData("Loaded " + event.bytesLoaded + " of " + event.bytesTotal + *"
bytes."*);
private function onComplete(evt:Event):*void
logData("File was successfully loaded.");
*//image.source = uploadFile.data;
image.source=uploadFile.name;
Alert.show("image source:"+image.source);
var bitmapData:BitmapData = new BitmapData(image.width,image.height);
var ba:ByteArray = png.encode(bitmapData);
Alert.show("bytes loaded"+ba);
Thanks,
Ravi.
On Sat, Nov 20, 2010 at 9:19 PM, ravindharreddy Baddam < -
How to store an image into database table
Hi
Can anyone tell me the way, how to store an image into database table.Hello,
May be this thread will help you in your requirement.
[FM for uploading Image to SAP;
Thanks,
Jayant -
Saving webcam images into database
Hi,
I have managed to acquire the image from my webcam through the vision acquisition software but now i faced a problem because i want the image to be stored in the database so that it could be view from a webpage( like a video stream).
What i did in my vi was just take the image out and connected it directly to the database and data is going in the database but when i tried to display it on the webpage it does not show.
Is it possible to do that and if so is there any tutorials i can refer to?
Solved!
Go to Solution.You should not save an image to database, since it'll make database slow, and difficult to write a web page to load image.
Save an image to specific location, and save image location to database.
Then, use <img> tag to call an image in web page. -
Goto saving images into a pdf and a message comes up " cannot start print job"
I an having a problem with my lightroom 4- I goto save my images into a PDF and it comes up " cannot start print job" and wont even save the images. What can be the problem, ive never had the situation before.
Hi Sasha,
Using Acrobat, you can create forms that are called AcroForms. The forms created in LC Designer are called XFA (XML Forms Architecture) and are more data centric. While both will open in Acrobat, they are completely different animals.
The issue with users not being able to save the data with Reader is that the form is not Reader Enabled. You can Reader Enable a form using one of two methods:
Reader Enable the form using Acrobat Professional (V8 or below) or Acrobat Standard (V9 or above). Note there are licensing restrictions.
Reader Enable the form using the full server product Adobe LiveCycle Reader Extensions ES2.5. This involves additional licensing fees.
Have a look here: http://assure.ly/etkFNU, at the features that are available depending on whether the user has Acrobat or Reader; if the form is Reader Enabled; and how the form was Reader Enabled.
The issue of Reader Enabling would also apply to AcroForms.
I don't think that you need to dive into LC Designer just yet, as forms created in LC Designer face the same issues about Reader Enabling as forms developed in Acrobat.
If your usage complies with the EULA, then you could Reader Enable your form in Acrobat.
Hope that helps,
Niall -
Urgent : how to put an image into database and how to get it from it?
hi,
in the database i made a longblob type for image, and in my java code i have the path of the image (String): "C:\............." and i want to put this image in my data base.
also i want to know how to get the image after put it in the database.
please help me, it's so urgent.This is a way of getting the image out of the database.
class yourClass{
private byte[] buff;
private ByteArrayOutputStream byteArrayOutputStream;
public yourClass()
Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
ResultSet result = statement.executeQuery("your query");
while ( result.next()){
try{
BufferedInputStream bin = new BufferedInputStream(rs.getBinaryStream("imagecolumn"));
byteArrayOutputStream = new ByteArrayOutputStream();
int length = bin.available();
buff = new byte[length];
while ( bin.read( buff, 0, length ) != -1 ) {
byteArrayOutputStream.write( buff, 0, length );
bin.close();
catch(Exception e){
The class about is used to take the image out of the database and store it in an object which is then streamed out through a servlet to display on the jsp page.
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
public class ImageServlet extends HttpServlet {
public void init() throws ServletException { }
public void destroy() { }
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try
yourClass pro = (yourClass)request.getSession().getAttribute("object");
while ( iterator.hasNext() ) {
pro = ( Product ) iterator.next();
response.setContentType("image/jpg");
ByteArrayOutputStream byteArrayOutputStream = pro.getImage();
response.setContentLength( byteArrayOutputStream.size() );
response.getOutputStream().write( byteArrayOutputStream.toByteArray() );
response.getOutputStream().flush();
return;
catch (Exception e)
e.printStackTrace();
throw new ServletException(e);
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
This is a little messy but if you search the forums you will find out more on it. Search for Images and database. -
Hi all,
Pls what is the best way for putting the employees photos into
the personal application?
is it ok to save the Pics to the table or to the database.
Pls advise me.
Best Regards.Hi ,
It is better to save the images in the Database in the
Blob column in a Emp Table. -
How to upload images into database.
I have a employee table. I want to upload the image of the corresponding employee. How can we achieve this ??
Edited by: Manjunath CN on Oct 14, 2008 2:15 PMHi Manjunath,
Please check Sikindar post in this link
Photo Upload
Tcode OAAD.
Click on the Create button. Business object PREL and Docyment type HRICOLFOTO. Click on create (fill in the right personnel number in the pop up and click Continue).
Choose the photo (as a JPG file) from the place where it is saved (e.g. hard disk). SAP will notify that the Stored Document was created succesfully.
Photo is visible via PA10, PA20, PA30, PA40. Double-click to magnify photo.
Best regards,
raam -
Uploading images into database using webforms...
Hi,
I'm trying to upload images in to the database. This is possible on a normal form running the forms runtime, but how do i do it when is comes to webforms?
Thanx in advance!hai roshapt
what is the fine extension u r using.to get the images to disply in web also place the image file in the same path where u place the
.fmx forms or create a virtual directory for images and configure that virtual directory also.
regards
ramesh. -
Getting error while saving image to database
hi, i am getting error when i click commit button when i try to save image the message is as
Cannot create an object of type:java.sql.Blob from type:oracle.jbo.domain.BlobDomain with value:ÿØÿàJFIF``ÿáExifMM*2VGFGI2œ�êô‡ijÔ2009:03
please help me soonhey thanks , but my jdbc pool and driver is fine. what may be the problem and I am not able to change the type to BlobDomain in eo. The type i Blob only may be this is the problem how can I change it to Blob Domain
-
How to insert files or images into database using mysql
i need one example how to store files and retrive from database
give me examples on storing and retriving foles or imageshttp://www.oracle.com/technology/sample_code/tech/java/sqlj_jdbc/htdocs/templates.htm#LOBS
-
Inserting Multiple Images into oracle database using JDBC
I wanted to insert multiple images into database using JDBC by reading it from the file... and i am passing photos.txt(my text file) as an input parameter... I have inserted all the values into the database except for the image part... this is my content of photos.txt file and i have copied all the images into the folder
*" C:\\photos "*
*1,in1.jpg,108,19,in-n-out*
*2,in2.jpg,187,21,in-n-out*
*3,in3.jpg,308,41,in-n-out*
*4,in4.jpg,477,52,in-n-out*
*5,in5.jpg,530,50,in-n-out*
and i want to store in1.jpg,in2.jpg,in3.jpg,in4.jpg,in5.jpg into the oracle databse using JDBC.... i have tried a lot using BLOB column.... and i have created my table as
CREATE TABLE PHOTO(
ID NUMBER NOT NULL PRIMARY KEY ,
Name BLOB,
X DOUBLE PRECISION,
Y DOUBLE PRECISION,
Tags VARCHAR2(40)
try { // for restaurant System.out.println();System.out.println();System.out.println(); System.out.print(" Creating Statement for Photo...\n"); stmt2 = con.createStatement (); stmt2.executeUpdate("delete from PHOTO"); stmt2.executeUpdate("commit"); PreparedStatement stmt3 = con.prepareStatement ("INSERT INTO PHOTO VALUES (?, ?, ?, ?, ?)"); System.out.print(" Create FileReader Object for file: " + inputFileName1 + "...\n"); FileReader inputFileReader2 = new FileReader(inputFileName1); System.out.print(" Create BufferedReader Object for FileReader Object...\n"); BufferedReader inputStream2 = new BufferedReader(inputFileReader2); String inLine2 = null; String[] tokens; // String[] imageFilenames = {"c:\\photos\\in1.jpg","c:\\photos\\in2.jpg","c:\\photos\\in3.jpg","c:\\photos\\in4.jpg","c:\\photos\\in5.jpg", // "c:\\photos\\in6.jpg","c:\\photos\\in7.jpg","c:\\photos\\in8.jpg","c:\\photos\\in9.jpg","c:\\photos\\in10.jpg","c:\\photos\\arb1.jpg","c:\\photos\\arb2.jpg", // "c:\\photos\\arb3.jpg","c:\\photos\\arb4.jpg","c:\\photos\\arb5.jpg","c:\\photos\\den1.jpg","c:\\photos\\den2.jpg","c:\\photos\\den3.jpg", // "c:\\photos\\den4.jpg","c:\\photos\\den5.jpg","c:\\photos\\hop1.jpg","c:\\photos\\hop2.jpg","c:\\photos\\hop3.jpg","c:\\photos\\hop4.jpg","c:\\photos\\hop5.jpg"}; File file = new File("C:\\photos\\in1.jpg"); \\ ( Just for example ) FileInputStream fs = new FileInputStream(file); while ((inLine2 = inputStream2.readLine()) != null) { tokens= inLine2.split(","); st2 = new StringTokenizer(inLine2, DELIM); stmt3.setString(1, tokens[0]); stmt3.setBinaryStream(2, fs, (int)(file.length())); stmt3.setString(3, tokens[2]); stmt3.setString(4, tokens[3]); stmt3.setString(5, tokens[4]); stmt3.execute(); //execute the prepared statement stmt3.clearParameters();
As i am able to enter one image file by above code in1.jpg in to the oracle database.... but i am not able to insert all the image file in to the database.....do tell me what should i do.... and can you give me the example on the basis of the above code of mine...
do reply as soon as possible..jwenting wrote:
that depends. Putting the images in BLOBs prevents the file locations stored in the database from getting out of synch with the filesystem when sysadmins decide to reorganise directory structures or "archive" "old" files that noone uses anyway.True, but it really comes down to a business decision (cost-benefit analysis). If you have the bucks, the expertise, and the time, go with the Blobs, otherwise go with the flat files. -
RE: Images from Database into W
I've found that a good way to store images was not in the database, but
in files on the server in GIF format and then store the filenames in the
database. That way you avoid the BinaryData mess, the cursor
requirement for blobs, and can store in a compressed form..
You just have the service read in the image from the data file and pass
it back to the requestor, if I remember right.. Also nice because the
same GIF files can be used in normal HTML web pages..
-Greg
Greg Nyberg, Senior Consultant
BORN Information Services Group
(612) 404-4217 Fax: (612) 404-4440
<[email protected]>
From: Brendan Duddridge[SMTP:[email protected]]
Sent: Monday, April 28, 1997 12:28 PM
To: Forte ListServe
Subject: Images from Database into W
TransCanada PipeLines P.O. Box
1000, Station
M
Calgary,
Alberta, T2P
4K5
Telephone:
(403)
267-6100
FAX: (403)
267-6444/5/6
Corporate Head Office
Reply: Images from Database into Web SDK 1.1 page
Hi,
I want to be able to read images in from a database and have Forte
generate a web page with those images.
Does anyone know what the MIME type would be for a Forte ImageData
object? Do I have to store the images into the database in gif format
or is there some other MIME format that Forte uses to store ImageData
objects. Also, can Netscape or Internet Explorer read those images?
Here is the ReturnImage page builder method I created:
=============================================================
Response : HTTPResponse = new();
LUIObject_ID : Integer;
LUIObject_TD : TextData = new();
aLUIObject : LUIObject;
aBinaryData : BinaryData = new();
aStream : MemoryStream = new();
// Retrieve LUIObject_ID from http parameters
LUIObject_TD = pRequest.FindNameValue('LUIObject_ID');
LUIObject_ID = LUIObject_TD.IntegerValue;
// Retrieve aLUIObject for the specified LUIObject_ID from the
database.
// This object contains various ImageData attributes which contain the
// icons to display on the web page.
aLUIObject = SODIInfraSOMgrSO.SelectLUIObject(LUIObject_ID);
aBinaryData.SetAllocatedSize(aLUIObject.ClosedLargeIconSize);
aStream.Open(accessMode = SP_AM_READ_WRITE, isBinary = TRUE);
aStream.WriteSerialized(object=aLUIObject.ClosedLargeIcon);
aStream.Seek(0);
aStream.ReadBinary(target = aBinaryData);
// Not sure what MIME type to specify here for ImageData objects
// read in from a database. Any ideas??????????
Response.AssignBinaryResponse(aBinaryData, 'image/x-bitmap');
return Response;
===============================================================
Thanks,
Brendan DuddridgeHello Denis Segard,
I also try the same method and I use OLE container to store the images into database in Oracle forms 6i.
But, if i try to retrieve the images in report i got that error.
Anyway i store the images into the database but why i shouldn't retrieve it in reports and i can retrieve the images in forms
Is there any problem in my design.
Is there any other easy way to store the images into database in oracle forms 6i...
Waiting 4 ur reply!!!!!!!!
Edited by: Janarthan on Aug 19, 2011 12:36 AM
Edited by: Janarthan on Aug 19, 2011 12:39 AM -
Display image from database with jspSmart
Hi
I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to display a specific icon in my browser, I get "javax.servlet.ServletException: General error" at:
PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
My code looks like this:
imgModifyDataType.jsp
<%
ResultSet myResultSet = null;
Statement myStatement = null;
Connection myConnection = null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
String iconName;
String pDTID = request.getParameter("dtid");
String mySQL = "Select iconname, icon from data_types where dtid=?";
PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
pstmt.setString(1,pDTID);
myResultSet = pstmt.executeQuery();
iconName = myResultSet.getString("iconname");
myUpload.initialize(pageContext);
myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
%>
I call this JSP from another JSP like this:
<img src="imgModifyDataType.jsp?dtid=<%=pDTID%>">
If we cannt display image with the help of another jsp like this then please guide me how to modify the imgModifyDataType.jsp to a servlet because I have never worked in servlets.
Please help
SajidI think that it may help you get image from database. I used two jsp page. First one is getphoto.jsp that makes as table based in sql statment and invoke the getimage.jsp this last returns images based on
the getphoto.jsp PhotoId.
/** getphoto.jsp source code */
<%@page import="java.sql.*,oracle.jdbc.*"%>
<html>
<head>
<title>
jsp1
</title>
</head>
<body bgcolor="#ffffff">
<table width="781" border="2">
<tr<<td>
<td width="83" bgcolor="#C0C0C0"><b>PhotoId</b><td width="450" bgcolor="#C0C0C0"><b>Description</b></td><td width="228" bgcolor="#C0C0C0"><b>Photo Image</b></td>
<%
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@itas:1521:oraITAS","yourDbUserId","yourDbPassword");
stmt = conn.createStatement();
rset = stmt.executeQuery("select photo_id,photo_description from photo");
while (rset.next()) {
%>
<tr><td width="83"><%=rset.getObject("photo_id")%></td><td width="450"><%=rset.getObject("photo_description")%></td><td width="228"><img src="getimage.jsp?PhotoId=<%=rset.getObject("photo_id")%>" width="238" height="228"></td></tr>
<%
conn.close();
%>
</table>
</body>
</html>
/** getimage.jsp source code */
<%@ page contentType="image/jpeg; chaoResult=iso-8859-1" language="java" import="java.sql.*,java.io.*,java.util.*" errorPage="" %>
<%
String strConnString = null;
Connection oDbConn;
Statement oStmt;
ResultSet oResult;
String strConnection = null;
String strUserId = "c_erober";
String strUserPwd = "sybdev99";
String strDatabase = "oraITAS";
String strPhotoId;
strConnString = "jdbc:odbc:" + strDatabase;
String strSql;
try {
strPhotoId = (String) request.getParameter("PhotoId");
strSql = "select photo_image from photo" + ( (strPhotoId==null) ? " where photo_id = '001'": (" where photo_id = '" + strPhotoId + "'") );
DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
oDbConn = DriverManager.getConnection(strConnString,strUserId,strUserPwd);
response.setContentType("image/jpeg");
oStmt = oDbConn.createStatement();
oResult = oStmt.executeQuery(strSql);
oResult.next();
byte[] bytearray = new byte[4096];
int size=0;
InputStream sImage;
sImage = oResult.getBinaryStream(1);
response.reset();
response.setContentType("image/jpeg");
response.addHeader("Content-Disposition","filename=getimage.jpeg");
while((size=sImage.read(bytearray))!= -1 ) {
response.getOutputStream().write(bytearray,0,size);
response.flushBuffer();
sImage.close();
oDbConn.close();
} catch (SQLException ex) { ex.getMessage();
%> -
I'm new to Oracle.
Can I load image into database by using Photo Album by no writing any code?
And how?
If not,how to load image into database?Yes you can. You can load media into the database into the photo album tables.
Is this what you want to do? What exactly are you trying to accomplish.
You can also use PL/SQL to put images into the database into your own schema (as with other database information)
http://www.oracle.com/technology/sample_code/products/intermedia/htdocs/bulkload.html
Larry
Maybe you are looking for
-
BAPI_DOCUMENT_CREATE2
Hi, I am new to ABAP, could you please let me know what are the mandatory fields that I need to provide to create the Document Number in this BAPI BAPI_DOCUMENT_CREATE2. Please provide the complete details. Also let me know will it allow us to create
-
It's the 5th gen iPod touch and each song has the cloud symbol next to it that I can tap to download from the cloud onto my iPod but I don't want to have to do that for over 1000 songs so how can I do this all at once? I've already tried syncing my i
-
How to figure out ORA_12203:TNS unable to connect to destination?
OS: WSK I have installed oracle817 and form6i in different directory in a machine and defined two oracle home for them. I can access sqlplus through OEM of oracle817, but I can not do the same thing through form6i, the error showed me: ORA_12203:TNS
-
Hey, I'm looking to disable the "Assert" dialog boxes that InDesign throws up in debug mode (as a temporary measure, there's too many of them appearing in the plugin that I'm debugging)... I've tried adding the following line to my Debug Settings.xml
-
I have spent too much time on the same issues. Will the issues ever be resolved?