Get Connection out of EOEditingContext or EOObjectStoreCoordinator [WO5.2.4]
"COAST" <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi List
how can you get the Connection (java.sql.DriverManager.getConnection()) out of
EOEditingContext or EOObjectStoreCoordinator or ...
We need the Connection cause we want to stream BLOB's in / out of ORACLE.
It seems that NSData isn't streaming BLOB's in / out of ORACLE but the following code is doing so:
public InputStream data_stream() throws Exception {
// get Primary Keys
String syDocumentBlobID = (String)((NSDictionary)EOUtilities.primaryKeyForObject(this.xtEditingContext(),this)).objectForKey("syDocumentBlobId").toString();
String query = "SELECT DATA FROM SY_DOCUMENT_BLOB WHERE SY_DOCUMENT_BLOB_ID = " + syDocumentBlobID;
// Register the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@10.0.21.105:1521:test", "scott", "tiger");
/*****************************************************
looking for some code lines to get con out of ec.
*/
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
InputStream is = null;
if (rs.next()) {
Blob b = rs.getBlob(1);
is = b.getBinaryStream();
}
rs.close ();
stmt.close ();
rs = null;
stmt = null;
con = null;
return is;
}
No we need the "bridge" between EOxy and java.sql for a nice solution not needing the passwd and connection string,
but I have no clue where this "bridge" is to find.
Thanks for any help
Peter
_______________________________________________
WebObjects-dev mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/webobjects-dev