Problems inserting a Word doc in an Oracle database
Hi folks...
I have a method that successfully inserts a .gif file into an Oracle 8i database table that has a column that accepts files of the type BLOB. Below is part of it to give you an idea:
db.conn.setAutoCommit(false);
File file = new File(imageFile.getPath());
FileInputStream fis = new FileInputStream(file);
File mydoc = new File(imageFile.getPath());
FileInputStream fid = new FileInputStream(mydoc);
PreparedStatement pstmt = db.conn.prepareStatement("INSERT INTO blob_table VALUES (?, ?)");
pstmt.setString(1, mydoc.getName());
pstmt.setBinaryStream(2, fid,(int)mydoc.length());
pstmt.executeUpdate();
pstmt.close();
fid.close();
blob_table has two columns only: first is a VARCHAR2 for the name of the file, second is a BLOB for blob files.
When I tried using the same method to insert a word doc it doesn't work.
Can anyone tell me why? And if you have sample code that does what I want to achieve can you share it?
Thanks!
Thanks for your reply.
When I insert .gif files JDeveloper ends with a message saying "Process exited with exit code 0". I then go and check in the database and I find the image added to the table.
With a word doc, JDeveloper does not give that message. No message at all regarding what the status of the process is. And the document is not added to the database. No error messages too. Could this be an issue with Oracle?
Similar Messages
-
Strange problem when opening word doc situated in WLS virtual dir
Hi all,
we have a strange problem when opening word doc
situated in C:\Oracle\Middleware\as_1\forms\webutil
we put some word docs there and tried to open from forms using for example web.show_document('http://wp0606:9001/forms/webutil/mug00103.doc', '_blank');
no problem using FF, however in IE8 the word doc is shown in its binary format, this also happens when we try to open the doc in IE8
however when we google and search for instance for a test.doc and then click on this url a file save dialog is shown
that's why we believe that this might be due to a configuration issue of WLS
any help would be greatly appreciated
Kr
MartinI think you have 2 ways to go here. Figure out what html is from wherever weblogic gets it, meaning you have to delve into the docs, snoop
around in directories and find what it must be sending (This is going to be unavoidable if you are going to change what weblogic is doing.
Sooner or later you have to try to figure out where it gets this stuff from)
or
you can experimentally snoop on your url with a tool like wget or curl. These are fundamental web tools.
The latter is always a useful thing to be able to do. (you need to formulate a query to get the content-type).
Whoever managed to get weblogic to serve any files in the first place probably can figure this out. -
I'm having a problem sending a word doc via email. I have Mac for Office 08, and I'm using Mavericks OS. When I save the document as a .doc or .docx, and send it to someone, (doesn't matter if its safari, chrome or firefox or on my yahoo or gmail accounts) they receive it as a blank document. Yet, when I open it on my Mac, it has a "word" icon and I can read it. How do I fix?
I suggest you post on the Microsoft Mac forums since it's their software you're having issues with.
http://answers.microsoft.com/en-us/mac -
How To Store pdf or doc file in Oracle Database using Java Jdbc?
can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.
Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
for Adding PDF in DB i used image.jsp
Database table structure (table name. pictures )
Name Null? Type
ID NOT NULL NUMBER(11)
IMAGE BLOB
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file =
new File("D:/info.pdf");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
if(i!=0){
out.println("<h2>PDF inserted successfully");
else{
out.println("<h2>Problem in image insertion");
catch(Exception e){
out.println("<h2>Failed Due To "+e);
%>
O/P: PDF inserted successfully
i tried to display that pdf using servlet. i am giving the code below.
import java.io.IOException;
import java.sql.*;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DispPDF extends HttpServlet {
* The doGet method of the servlet. <br>
* This method is called when a form has its tag value method equals to get.
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setContentType("text/html"); i commented. coz we cant use response two times.
//PrintWriter out = response.getWriter();
try{
InputStream sPdf;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
ResultSet rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
//out.println(bytearray);
int size=0;
sPdf = rs.getBinaryStream(1);
response.reset();
response.setContentType("application/pdf");
while((size=sPdf.read(bytearray))!= -1 ){
//out.println(size);
response.getOutputStream().write(bytearray,0,size);
catch(Exception e){
System.out.println("Failed Due To "+e);
//out.println("<h2>Failed Due To "+e);
//out.close();
OP
PDF-1.4 %âãÏÓ 2 0 obj <>stream x+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
plz help me out. -
Problems importing a Word doc into Robohelp HTML
I have a 116-page Word document with 13 chapters. When I
import this document into Robohelp HTML as a winhelp output file,
only two topics are created, rather than 13. On the Conversion
Options window, I select to have new topics created by Word style
"Heading 1" which are my chapter titles. Why doesn't Robohelp
create the topics, and what should I change to faciliate that?
Also, why don't my numbered lists from Word stay numbered in
Robohelp? Is there a way to automate numbered lists?Thanks for your reply.
When I insert .gif files JDeveloper ends with a message saying "Process exited with exit code 0". I then go and check in the database and I find the image added to the table.
With a word doc, JDeveloper does not give that message. No message at all regarding what the status of the process is. And the document is not added to the database. No error messages too. Could this be an issue with Oracle? -
Insert OLE Word doc not showing all pages
Hi All,
I'm running a test on this before I get all involved in it.
I insert a multi page Word doc into my report.
When I run it, it only shows the first page.
That's the first problem.
When I export it as a Word doc, it exports only that page
and now it's become a non editable graphic.
I need it to be exportable to Word and editable.
That's the second problem.
Am I attempting the impossible ?
Thank you,
JimmyHi Jamie,
Thanks for your reply.
We have a Word document that gets sent out to about 400 schools.
I'm trying to take some of the redundancy out of the task by inserting
Institution Name
Director
Address
etc on the header of the document so that my colleges
won't have to look up each school, find the director, address,
etc and manually type it all in. Then the report gets exported
to Word, where further editing is done.
Also, the tables that they have built in Word must also
retain their integrity, being imported into AND being exported
from Crystal, as a Word document.
I could do this easily, and have, using text boxes, etc. Problem
is, it has to be done in Word. (That's what they're use to working with
Oh, my set up is:
Crystal 11.5
Stand alone desktop, no network. (Just me and the lone prairie ...)
Am I expecting too much ?
Thanks for the 3rd party info. That explains a lot.
Jimmy -
Problem in OWB: connecting to a non-oracle database
Good day,
i'm working on a windows 32 bit machine,i have Oracle database , OWB 11.2.0.1 installed on it
i'm trying to make OWB connect to a "Sybase" source database on another server , using ODBC
i've tested the connection from SQLPLUS and it's working perfectly
but when i test the connection from OWB locations , it gives me this error:
"ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[OpenLink][ODBC][SQL Server]Statement(s) could not be prepared (0)
{42000}[OpenLink][ODBC][SQL Server]"DUAL" not found. Specify owner.objectname
or use sp_help to check whether the object exists (sp_help may produce lots of
output).
(208) {42S02,NativeErr = 208}
my questions are :
-why would OWB check for DUAL table on a sybase database? is that a bug in OWB?
-can i bypass this step and just import metadata from the sybase source database? (i tried importing,but OWB performs the same test before importing)Hi Chris,
I haven't tried it, and these are just some of my thoughts, but I
think you would need to load the JDBC driver for the other database
into the Oracle database (using the "loadjava" tool, of-course).
Then your java stored procedure should be able to instantiate the
third party JDBC driver and obtain a connection to the other database.
Hope this helps.
Good Luck,
Avi. -
Inserting MS WORD DOC into Oracle
HI,
Can someone help me in storing word document from local hard disk(windows C:\UploadFolder) into Oracle Table.
I'm trying the following code:
to create a directory----
create or replace directory MY_FILES as 'C:\Uploadfolder'
table----
Create table emp1(
id number(10),
name varchar2(30),
details BLOB)
code for inserting----
declare
f_lob bfile;
b_lob blob;
begin
insert into emp1(id,name,details)
values ( 170353, 'JOHN',empty_blob() )
return details into b_lob;
f_lob := bfilename( 'MY_FILES', 'details1.doc' );
dbms_lob.fileopen(f_lob, dbms_lob.file_readonly);
dbms_lob.loadfromfile
( b_lob, f_lob, dbms_lob.getlength(f_lob) );
dbms_lob.fileclose(f_lob);
commit;
end;
The error I'm getting is----------
declare
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.DBMS_LOB", line 504
ORA-06512: at line 10
Please help me!!!!
Thanks,
SanketWelcome to the forum!
create directory maps to a directory on the database server, not your local. You need to use a client application to upload documents to the database. -
Whenever I insert a symbol (from Webdings, etc.) as a bullet or just an insert, it looks fine on my copy, however, when I send the document to someone else they tell me it shows up as a weird looking character, like a little number inside a circle. It has happened with several symbols I've used. Anyone know what the problem could be? Thanks!
pinkfins wrote:
Whenever I insert a symbol (from Webdings, etc.) as a bullet or just an insert, it looks fine on my copy, however, when I send the document to someone else they tell me it shows up as a weird looking character
Webdings and wingdings are non-standardized in terms of how they should be encoded and thus subject to the kind of problem you have encountered. Best to use dingbats or other symbols found in the non-private-use ranges of Unicode in your Character Viewer. -
Insert PDF or Doc file to the Database from Frontend
Hi
I am in ISB company working with Oracle 9iDS. The scenario is to me that I would like to insert some document files(especially Pdf formated files) to the database.
I can use Read_Image_file. but that is used for the image file to bring the image file from physical location to my application, how it is for PDF?
and how can i save it in the database?
thanks
farhadSo are you saying you want to load a file from the pc/client to the database - then you can use webutil.
see otn.oracle.com/products/forms
Regards
Grant Ronald
Forms Product Management -
Problems with special characters uploading data into oracle database
Greetings
I have a problem uploading data into oracle tables from sybase datasource. The data that I want to upload is in Spanish, for example when I have a varchar field with the data 'Consultoría', in oracle table the data upload with interrogation symbols.
I have my source and target datastores configured as follows.
Any suggestion? Thank you for your timeChack section 10 Locales and Multi-byte Functionality in the SAP Data Services Reference Guide for an exhaustive description of NLS settings.
As a summary, following settings are required:
locales in the datastore definitions match the actual locale used in the associated databases
the locale of the DS engine allows for source to target translation
the character set in the target database supports storage of accented characters -
Automatically complete a word template using the oracle database
I have a Microsoft office word template and I would like to automatically complete some fields using data from my Oracle 10g database. For example where I have the text “Dear Mr.” I want to get the name of that person from a table in the database. Also by pressing a button in Oracle forms I want to open the word document to see the result. Any ideas how to do that? Thank you.
Message was edited by:
FlomasterHello,
There are lot of code pertaining to your requirement(OLE) in forms forum,a search will give you the required code.
Regards
Mohan -
MS Word documents in forms/oracle database
How does one store a word document in the database. Should be able to store the binary file and be able to retrieve it by launching MS word. Can we use BLOB. If so how to store a file into a BLOB column and how to retrieve that when required in forms 6i?
I do not want to use OLE.
Any help will be greatly appreciated.
TIA,
TapasUse long raw datatype. And use OLE concepts through application
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Unknown:
If u have a solution, let me know, I am also facing the same problem
Regards
<HR></BLOCKQUOTE>
null -
Problem while inserting Date/Time in Oracle Database
Hai,
i want to insert the date and time in a date column. here, i am using java.sql.Date and java.sql.Time to assign the date in Prepared Statement.
PreparedStatement psmt=con.prepareStatement("insert into test(ex_date) values(?)");
java.util.Calendar c=Calendar.getInstance();
c.set(2002,2,21,10,10,00);
java.sql.Date d=new Date(c.getTime().getTime());
java.sql.Time t=new Time(c.getTime().getTime());
psmt.clearParameters();
psmt.setDate(1,d);
psmt.setDate(1,t);
psmt.executeUpdate();
Above program is inserted the Date and time in the database as the following "1900/2/21 10:10 AM"
but i am giving the year as 2002. it inserted the year as 1900. what is the problem with the code?
please let me know
Thanks in advance.
Regards
sankarjune14Hai Franco,
i put the wrong code. Here, is the Original Code.
PreparedStatement psmt=con.prepareStatement("insert into test(ex_date) values(?)");
java.util.Calendar c=Calendar.getInstance();
c.set(2002,2,21,10,10,00);
java.sql.Date d=new Date(c.getTime().getTime());
java.sql.Time t=new Time(c.getTime().getTime());
psmt.clearParameters();
psmt.setDate(1,d);
psmt.setTime(1,t); // Last time i put psmt.setDate(1,t);
psmt.executeUpdate();
and, the getTimeInMillis() method is a protected method in java.util.Calendar class. how can we use it
please give me some other idea to insert the date and time in oracle database.
Thanks in advance
sankarjune14 -
Problems importing Word Doc footnotes/endnotes into Dreamweaver CS4
I am having a problem importing a Word doc with footnotes/endnotes into Dreamweaver. When I do the import (or a copy and paste) I get the references without the actual number for the endnotes in superscript!
I currently have Dreamweaver CS4 (though have also experienced this issue with Dreamweaver 8)
I am currently using Word 2007 (but experienced this same problem with earlier versions of Word).
The document has a standard sort of endnote. In the middle of the text there is a number in superscript that refers to a note at the end. When I do an import I get the nice set of back and forth references with anchors and links but missing the number! Let me copy and paste an example:
Here is the text I have:
the largest multilateral recipient of UK aid,[i] with the UK
[i] DFID (2010) DFID in 2009-10.
Now here is the HTML I get when I import:
the largest multilateral recipient of UK aid,<a href="#_edn1" name="_ednref1" title="" id="_ednref1"> </a> with the UK
And as an endnote:
<div id="edn1">
<p><a href="#_ednref1" name="_edn1" title="" id="_edn1"> </a> DFID (2010) <em>DFID in 2009-10</em>.</p>
</div>
<div id="edn2">
What I really need is:
the largest multilateral recipient of UK aid,<a href="#_edn1" name="_ednref1" title="" id="_ednref1"><sup>1</sup></a> with the UK
And as an endnote:
<div id="edn1"><p><a href="#_ednref1" name="_edn1" title="" id="_edn1"><sup>1</sup></a> DFID (2010) <em>DFID in 2009-10</em>.</p>
</div> <div id="edn2">
Does anyone know why these superscript numbers are missing? And how I can get Dreamweaver to put them in. I have long documents with 50 or more footnotes and would hate to have to redo this by hand!The problem is that some of the material in the endnote/footnote is explanatory in nature rather than just a reference or citation. So I need a way to include explanatory text and don't want to put multiple sentences in ( ) in the middle of the text.
I would have to say clearly someone at Adobe did think conversion of endnotes/footnotes is a worthwhile endeavour, because Dreamweaver is designed to do it! You can see clearly from the code snippet that they programmed Dreamweaver to do an import with a very nice set of back and forth anchor references. Just somehow the actual reference numbers don't show up. In fact the HTML code for this provided by Dreamweaver is very clean and nice (contradicting bemdesign's assertion that you can not turn a word doc into a good HTML doc), with the exception of the missing number references!
Is there a setting somewhere that I might need to play with to get this to work better?? Or something I need to do with the Word doc text before I do an import? Any other work around.
Maybe you are looking for
-
Primary Key & Logical Key in Hierarchy
Am a bit confused with the primary key in Dimensions..... 1. Can anyone explain the use of Primary key and the criteria to define the primary key for a level if the level has more than one level keys.... 2. If a level has more than 2 logical keys and
-
Since installing OS 10.5 and subsequently updating to 10.5.1 I have experienced choppy sound in all applications. VLC, DVD Player, Windows Media Player, iTunes, everything. And those apps that use sound skip because of the sound loading problem as we
-
How can I connect my mac to the school server? It doesn't seem to "see it"
-
Hi, Can anyone please tell me serial number data goes to which table (not view or structure) at the time of Sales order delivery creation... I need to find out the latest Sales order number with the input of serial number of material... Thanks, Yuvni
-
Why does the copy/move command cause the application to freeze up?
The move/copy command causes the application to freeze up. I am using PSE8