Thread View: comp.databases.oracle.misc
1 messages
1 total messages
Started by Andreas Stroeber
Mon, 29 Nov 2004 16:26
JSP & Oracle InterMedia
Author: 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads