On Nov 21, 2007, at 6:42 AM, Javi Muriel Zafra wrote:

> Hi.
>
> I'm working with molecules in an application, and I want to store  
> them in a database. So, I would like to know how I can to store a  
> molecule what I have in a Molecule (or AtomContainer) object. The  
> type in which I store the molecule in the database table is a Long  
> Row, so I need to use the method PreparedStatement.setBinaryStream  
> (JDBC).
>
> To read a molecule from de db I use the following code:
>
> ResultSet rset = stmt.executeQuery(" .... ");
>
> ...
>
> IChemObjectReader reader = new ReaderFactory().createReader(
>
> rset.getBinaryStream("structure"));
>
> ChemObject cmol = (ChemObject) reader.read( new  
> org.openscience.cdk.Molecule());
>
> IAtomContainer iaTemp = (IAtomContainer) cmol;
>
> I've tried to "reverse" the code to adapt for write a molecule, but  
> I've not obtained it. Any idea??

You could store molecules in a variety of ways

* SMILES
* SDF
* a binary object (Postgres+Tigress supports this)

On the hand, it looks like you want Java object serialization. See  
http://www.devx.com/tips/Tip/12439 for an example

-------------------------------------------------------------------
Rajarshi Guha  <[EMAIL PROTECTED]>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04  06F7 1BB9 E634 9B87 56EE
-------------------------------------------------------------------

Q: What is a dyslexic, agnostic, insomniac?
A: Someone who lays awake at night wondering if there really is a dog!



-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to