| Author |
Insert BLOB into a DB
|
Esteban Cairol
Greenhorn
Joined: Aug 18, 2006
Posts: 6
|
|
Hello! Im having a problem when trying to insert a blob type variable into the Data Base (MySQL 4.1). In fact, the exception triggers when the the p.setBlob() is done, where p is the PreparedStatement. Some details you may want to know before read the error: - Im using Hibernate to convert from FormFile to Blob. I didn't install Hibernate complete on my application, in fact, I just put the hibernate3.jar on the classpath to use this converting function. Its not used for anything else. - Im using Java 4.1 and Apache Tomcat 4.1 The exception is this: The code: Method that creates the connection. Function registrarArchivo (this is like.. "uploadFile") That line with the * is where the app is breaking. Finally, the setBlob method: Please, if you could help me I'll appreciate it a lot..! Thanks! [ July 14, 2007: Message edited by: Esteban Cairol ]
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 23628
|
|
Esteban, I'm going to move this to our Hibernate forum. Since the stack trace has Hibernate classes in it, I think people will be more likely to know the answer there.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
|
 |
Esteban Cairol
Greenhorn
Joined: Aug 18, 2006
Posts: 6
|
|
Originally posted by Jeanne Boyarsky: Esteban, I'm going to move this to our Hibernate forum. Since the stack trace has Hibernate classes in it, I think people will be more likely to know the answer there.
Ok.. thanks!
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Im using Hibernate to convert from FormFile to Blob. I didn't install Hibernate complete on my application, in fact, I just put the hibernate3.jar on the classpath to use this converting function. Its not used for anything else
Hmm. Sounds like a dodgy thing to do - there's probably more going on in the Hibernate class than a simple bean. Could you not just use a byte array?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Esteban Cairol
Greenhorn
Joined: Aug 18, 2006
Posts: 6
|
|
Originally posted by Paul Sturrock: Hmm. Sounds like a dodgy thing to do - there's probably more going on in the Hibernate class than a simple bean. Could you not just use a byte array?
Thanks for answering Paul. What I have to do is to insert a file into the Data Base. It could be an image, or other type of files.. I haven't found another way to do that than using a byte array (I mean, a BLOB). If you know other way to do that, it would be great. Thanks!
|
 |
 |
|
|
subject: Insert BLOB into a DB
|
|
|