How to manipulate images as BLOB in DB table
*I hope any one could help me in steps _*
How i can put an image in a table ,
and then query it for a specific employee for example
I know i'll get Help here _ thanks in advance
It depends on what you use as a front end for uploading your images.
Oracle Forms has a certain way of doing this, while Application Express has a totally different approach. You can even upload your images using SQLDeveloper
Similar Messages
-
How to display image in blob field in ResultSet in SiteStudio?
I am running Site Studio 10gR4. For a custom page, I created a component that basically runs a query. The structure of the underlying data is a combination of Varchar2, Date and a single BLOB field. The blob field either contains a simple jpeg image, or nothing.
In my Page where I am looping through the data, how do I display the blob as an image?
Currently the code looks like this:
<!--$loop SQLRoutes-->
<tr>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 0))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 2))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 3))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 4))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 5))--></td>
<td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></td>
</tr>
<!--$endloop-->Field 1 is a blob and fields 5 and 6 are dates.
So really two questions:
1. How do I display field1 as an image?
Example:
<!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))-->doesn't do it. Is there a different function then getValue() that I should be using to get the blob contents?
2. I want to compare the date fields to todays date, and either change the color or conditionally display the fields. I could do this with basic taglibs from jsp. How do I do this with IDocScript?
Example:
<!--$if getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6)) > dateCurrent-->
<span class="red"><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></span>
<!--$endif-->Thanks, KenI actually don't know the answer to #1. If I were to guess, there's nothing out-of-the-box to handle blobs, so your best option is to write your own idoc function. Take a look at the How To component if you don't know how.
For #2, you almost have it right. Insert bold:
<!--$if <b>parseDate(formatDate(</b>getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))<b>)) gt</b> dateCurrent<b>()</b>-->
<span class="red"><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></span>
<!--$endif--> -
How to load images from BLOB to javascript?
hi, Guys:
I need to load thumbnail images from BLOB to multiple markers' infowindow in Google map . I have implemented Google map in APEX. I load the data suchas text for every marker's infowindow from Oracle database table with PL/JSON, and infowindow works fine. Could anyone give me a suggestion or example so I know how to load images to javascript?
Thanks a lot.
Database: Oracle 11g R2
APEX: APEX 4.1
Thanks.
Samlxiscas wrote:
hi, VC:
Thanks for your kind reply. I need to render these images out of APEX session, actually in javascript that is related to Google map markers' infowindow.
I checked the documents of APEX_UTIL.GET_BLOB_FILE_SRC, but my impression is I need to use it in APEX instead of javascript if my understanding is correct. I already implemented a procedure with PL/SQL to load images from a BLOB column in Oracle database. But the problem is, how can I pass it to javascript code out of APEX to javascript (I could pass text or number from APEX to javascript with PL/JSON though,But I assume that still google map will be within a valid apex session? if so you should be able to use the above api.
Basically what this api does is generates a kind of url to each blob in the database, not sure how google api's deal with this though. Why don't you give it a try?
The other option is to make your pl/sql procedure public and then you can generate the json to include the images urls such as:
"employees" : [{
"firstName" : "John",
"lastName" : "Doe",
"imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
"firstName" : "Anna",
"lastName" : "Smith"
"imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
"firstName" : "Peter",
"lastName" : "Jones"
"imgSrc" : "http://somewhere/db_schema.your_download_proc?p_file=#ID#",
}And then you can use this new attribute to populate the images in javascript using standard img tag
See this tutorial http://docs.oracle.com/cd/E14373_01/appdev.32/e13363/up_dn_files.htm
I did not find any method in PL/JSON to pass image object)? So far I only found example to load images from local files to javascript.Hmm..I don't think you should load image objects.
Vikram -
How to display image that's in a table (BLOB datatype) in apex 4.0 report
I have an image that is in a table and I'm trying to get it to display in a report. The upload takes place on 1 page and the report is on another page. The source for the report page is as follows:
select firstname,
lastname,
decode(nvl(dbms_lob.getlength(IMAGE),0),0,null,
'<img '||
'src="'||
apex_util.get_blob_file_src('P1_PHOTO',username)||
'" height="75" width="75" alt="Product Image" title="Product Image" />')
detail_img
from user_image
P1_PHOTO is the upload item on page 1. My report is on another page. The image is not displayed in the report. Any ideas would be appreciated.Hi Charlie69,
Go the Report Attributes -> BLOB Column -> Number / Date Format. Below this attribute you will find
the link BLOB Download Format Mask which will open a dialog to fill in following information:
1) Format Mask: IMAGE
2) BLOB Table: Name of the table where to find the required BLOB
3) BLOB Column: Table column name where you stored the actual BLOB
4) Primary Key Column 1: Primary key of the table where BLOB is stored
5) Primary Key Column 2:
6) MIME Type Column: (Table column name where you stored the required information about BLOB)(Type: VARCHAR2)
7) Filename Column: (Table column name where you stored the required information about BLOB)(Type: VARCHAR2)
8) BLOB Last Updated Column: (Table column name where you stored the required information about BLOB)(Type: DATE)
9) Character Set Column: (Table column name where you stored the required information about BLOB)(Type: VARCHAR2)
10) Content Disposition: Inline(If you want to show it in the browser)
11) Download Link Text: (Not necessary when you want to show image)
I have set the format mask accordingly and the image is displayed in my report.
Hope it helps!
Regards,
Kiran -
How to import images into BLOB datatypes
Dear All,
I'm trying to import image into BLOB table type.I'm executing this SQL commands but found error.
ORA-22288
ORA-06512
Please help me i'll be thank full.
Regards
FAHEEM LATIF
CREATE OR REPLACE DIRECTORY images AS 'C:\IMAGES';
CREATE TABLE test007 (column1 BLOB);
DECLARE
l_bfile BFILE;
l_blob BLOB;
BEGIN
INSERT INTO test007 (column1)
VALUES (empty_blob())
RETURN column1 INTO l_blob;
l_bfile := BFILENAME('IMAGES', 'MyImage.gif');
DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);
COMMIT;
END;
/I know your original pl/sql routine contained a COMMIT, but did you use the same code with the COMMIT? If not, are you checking the table from a different session?
I ran your same code and it worked without issues. Are saying if you do a SELECT COUNT(*) from test007 it returns zero rows? -
How to display images from BLOB column via APEX 4.0
Hello,
I did the following in order to display images of two Oracle records on the APEX page. I am using APEX Version : 4.0.1.00.03 , Oracle DB Version : 10.2.0.4.0.
1. Created An oracle table TEST_FORM
with 3 columns
( ID number, MIME_TYPE varchar2(255) , Image BLOB )
2. Inserted two records
10001, image/gif, ( actual image1)
10002, image/gif, ( actual image2)
3. created an Oracle procedure
CREATE OR REPLACE PROCEDURE show_my_form ( p_image_id IN test_form.id%type) AS
l_mime test_form.mime_type%type;
l_length NUMBER;
l_file_name VARCHAR2 (2000);
lob_loc test_form.IMAGE%type;
BEGIN
SELECT mime_type, IMAGE
, DBMS_LOB.getlength (IMAGE)
INTO l_mime, lob_loc, l_length
FROM test_form
WHERE id = p_image_id;
owa_util.mime_header(l_mime, false);
htp.p ('Content-length: ' || l_length);
owa_util.http_header_close;
wpg_docload.download_file (lob_loc);
END show_my_form ;
4. In Apex 4.0
step1. Created an interactive report on a new APEX page
step2. Specified the following in the Region Source
select id, mime_type, '<img src="#OWNER#.show_my_form ?p_image_id=#ID#" />' photo
from TEST_FORM
The column result shows as <img src="CCS.show_my_form?p_image_id=#ID#" />
I am unable to display the column image as a link to a proper image photo.
Could you please advise me if I missed anything ?
Thanks a lot.
Regards
Susanna
Edited by: user10318332 on 13/12/2010 15:51
Edited by: user10318332 on 13/12/2010 20:10Maybe the space you have before the ? is causing issues. there shouldn't be any space.
Your procedure looks to be much the same of one that I have.
Have you granted execute on your procedure?
Also, what version DB are you running? This could be another issue: http://daust.blogspot.com/2006/04/xe-calling-stored-procedures.html
But anyway, you don't need to create your own procedure these days. You could do the following:
in your query, have a column: dbms_lob.getlength(blob) photo ; save, then in column attributes for that column, apply a format mask. There is usually a link below the text box for the format mask - BLOB Download Format Mask, which will help you build the format mask. But it is documented here: http://download.oracle.com/docs/cd/E17556_01/doc/user.40/e15517/advnc.htm#BCGGJHEF
Ta,
Trent -
How to store images in BLOB field in MySql database using java
Hi....
Currently am able to store character string into BLOB using byte array....in MySql.
but i cannot store images or pictures.......
to do this.........please help me out...............
Thanx..........:)Bye...........Hello,
I have done this for Oracle but it should be similar in MySQL also. Try reading thru these links below. Mail us if you have succeeded or not.
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=654086
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=384768
http://forum.java.sun.com/thread.jspa?forumID=48&threadID=549705
Thanks and regards,
Pazhanikanthan. P -
How to retrieve image in BLOB in oracle database using JSP?
do any one the method to view image in homepage using jsp from BLOB field in oracle database ?
thx<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Bon BOn:
do any one the method to view image in homepage using jsp from BLOB field in oracle database ?
thx<HR></BLOCKQUOTE>
I am using a servlet that retrieves the BLOB from the database, sets the MIME type and puts it in a stream. The code is :
package TestQueryITM;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.driver.OracleDriver;
import oracle.jdbc.driver.*;
public class MIMEServlet extends HttpServlet {
DbConnect myDbBean = new DbConnect();
int Id=6;
String MIME ="plain/text";
public void init(ServletConfig config) throws ServletException
super.init(config);
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException
try
String content_type = new String();
String filename = new String();
// Load the Oracle JDBC driver:
Class.forName("oracle.jdbc.driver.OracleDriver");
// Connect to the database:
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@ORAVISION:1521:DEV","[username]", "[password]");
// It's faster when auto commit is off:
conn.setAutoCommit (false);
// Create a Statement:
Statement stmt = conn.createStatement ();
try
BLOB lob_loc = null;
java.io.InputStream in = null;
int pos = 0;
int length = 0;
OracleResultSet rset = (OracleResultSet) stmt.executeQuery (
"SELECT text FROM test WHERE ID = "+Id);
if (rset.next())
lob_loc = ((OracleResultSet)rset).getBLOB(1);
MIME=rset.getString(2);
// File binaryFile = new File("C:/aantekeningen.doc");
// FileInputStream in = new FileInputStream(binaryFile);
in = lob_loc.getBinaryStream();
// This loop fills the buf iteratively, retrieving data // from the InputStream:
res.setContentType (application/pdf);
res.setHeader ("Content-Disposition","attachement;filename=test.doc");
ServletOutputStream op = res.getOutputStream ();
byte[] buffer = new byte[32000];
while ((in != null) && ((length = in.read(buffer)) != -1))
// the data has already been read into buf
System.out.println("Bytes read in: " +
Integer.toString(length));
op.write(buffer,0,length);
op.flush();
op.close ();
in.close();
stmt.close();
conn.commit();
conn.close();
}catch (SQLException e)
e.printStackTrace();
}catch(Exception e)
System.out.println("<BR>");
e.printStackTrace();
System.out.println("<BR>");
public String getServletInfo() {
return "TestQueryITM.MIMEServlet Information";
null -
hi all,
I am trying to save an image (blob) into oracle. When i try this i am getting following error.
java.sql.SQLException: ORA-01465: invalid hex number
BLOB blob = BLOB.createTemporary(con , false, BLOB.DURATION_SESSION);
String dir = "C:\\opt\\temp";
File binaryFile = new File(dir+"/"+filename);
FileInputStream instream = new FileInputStream(binaryFile);
OutputStream outstream = blob.setBinaryStream(1L);
int size = blob.getBufferSize();
byte[] buffer = new byte[size];
int length = -1;
while ((length = instream.read(buffer)) != -1)
outstream.write(buffer, 0, length);
instream.close();
outstream.close();
System.out.println("blob:>>>>>>"+blob);
String sqlText =
"INSERT INTO test_fileupload (filename, blobfile) " +
" VALUES('" + filename + "','" + outstream + "')";
st.executeUpdate(sqlText);
con.commit();In the above Insert statement i tried with "blob" insted of "outstream" still same but when i try with the string "3s34se"
it is inserting into database..
I am new to blob can any one explain me why is like that.
Thanq in adv.
Edited by: Ajayuppalapati on Nov 21, 2008 4:40 PMORA-01465: invalid hex number
[http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=3&t=012434]
[http://forums.sun.com/thread.jspa?threadID=261091&forumID=31] -
How to attach image, screen shot or excel table to master vendor copy.
Hi,
Please let me know how to attach an image or excel table into "header text" table. This has to be printed and sent to the customer. We use SAP GUI to create purchase orders.
Thanks in advance.
KushalPast the code into the post and then click on the post preview tab to check to see if the image rendered...it should show, if not, then either the code wasn't copied properly or the wrong embedding code was used.
That will provide a link to the image in separate browser window or tab. But if you place a "!" (an exclamation mark) at either end of the link (with no spaces or quotation marks), the image will then be displayed inline, within your post. -
How can I Insert a BLOB into a Table from Java?
I have a Java class that creates an xml file from data in a non-sql data source. After it successfully creates and saves the file it inserts a record into an Oracle table to log the fact that an xml file was created.
Now the guy in the warehouse wants to get an email with the file attached. I have been looking into the apex_mail package, because we already have a procedure using htmldb_mail. However, that procedure is on our old server with HTMLDB 1.6 and it is not sending any attachments.
I think I have most of the apex_mail worked out, but I'm stuck on the blob thing. This is what I have so far:
* The Java program creates a String object called xmlDoc
* After xmlDoc is fully constructed, the file is written to the (Linux) server. This is accomplished with the following:
// writing the xmlDoc
fileDest = "/home/ewh/XMLOUT/";
fileName = "OrderEW_"\+orderNbr\+"_"\+ticketNbr\+".xml";
FileWriter fstream = new FileWriter(fileDest+fileName);
BufferedWriter out = new BufferedWriter(fstream);
out.write(xmlDoc);
out.close();
* Next I insert a record into the log file with:
// Add a record to the Oracle order_email table to let the mail process know that
// a new xml file is ready to be e-mailed to operations.
emailLogInsertQuery = " insert into ewh.order_email ( file_name, create_date ) ";
emailLogInsertQuery += " values ('"\+fileName\+"', sysdate)";
oraAction = oraStmt.executeUpdate( emailLogInsertQuery );
All of this is working fine so far. Now, I have added a blob type field to the order_email table, but I have no idea what to stick in there so that I have everything that apex_mail.add_attachment needs.
Here's a description of the order_email table:
SQL> desc ewh.order_email;
Name Type Nullable Default Comments
FILE_NAME VARCHAR2(30) Y
FILE_BLOB BLOB Y
CREATE_DATE DATE Y
SEND_DATE DATE Y
Thanks ever so much,
Gregory
Edited by: Canis Polaris on Jun 10, 2009 2:10 PM - Added escapes as necessary to show the plus signs around Java variables.Hi,
From within APEX one can enter blob data in database tables, view the data and also update the data. Also one can send a blob attachment in an email.
May be you can follow a combination of the following OBEs to insert BLOB data and send BLOB data from APEX:
http://www.oracle.com/technology/obe/apex/apex31nf/apex31blob.htm
http://www.oracle.com/technology/obe/apex/apex31nf/apex31email.htm
-Priyanka -
Hi all,
How to display image from the database table in the adobe form by using web dynpro abap?
I want to display image in the adobe interactive form by using web dynpro abap.
Please help me.
Regards,
sriniHi Srini,
If you go through the article you might have seen the following piece of code
*** Send the values back to the node
lo_el_z_if_test_cv->set_static_attributes(
EXPORTING
static_attributes = ls_z_if_test_cv ).
" here ls_z_if_test_cv has the image in XSTRING format which has beeen retrived using METHOD get_bds_graphic_as_bmp of CLASS cl_ssf_xsf_utilities
" In your case you need to just use the select query n fetch it from your table; ( provided your image is store in XSTRING format )
How is your image stored in your database table ?
Regards,
Radhika. -
How can i store image into blob field in oracle express ??
Hi
am using oracle express *(2.1)* , i am devloping a small system , we have to store an image in blob filed in a table, we have to create a form which allow the user to store the image in the table and to generate a report contains the image
any note's please
tahnk's in advance
sam
Edited by: user485341 on Dec 22, 2008 1:28 AMhi Andy
this is the code for download
create or replace PROCEDURE download_my_file(p_file in number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
SELECT MIME_TYPE, BLOB_CONTENT, FILE_NAME,DBMS_LOB.GETLENGTH(BLOB_CONTENT)
INTO v_mime,lob_loc,v_file_name,v_length
FROM A_IMAGES
WHERE IMAGE_ID = p_file;
owa_util.mime_header( nvl(v_mime,'application/octet'),FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment;
filename="'||replace(replace(substr(v_file_name,instr(v_file_name,'/')+1)
,chr(10),null),chr(13),null)|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end download_my_file;
thank's -
How to load an image into blob in a custom form
Hi all!
is there some docs or how to, load am image into a database blob in a custom apps form.
The general idea is that the user has to browse the local machine find the image, and load the image in a database blob and also in the custom form and then finally saving the image as blob.
Thanks in advance
SoniIf this helps:
Re: Custom form: Take a file name input from user.
Thanks
Nagamohan -
How do i insert multiple blob files in Stored procedure using c#?
i want to add multiple blob files to a stored procedure at one go.Thus i have a 2 dimensional byte array consisting of multiple blob files.How to i add this 2 dimensional array to stored procedure?
Hi Jeff,
I haven't tried to insert multiple images at a time, but have done it for single image at a time and composed article on it : BizTalk
Server 2010: How to Insert Image In SQL Through Orchestration and sample can be found at :
BizTalk Server 2010: How to Insert
Image In SQL Through Orchestration sample.
I hope it helps.
Maheshkumar S Tiwari|User
Page | http://tech-findings.blogspot.com/
Maybe you are looking for
-
Can I boot a pulled hard drive from a Mac Pro on an external dock?
I have a 2008ish Mac Pro that has a dead video card and a few other problems. Luckily, the hard drive is still functioning. Is it possible to pull the drive and boot it using an external dock in order to image the drive so I can use it on another c
-
Images do not appear in Safari (eBay, blogspot)
I'm having problems viewing images in Safari on eBay (on the search results pages the occasional photo appears but often nothing at all - actual item pages show up fine) and blogspot websites (sometimes it's ok, but most of the time nothing shows up)
-
How is the storage type for a component picked automatically in PO staging
Hi The Process cycle is : Sales Order created MRP-Planned Order ---Production Order Problem : Transfer Requirement not created for Picking Now if I go to Co03--GOTOWM Pick list , For the component the storage type is notr updated automatically I comp
-
Hey, I just re-installed Photoshop CS6 (Can't have CC im still on vista), and im stuck with Camera Raw 7 which can't read my camera's raw files. I don't wanna mess with the Dng Converter. I simply want to at least update my camera raw to the version
-
i copied itune music from old hard drive to memory disk the copied onto new hard drive into itunes and music wont play unless removalbe disk is inserted