Storing Word, Excel, Image files in Oracle 8i database
How do I insert MS Word, MS Excel, and image files in Oracle 8i db. Do I need to use Developer Forms for using this functionality. If I am trying to insert data in Oracle through Java Servlets, what SQL should I use for inserting BLOB/LOB in Oracle database.
Vidhyut,
Check out the documentation on how to use JDBC to access/manipulate LOBs at http://download-west.oracle.com/otndoc/oracle9i/901_doc/appdev.901/a88879/adl03p10.htm#241526.
Regards,
Geoff
Similar Messages
-
Can i use pandrive with iPad, i want to access word, excel, pdf files on iPad via pandrive
You cannot use pendriver.
Have a look at the following:
http://itunes.apple.com/sg/app/quickoffice-pro-hd-edit-office/id376212724?mt=8&l s=1
http://itunes.apple.com/sg/app/office2-hd/id364361728?mt=8&ls=1
http://itunes.apple.com/sg/app/documents-to-go-premium-office/id317107309?mt=8&l s=1
http://itunes.apple.com/sg/app/polaris-office/id513188658?mt=8&ls=1 -
How to insert an image file in Oracle database
hi
can you please tell me how to insert an image file into oracle database????
suppose there is one image file in c:\pictures\rose.jpg. how to insert that file into database? theoretically i know that will be BFILE type but i dont know how to insert that.
will be waiting for your reply........
thanks & regards,
PriyatoshHello,
The easiest way to load a blob is to use SQL loader.
This example comes from the utilities guide:
LOAD DATA
INFILE 'sample.dat'
INTO TABLE person_table
FIELDS TERMINATED BY ','
(name CHAR(20),
1 ext_fname FILLER CHAR(40),
2 "RESUME" LOBFILE(ext_fname) TERMINATED BY EOF)
Datafile (sample.dat)
Johny Quest,jqresume.txt,
Speed Racer,'/private/sracer/srresume.txt',
Secondary Datafile (jqresume.txt)
Johny Quest
500 Oracle Parkway
Secondary Datafile (srresume.txt)
Loading LOBs
10-18 Oracle Database Utilities
Speed Racer
400 Oracle Parkway
regards,
Ivo -
How to insert a image file into oracle database
hi all
can anyone guide me how to insert a image file into oracle database now
i have created table using
create table imagestore(image blob);
but when inserting i totally lost don't know what to do how to write query to insert image fileHi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
out.println(" <input type='submit' name='submit' value='Submit' class='smalltext'>");
out.println("</form>"); Import this once you have the jar file:
import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
boolean result = true;
String fileName = null;
byte fileData[] = null;
String fileUploadError = null;
String imageType = "";
String error = "";
DiskFileUpload fb = new DiskFileUpload();
List fileItems = fb.parseRequest(request);
Iterator it = fileItems.iterator();
while(it.hasNext()){
FileItem fileItem = (FileItem)it.next();
if (!fileItem.isFormField()) {
fileName = fileItem.getName();
fileData = fileItem.get();
// Get the imageType from the filename extension
if (fileName != null) {
int dotPos = fileName.indexOf('.');
if (dotPos >= 0 && dotPos != fileName.length()-1) {
imageType = fileName.substring(dotPos+1).toLowerCase();
if (imageType.equals("jpg")) {
imageType = "jpeg";
String filePath = request.getParameter("FILE_PATH");
session.setAttribute("filePath", filePath);
session.setAttribute("fileData", fileData);
session.setAttribute("fileName", fileName);
session.setAttribute("imageType", imageType);
return result;
} And now finally the method to actually write the file to the database:
private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
//If the previous code found a file that can be uploaded then
//save it into the database via a pstmt
String sql = "";
UtilDBquery udbq = getUser(request).connectToDatabase();
Connection con = null;
int signatureID = 0;
PreparedStatement pstmt = null;
try {
udbq.setUsePreparedStatements(true);
con = udbq.getPooledConnection();
con.setAutoCommit(false);
if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
pstmt = con.prepareStatement(sql);
ResultSet rs = pstmt.executeQuery();
while(rs.next()) {
signatureID = rs.getInt(1);
if (fileName != null && imageType != null) {
sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
InputStream is2 = new ByteArrayInputStream(fileData);
pstmt = con.prepareStatement(sql);
pstmt.setInt(1, signatureID);
pstmt.setBinaryStream(2, is2, (int)(fileData.length));
pstmt.executeUpdate();
pstmt.close();
con.commit();
con = null;
if(mode.equals("U") && signatureIDIn != 0) {
signatureID = signatureIDIn.intValue();
if (fileName != null && imageType != null) {
sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
InputStream is2 = new ByteArrayInputStream(fileData);
pstmt = con.prepareStatement(sql);
pstmt.setBinaryStream(1, is2, (int)(fileData.length));
pstmt.setInt(2, signatureID);
pstmt.executeUpdate();
pstmt.close();
con.commit();
con = null;
} catch (Exception e) {
con = null;
throw new Exception(e.toString());
return signatureID;
} -
Word/Excel 2003 Files with Actionscript/MXML
Hello Friends.
A Newbe question I would appreciate your guidance and support.
The question is: How can I manipulate (create, update, delete) MS Word Excel 2003 Files with Action Script and/or MXML?
Or is there no direct way, do you know about some library, component or extension that would allow me to do that using Action Script and/or MXML ?
Thanks in advance for your help.
Carlosif you're using the web, you'll need to have user's upload their files and you'll need to use server-side code to edit them and you'll need to use server-side code to create them. there's no way to delete files (thank goodness) from a web-based swf.
adobe air can be installed and work directly with the client's files but how and whether you can edit/create word/excel files is not likely without using a pre-built library and i don't know if anyone has built one. -
How to store txt file into Oracle 7 Database using Pro*C
Hi,
I want to store a txt file into Oracle 7 database table using
Pro*C application. But do not know what type of column to use.
At first glance it appeared to me as LONG can serve the purpose
but later I noticed that I can not do the sequential read/write
in LONG type of column. That is, I have to use chunks of max of
2GB (or file lenght) to read/write into such columns.
I want something simiar to CLOB of Oracle 8.
I would appreciate if you can provide me solution.
Thanks,
AnuragYou store images in a BLOB column in the database.
However, inserting image in that column and displaying data/image from that column are 2 very different tasks.
If you are using Oracle forms, displaying is easy. Default block sitting on the table with BLOB column, can be easily mapped to image box (or similar control), which will display that image.
Inserting images will be a different ball game. If your forms are web based (i.e. run from browser) and you want to insert images from client machine, some special arrangements are required.
If images are on database server and you want to insert them in database, the stored procedure given in the earlier thread (posted above) will do the job. -
Upload and displaying document file and image file with oracle portal
Dear All,
Could anyone please tell me how to displaying document file and image file that I've stored to database (8.1.7) using oracle portal. (I use intermedia data type).
I've tried to follow the instruction given by Oracle LiveDemo, but it came with failure. (the image or document won't show up).
Thanks for support.
MozaPlease repost this question in the appropriate section of the Discussion Forum.
This forum is for general suggestions and feedback about the OTN site. For technical question about an Oracle product,
For customers with paid support (Metalink) please go to:
http://www.oracle.com/support/metalink -
How to open and show a word, excel, ppt file in Adobe AIR application?
Dear All,
I have a requirement to open a MS- word/ Excel file in the AIR application.
On click of a brows button a file reference box opens...on any file
selection...it should open in the application itself...
so plz let me know the solutions u have...Here is your basic issue: setting a classpath (and presumably compiling and executing a program) is one of the most basic, fundamental concepts in Java. I would advise you to follow JVerd and Annie's links and get started on a tutorial. Try writing a simple HelloWorld application before delving into POI. When you are more comfortable writing and compiling programs, and post a specific question, it will be much easier to help you.
- Saish -
How to add an image file to Oracle db?
Need help urgently....Anybody knows how to add an image file (example: jpg)into one of the fields in Oracle database??
This will do the job..
package forum;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import oracle.jdbc.driver.*;
//import oracle.sql.*;
Wanneer een request.getInputStream wordt geconferteerd naar een "String" (zie later) dan ziet de output in tekstformaat er als volgt uit:
-----------------------------7d280152604f4 Content-Disposition: form-data; name="oploadfile"; filename="C:\WINNT\Profiles\mvo\Desktop\boodschap.txt" Content-Type: text/plain Deze boodschap dient te worden ge-insert in de database. -----------------------------7d280152604f4 Content-Disposition: form-data; name="StadID" 1234 -----------------------------7d280152604f4 Content-Disposition: form-data; name="SuccessPage" /forum/error.jsp -----------------------------7d280152604f4--
of opgesplitst
contentType........... multipart/form-data; boundary=---------------------------7d235ade00f0
filename.............. "C:\Documents and Settings\Administrator\Desktop\boodschap.txt"
MIME type............. text/plain
Wat in database moet.. Dit is de eigenlijke boodschap die moet worden ge-insert in de database.
Eind boundary......... -----------------------------7d235ade00f0 Content-Disposition: form-data; name="file1"; filename="" Content-Type: application/octet-stream -----------------------------7d235ade00f0--
We gaan achtereenvolgens:
1. Kijken of het van het "multipart/form-data" type is (uploaden) en strippen van eerste boundery.
1.a Geen "multipart/form-data" ? dan... error message
1.b Groter dan MAX_SIZE ?..dan .. error message
2. Filenaam van de te uploaden file uitlezen
3. Mimetype bepalen en bepalen in welke positie van de string het Mimetype ophoudt, cq waar te uploaden file begint
4. Bepalen waar eind boundery begint
5. De eigenlijke file uitlezen
6. Terug converteren naar bytes
public class WriteBlob extends HttpServlet {
public static final int MAX_SIZE = ParameterSettings.imageUpload;
String successMessage = "";
public void init(ServletConfig config) throws ServletException {
super.init(config);
* Process the HTTP Get request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
DataInputStream in = null;
FileOutputStream fileOut= null;
PrintWriter out = response.getWriter();
int kb_size = 0;
boolean pass2 = true;
String message = "";
String responseRedirect = "/forum/uploaden.jsp?message="+" Uploaden geslaagd";
try
//get content type of client request
String contentType = request.getContentType();
// Start stap 1...content type is multipart/form-data
if(contentType != null && contentType.indexOf("multipart/form-data") != -1)
//open input stream
in = new DataInputStream(request.getInputStream());
//get length of content data
int formDataLength = request.getContentLength(); // totale lengte van de inputstream
//initieer een byte array om content data op te slaan
byte dataBytes[] = new byte[formDataLength];
//read file into byte array
int bytesRead = 0;
int totalBytesRead = 0;
int sizeCheck = 0;
while (totalBytesRead < formDataLength)
//kijken of de file niet te groot is
sizeCheck = totalBytesRead + in.available();
if (sizeCheck > MAX_SIZE)
pass2 = false;
message = "Sorry. U kunt slechts bestanden uploaden tot een grootte van 500KB";
responseRedirect = "/forum/uploaden.jsp?message="+message;
bytesRead = in.read(dataBytes, totalBytesRead,formDataLength);
totalBytesRead += bytesRead;
if (pass2==true)
kb_size = (int)(formDataLength/1024);
//create string from byte array for easy manipulation
String file = new String(dataBytes);
/*get boundary value (boundary is a unique string that separates content data)
contentType........... multipart/form-data; boundary=---------------------------7d235ade00f0
int lastIndex = contentType.lastIndexOf("=");
String boundary = contentType.substring(lastIndex+1, contentType.length());
// Stap 2.....bepaal de naam van de upload file
// filename.............. "C:\Documents and Settings\Administrator\Desktop\boodschap.txt"
String saveFile = file.substring(file.indexOf("filename=\"")+10);
saveFile = saveFile.substring(0,saveFile.indexOf("\n"));
saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+1,saveFile.indexOf("\"")); //naam van de file...boodschap.txt
String saveFileName = saveFile;
// Stap 3..Bepaal MIME Type en de positie van eind mime type in string
voorbeeld: -----------------------------7d23d21220524 Content-Disposition: form-data; name="file0"; filename="C:\WINNT\Profiles\mvo\Desktop\z clob.txt" Content-Type: text/plain
String restant = "";
int pos; //position in upload file
// bijv .. filename="C:\Documents and Settings\Administrator\Desktop\boodschap.txt"
pos = file.indexOf("filename=\"");
//find position of content-disposition line
pos = file.indexOf("\n",pos)+1; // eing file naam + spatie
// onderstaand geeft bijv Content-Type: text/plain
restant = file.substring(pos,file.indexOf("\n",pos)-1);
restant = restant.substring(restant.indexOf(":")+2,restant.length()); // MIME type
String mimeType = restant;
//find position of eind content-type line
pos = file.indexOf("\n",pos)+1;
//find position of blank line
pos = file.indexOf("\n",pos)+1;
int start = pos;
// Stap 4 eind boundary
/*find the location of the next boundary marker (marking the end of the upload file data)*/
int boundaryLocation = file.indexOf(boundary,pos)-4; //waarom -4 ..? ziet er uit als linebreak spatie--boundary=-----------------------------7d21c9ae00f0
// Stap 5 en 6..de eigelijke te uploaden file in nieuwe byte file inserten
byte dataBytes2[] = new byte[boundaryLocation-start]; //declareren
for (int i=0;i<(boundaryLocation-start);i++) // inserten BELANGRIJK !!
dataBytes2=dataBytes[start+i];
String next_id = "0";
Statement statement = null;
Connection conn = null;
boolean pass = true;
ResultSet rs = null;
Statement stmt_empty = null;
oracle.sql.BLOB blb = null;
try
int vendor = DriverUtilities.ORACLE;
String username = ConnectionParams.userName;
String password = ConnectionParams.passWord;
String connStr = DriverUtilities.makeURL(vendor);
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection(connStr,username, password);
if (conn==null){pass=false;}
} catch (Exception e){out.println("<P>" + "There was an error establishing a connection:");}
if (pass==true)
try
String seq_nextval ="select forum_blob_seq.nextval from dual";
statement = conn.createStatement();
ResultSet rset = statement.executeQuery(seq_nextval);
while (rset.next())
next_id = rset.getString(1);
if (next_id.equals("0"))
message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
responseRedirect = "/forum/uploaden.jsp?message="+message;
pass = false;
} catch (Exception e1) { out.println("Error blob1 : "+e1.toString()); };
} // end pass
if (pass==true)
try
Statement stmt2 = conn.createStatement();
String insert_empty_blob = "INSERT INTO test_blob(id "+
",filename "+
",mimetype "+
",kb) "+
"VALUES("+Integer.parseInt(next_id) +
",'"+saveFileName+"'"+
",'"+mimeType+"'"+
","+kb_size+")";
stmt2.executeQuery(insert_empty_blob);
conn.commit();
if (stmt2!= null) {stmt2.close();}else{stmt2.close();pass = false;}
} catch (Exception e2){
message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
responseRedirect = "/forum/uploaden.jsp?message="+message;
out.println("<P>" + "2. There was an error inserting mime type:");}
} //end pass
if (pass==true)
try
conn.setAutoCommit(false);
} catch (Exception e3) { pass = false; out.println("Error blob 3: "+e3.toString()); };
} //end pass
if (pass==true)
try
String Query_blob ="Select test_blob FROM test_blob where id="+next_id+" FOR UPDATE";
stmt_empty = conn.createStatement();
rs=stmt_empty.executeQuery(Query_blob);
} catch (Exception e4) {
pass = false;
out.println("Error blob 4: "+e4.toString());
message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
responseRedirect = "/forum/uploaden.jsp?message="+message;};
} //end pass
if (pass==true)
try
if (rs.next())
blb = ((OracleResultSet)rs).getBLOB(1);
OutputStream stmBlobStream = blb.getBinaryOutputStream();
try {
int iSize = blb.getBufferSize();
byte[] byBuffer = new byte[iSize];
int iLength = -1;
ByteArrayInputStream stmByteIn = new ByteArrayInputStream(dataBytes2);
try {
// while ( (iLength = in.read(byBuffer, 0, iSize)) != -1 )
while ( (iLength = stmByteIn.read(byBuffer, 0, iSize)) != -1 )
stmBlobStream.write(byBuffer, 0, iLength);
stmBlobStream.flush();
} // end while
} catch (Exception e5) {
pass=false;
out.println("Error blob 5: "+e5.toString());
message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
responseRedirect = "/forum/uploaden.jsp?message="+message; }
finally { conn.commit(); }
} catch (Exception e6) { out.println("Error blob 6: "+e6.toString()); };
} //end if rs.next()
else { throw new SQLException("Could not locate message record in database."); }
} catch (Exception e7) { out.println("Error blob : "+e7.toString()); };
} // end pass
} // end pass2
else //request is not multipart/form-data
message = "Uploaden mislukt !...Gegevens niet verstuurd via multipart/form-data.";
responseRedirect = "/forum/error.jsp?message="+message;
out.println("Request not multipart/form-data.");
catch(Exception e)
try
//print error message to standard out
out.println("Error in doPost: " + e);
//send error message to client
out.println("An unexpected error has occurred.");
out.println("Error description: " + e);
}catch (Exception f) {}
response.sendRedirect(responseRedirect);
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
Regards
Martin -
How do I get Safari to automatically open Word, Excel, Etc. files?
I can't get Safari to automatically open Word, Excel, Powerpoint, etc. files when I click on them from a Web site or Web-based email. They are automatically downloaded, but not opened. PDF files, and other "safe" file types, open automatically. The ""Open safe files after downloading" box is checked.
Any Suggestions? Thanks.
- jcorroonThere is no glitch. Lion does support Office and Word. You can use Office 2008 or 2011.
Regards
TD -
How to fetch the image file from oracle database and display it.
hi... i've inserted the image file into the oracle database... now i want to retreive it and want to display it... can anybody help me... pls
not a big deal dude... i fetched the image from database and saved it into my local hard disk.. but when tried to open it,ends up with no preview... dont know what d prob is... any idea... i've inserted the image as bytes n trying to fetch it as binary stream.. is that the problem... here im giving my insertion and retireving code.. jus go through it...
Insertion code:_
* To change this template, choose Tools | Templates
* and open the template in the editor.
package PMS;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Blob;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class Browse_java
static Connection con=null;
public static void main(String args[])
try{
System.out.println("(browse.java) just entered in to the class");
con = new PMS.DbConnection().getConnection();
System.out.println("(browse.java) connection string is"+con);
PreparedStatement ps = con.prepareStatement("INSERT INTO img_exp VALUES(?,?)");
System.out.println("(browse.java) prepare statement object is"+ps);
File file =new File("E:/vanabojanalu-/DSC02095.JPG");
FileInputStream fs = new FileInputStream(file);
System.out.println("lenth of file"+file.length());
byte blob[]=new byte[(byte)file.length()];
System.out.println("lenth of file"+blob.length);
fs.read(blob);
ps.setString(1,"E:/vanabojanalu-/DSC02095.JPG");
ps.setBytes(2, blob);
// ps.setBinaryStream(2, fs,(int)file.length());
System.out.println("(browse.java)length of picture is"+fs.available());
int i = ps.executeUpdate();
System.out.println("image inserted successfully"+i);
catch(Exception e)
e.printStackTrace();
finally
try {
con.close();
} catch (SQLException ex) {
ex.printStackTrace();
and Retrieving code is:
* To change this template, choose Tools | Templates
* and open the template in the editor.
package PMS;
import java.beans.Statement;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.servlet.*;
import javax.servlet.http.*;
import oracle.jdbc.OracleResultSet;
* @author Administrator
public class view_image2 extends HttpServlet {
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("image/jpeg");
//PrintWriter out = response.getWriter();
try
javax.servlet.http.HttpServletResponse res=null;;
int returnValue = 0;
Connection con = null;
PreparedStatement stmt = null;
ResultSet rs = null;
InputStream in = null;
OutputStream os = null;
Blob blob = null;
//String text;
//text=request.getParameter("text");
//Class.forName("com.mysql.jdbc.Driver");
con=new PMS.DbConnection().getConnection();
System.out.println("jus entered the class");
//String query = "SELECT B_IMAGE FROM img_exp where VC_IMG_PATH=?";
//conn.setAutoCommit(false);
PreparedStatement pst = con.prepareStatement("select b_image from img_exp where vc_img_path=?");
System.out.println("before executing the query");
pst.setString(1,"C:/Documents and Settings/Administrator/Desktop/Leader.jpg");
rs = pst.executeQuery();
//System.out.println("status of result set is"+rs.next());
System.out.println("finished writing the query");
int i=1;
if(rs.next())
System.out.println("in rs") ;
byte[] byte_image=rs.getBytes(1);
// byte blob_byte[]= new byte[(byte)blob.length()];
//System.out.println("length of byte is"+blob_byte);
//String len1 = (Oracle.sql.blob)rs.getString(1);
//System.out.println("value of string is"+len1);
//int len = len1.length();
//byte [] b = new byte[len];
//in = rs.getBinaryStream(1);
int index = in.read(byte_image, 0, byte_image.length);
System.out.println("value of in and index are"+in+" "+index);
FileOutputStream outImej = new FileOutputStream("C://"+i+".JPG");
//FileOutputStream fos = new FileOutputStream (imgFileName);
BufferedOutputStream bos = new BufferedOutputStream (outImej);
//byte [] byte_array = new byte [blob_byte.length]; //assuming 512k size; you can vary
//this size depending upon avlBytes
//int bytes_read = in.read(blob_byte);
bos.write(index);
/*while (index != -1)
outImej.write(blob_byte, 0, index);
index = in.read(blob_byte, 0, blob_byte.length);
//System.out.println("==========================");
//System.out.println(index);
//System.out.println(outImej);
//System.out.println("==========================");
/*ServletOutputStream sout = response.getOutputStream(outImej);
for(int n = 0; n < blob_byte.length; n++) {
sout.write(blob_byte[n]);
sout.flush();
sout.close();*/
outImej.close();
//i++;
else
returnValue = 1;
catch(Exception e)
System.out.println("SQLEXCEPTION : " +e);
finally {
//out.close();
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
* Returns a short description of the servlet.
public String getServletInfo() {
return "Short description";
// </editor-fold>
} -
Cannot read image file in oracle 10g forms, getting error frm-47100
I'm unable to read the image from the file location. But If I do re-save via MS-Paint the same image then I'm able to load successfully. I want to load image directly instead of re-save. Error getting like "frm-47100 Cannot read image file".
Need your co-operation to solve this issue.
Thanks in advance!
declare
tiff_image_dir varchar2(80):=('D:\IMAGE\');
photo_filename varchar2(80);
begin
photo_filename:=tiff_image_dir||:IMAGE_NO||'.JPG';
if :image_no is null then
:Image_no :=:UID_NO;
end if;
read_image_file(photo_filename,'JPG','image');
WRITE_IMAGE_FILE('output.tif','TIFF','g_image_info.image',maximize_compression,original_depth)
end;Hi Sindhu,
By default any operating system file extension starts after the dot. So in this case when it says 2 dots it will think there is something wrong.
RajeshALex -
How to store image files in oracle DB
Hi,
I am new to working with database.
Please let me know how to store image files in Database using insert command.
Thanks,
Ramesh Yakkala.Hi,
You need to create a directory object to import these files:
Take a look on the example below:
eg:
CREATE TABLE MY_IMAGE_TABLE (
ID NUMBER,
NAME VARCHAR2(20),
IMAGE BLOB);
CREATE OR REPLACE DIRECTORY IMAGES AS '/tmp';
GRANT READ, WRITE ON DIRECTORY IMAGES TO PUBLIC;
CREATE OR REPLACE PROCEDURE load_file_to_my_table (p_file_name IN MY_IMAGE_TABLE.NAME%TYPE) AS
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO MY_IMAGE_TABLE (id, name, image)
VALUES (1, p_file_name, empty_blob())
RETURN doc INTO v_blob;
v_bfile := BFILENAME('IMAGES', p_file_name);
Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
Dbms_Lob.Fileclose(v_bfile);
COMMIT;
END;
SQL> execute load_file_to_my_table('myfhoto.jpg');Cheers -
Storing data from XML files in Oracle DB
Hi!
I just started to work with XML and need to save data from XML files into Oracle database. I tried to run sample from Oracle web site. The code was following:
public class xmlwritedb
public static void main(String args[]) throws SQLException
String tabName = "EMP"; // Table into which to insert XML data
String fileName = "emp.xml"; // XML document filename
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Initialize a JDBC connection
Connection conn =
DriverManager.getConnection("jdbc:oracle:oci8:scott/tiger@");
// Insert XML data from file (filename) into
// database table (tabName)
OracleXMLSave save = new OracleXMLSave(conn, tabName);
URL url = save.createURL(fileName);
int rowCount = save.insertXML(url);
System.out.println(" successfully inserted "+rowCount+
" rows into "+ tabName);
conn.close();
But it does not work.
OracleXMLSave object does not see file name.
Please, help me solve this problem. Also,where is it possible to find any documentation on oracle.xml.* classes API.
Thank you.
Maya.
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by sudeepk:
If a java exception is thrown probably during ur install u might have forgotten
grant javauserpriv to scott;
grant javasyspriv to scott;
Thanks
[email protected]
<HR></BLOCKQUOTE>
Thank you!!! -
Exporting of files in oracle 10g database
hey friends,
I installed Oracle 10g Database server on Windows XP,when i tried to take the backup through "Export to Files".I got this error.
I have added Administrator in "Login as Batch JOb" and has given administrator along with the password in host credentials.
I explain the procedure.I Login as Sys as SysOper as Oracle does not allow to take backup as sysdba.
I created the job and also given the right path for the backup but some how it fails then i check the log and i find the following output.
Output Log
Export: Release 10.1.0.2.0 - Production on Fri Mar 4 16:39:23 2005
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Username:
EXP-00004: invalid username or password
Username: Password:
EXP-00004: invalid username or password
Username:
EXP-00030: Unexpected End-Of-File encountered while reading input
EXP-00000: Export terminated unsuccessfully
The output log says i am giving invalid username and password but i don't know where i am giving the invalid username and password.
Please guide me as I am new to Oracle and want to learn Oracle Administration.
Thanks & Regards
AnkushGive me output of following on standby server
SQL>select name from v$datafile;
SQL>show parameter log_archive_dest
Maybe you are looking for
-
Inspection lot at deadline monitoring
Hi all, I've a question about the deadline monitoring function in SAP. I want to create an inspection lot when the batch is about to expire. Here are a couple of assumptions: - We use batch status management - inspection type 09 active in material ma
-
Warning:Null charecters(00H) contained in the file was replaced with spaces
Hi, i am creating dat file in that at the end of each line i am adding 10 spaces(i.e 00a0) and end of line charecter, than sending to FTP server, but when i am opening file it is giving warning message : Null charecters(00H) contained in the fil
-
LMS3.2/UT: Bad entries in Switch port report Reclaim UP
Hi, Customer has bad entries when he works with Switch port report Reclaim UP: if it takes older than 5 days, he has many records, most of them (about 15500 !!!) are from 2010/11/8, some from 2010/11/9 (about 60) and some from 2010/11/10 (about 300)
-
My ipod mini si not working and I can't find the answer.
My ipod mini is not working. I have done all the R things. It won't switch on unless I toggle the hold key, once switched on it asks me to choose a language but pressing the select button does nothing. Can it be saved or should I throw it in a heap w
-
DG4ODBC configured and working but receiving ORA-28528 for some columns
DG4ODBC is configured and working for XE 11gR2 but under some circumstance receiving SQL Error: ORA-28528: Heterogeneous Services datatype conversion error. Configuration: DG4ODBC configured for Oracle 11gR2 using ODBC datasource based on IBM UniVers