Article View: comp.databases.oracle.misc
Article #37JSP & Oracle InterMedia
From: Andreas Stroeber
Date: Mon, 29 Nov 2004 16:26
Date: Mon, 29 Nov 2004 16:26
97 lines
4181 bytes
4181 bytes
Hi NG,
I have got a (big?) problem with Oracle Intermedia.
What i want to do is:
1. Get a PDF File that was sent via form POST on a html page.
2. Save this PDF to the database.
3. Search the database for keywords and get results when the keyword
exists in the pdf file.
I know that this should work with intermedia and Java Server Pages
(JSP). My first problem at the moment is: How to save the PDF file into
the database?
Mainly i have the problem that needed functions are not present in the
java.sql classes and are missing in the oracle.sql pendant, too.
Although the guide i have mentions i should use these functions. Perhaps
anyone has a working solution for this and could post it here?
I am working with Oracle 9i and Java 1.4 and the 9i intermedia
extensions for java on a tomcat.
Attaching the code. I'll try to shorten it as much as possible...
Th explicit data format casts result from attempts to use different
classes that might work. neither one worked till now.
:: BEGIN CODE ::
Connection connection = null;
OracleResultSet resultset = null;
String query = "";
boolean fehler = false;
OrdHttpUploadFormData formdata = new OrdHttpUploadFormData(request);
formdata.parseFormData();
OrdHttpUploadFile pr_steckbrief =
formdata.getFileParameter("pr_steckbrief");
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
connection = DriverManager.getConnection(db_url, username, password);
connection.setAutoCommit(false);
Statement statement = connection.createStatement();
query = "INSERT INTO projekte_data (nummer, titel, beginn, ende, pl,
beschreibung, steckbrief) VALUES (" + pr_nummer+ ", " + pr_titel+ ", " +
pr_start+ ", " + pr_ende + ", " + pr_projektleiter + ", " +
pr_beschreibung + ", ORDSYS.ORDOC.INIT() )";
statement.executeQuery(query);
query = "SELECT steckbrief FROM projekte_data WHERE nummer = " +
pr_nummer + " FOR UPDATE";
resultset = (OracleResultSet)statement.executeQuery(query);
resultset.next();
OrdDoc media = (OrdDoc)resultset.getCustomDatum(1, OrdDoc.getFactory());
pr_steckbrief.loadBlob(media);
//formdata.release();
PreparedStatement pstat = (PreparedStatement)
connection.prepareStatement("UPDATE projekte_data set steckbrief = ?
where nummer = ?");
pstat.setCustomDatum(1, media);
pstat.setString(2, pr_nummer);
pstat.execute();
resultset.close();
statement.close();
connection.commit();
} catch(ClassNotFoundException e) {
%> Fehler: <%= e %><%
System.err.println("Error loading driver: " + e);
} catch(SQLException e) {
%> Fehler: <%= e %><%
System.err.println("Error executing SQL-Statement: " + e);
} catch(Exception e) {
%> Fehler: <%= e %><%
System.err.println("Error: Unknown error");
} finally {
if (connection != null) {
connection.close();
}
}
:: END OF CODE ::
Thank you very much for your help!
AS
Technical Details
Message-ID:
<cofik3$c7g$5@mail1.sbs.de>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.stueberl.de!news.netplace.de!news-FFM2.ecrc.net!newsfeed1.sbs.de!news.fth.sbs.de!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: f99a8,8f4270e2cc18b406,start X-Google-Thread: f4be4,8f4270e2cc18b406,start X-Google-Thread: 107d46,8f4270e2cc18b406,start X-Google-Attributes: gidf99a8,gidf4be4,gid107d46,public X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!newsfeed.stueberl.de!news.netplace.de!news-FFM2.ecrc.net!newsfeed1.sbs.de!news.fth.sbs.de!not-for-mail From: Andreas Stroeber <andreas.stroeber@fthw.STOP_SPAM_siemens.TLDde> Newsgroups: comp.databases.oracle.misc,borland.public.jbuilder.servlets-jsp,comp.lang.java.databases Subject: JSP & Oracle InterMedia Followup-To: comp.lang.java.databases Date: Mon, 29 Nov 2004 17:26:43 +0100 Organization: Siemens Business Services Lines: 98 Message-ID: <cofik3$c7g$5@mail1.sbs.de> NNTP-Posting-Host: fu14286d.fthw.siemens.de Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: mail1.sbs.de 1101745603 12528 157.163.171.242 (29 Nov 2004 16:26:43 GMT) X-Complaints-To: abuse@siemens.de NNTP-Posting-Date: Mon, 29 Nov 2004 16:26:43 +0000 (UTC) User-Agent: Mozilla Thunderbird 0.9 (Windows/20041103) X-Accept-Language: en-us, en