Hello,
Oracle seems to need oracle.sql.BLOB type to be able to treat the BLOB
storing.
Which type is used by Castor ? And is there a way to manage it?
Could I make my mapping differently ?
<field name="fichier" type="bytes">
<sql type="blob" dirty="ignore" />
<bind-xml name="fichier" />
</field>
I tried this with mysql , but the results where very strange :
<field name="fichier" type="stream">
<sql type="blob" dirty="ignore" />
<bind-xml name="fichier" />
</field>
Sylvie.
___________________
CREDI RA
Sylvie Palluel
[EMAIL PROTECTED]
___________________
> -----Message d'origine-----
> De : SYLVIE PALLUEL [mailto:[EMAIL PROTECTED]
> Envoy� : mercredi 3 d�cembre 2003 11:30
> � : [EMAIL PROTECTED]
> Objet : [castor-dev] [castor-dev]Pb while Storing BLOB to
> Oracle Database
>
>
> Hello,
>
> I'm trying to store PDF files to BLOB column in an Oracle
> Database (Oracle 9i).
>
> I'm using a byte[] as attribut in my persistent class.
>
>
> It's ok in mysql, but in Oracle9i i have this exception :
>
>
> [java] [testCastor] java.sql.SQLException: Il n'y a plus
> de donn�es � lire dans le socket
> [java] [testCastor] at
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java(Compiled
> Code))
> [java] [testCastor] at
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java(Inlined
> Compiled Code))
> [java] [testCastor] at
> oracle.jdbc.dbaccess.DBError.check_error(DBError.java(Inlined Compiled
> Code))
> [java] [testCastor] at
> oracle.jdbc.ttc7.MAREngine.unmarshalUB1(MAREngine.java(Inlined
> Compiled
> Code))
> [java] [testCastor] at
> oracle.jdbc.ttc7.MAREngine.unmarshalSB1(MAREngine.java(Inlined
> Compiled
> Code))
> [java] [testCastor] at
> oracle.jdbc.ttc7.Oall7.receive(Oall7.java(Compiled Code))
> [java] [testCastor] at
> oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1894)
> [java] [testCastor] at
> oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.j
> ava:1094)
> [java] [testCastor] at
> oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleState
> ment.java:
> 2132)
> [java] [testCastor] at
> oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatem
> ent.java:2
> 015)
> [java] [testCastor] at
> oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(Oracle
> Statement.
> java:2877)
> [java] [testCastor] at
> oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(Oracl
> ePreparedS
> tatement.java:608)
> [java] [testCastor] at
> org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:625)
> [java] [testCastor] at
> org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:913)
> [java] [testCastor] at
> org.exolab.castor.persist.LockEngine.create(LockEngine.java:492)
> [java] [testCastor] at
> org.exolab.castor.persist.TransactionContext.create(Transactio
> nContext.j
> ava:883)
> [java] [testCastor] at
> org.exolab.castor.jdo.engine.DatabaseImpl.create(DatabaseImpl.
> java:366)
> [java] [testCastor] at
> scapin.test.TestBlob.ecritureBlob(Unknown Source)
>
>
>
> Here's a part of my persistent class :
>
> public class ProduitEdite {
>
> private int idProduitEdite;
> private String reference;
> private java.util.Date dateEdition;
> private byte[] fichier ;
>
> My table is :
> SQL> desc sca_produit_edite
> Name Null? Type
> ----------------------------------------- --------
> ----------------------------
> IDPRODUITEDITE NOT NULL NUMBER(10)
> REFERENCE VARCHAR2(20)
> DATEEDITION DATE
> CATEGORIE VARCHAR2(20)
> MODELE VARCHAR2(20)
> NOMBREOCTETS NUMBER(10)
> FICHIER BLOB
>
>
> My mapping file is :
>
> <class name="scapin.test.metier.donnees.produits.ProduitEdite"
> key-generator="MAX" identity="idProduitEdite">
> <cache-type type="none" />
> <map-to table="SCA_PRODUIT_EDITE" />
> <field name="idProduitEdite" type="integer" required="true">
> <sql type="integer" name="idProduitEdite" />
> <bind-xml name="idProduitEdite" />
> </field>
> <field name="reference" type="string">
> <sql type="char" name="reference" />
> <bind-xml name="reference" />
> </field>
> <field name="dateEdition" type="date">
> <sql type="date" name="dateEdition" />
> <bind-xml name="dateEdition" />
> </field>
> <field name="fichier" type="bytes">
> <sql type="blob" dirty="ignore" />
> <bind-xml name="fichier" />
> </field>
> </class>
>
> The program make this :
>
> produitEdite = new ProduitEdite();
> produitEdite.setReference("Ref1");
> URL pathFic = new URL("file:" +
> "/appdev/pie00/src/scapin2/scapin/editions/pdf/toto.pdf");
> FileInputStream fis = new FileInputStream(pathFic.getFile());
> InputStream is = fis;
> produitEdite.setNombreOctets(fis.available());
> bytes = new byte[produitEdite.getNombreOctets()];
> nbElts = fis.read(bytes);
> produitEdite.setFichier(bytes);
> db.create(produitEdite );
>
>
> Have you ever had the same problem ?
>
> Thanks for your help.
>
> Sylvie.
> ___________________
> CREDI RA
> Sylvie Palluel
>
> [EMAIL PROTECTED]
> ___________________
>
>
>
>
>
> **********************************************************************
> This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity
> to whom they are addressed. If you have received this email
> in error please notify the system manager.
>
> This footnote also confirms that this email message has been
> swept by MIMEsweeper for the presence of computer viruses.
>
www.mimesweeper.com
**********************************************************************
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev