Bonjour à tous,
J'utilise jdbc pour effectuer des insertions dans une table qui contient un champ de type LONBLOB. J'insère donc des fichiers dans la table. J'utilise le code suivant :
Je n'ai pas de soucis pour les petits fichier, mais avec des fichiers volumineux, j'obtiens l'erreur suivante sur la console :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 InputStream stream = obj.getInputStream(); PreparedStatement pstmt = connection.preparedStatement("INSERT INTO file(file_id,name, body) VALUES( ?, ?, ?)"); int len = obj.getFileSize(); pstmt.setNull(1, attachId); pstmt.setString(2, attachName); pstmt.setBinaryStream(3, stream, len); pstmt.executeUpdate(); stream.close();
HTTP JVM: JVMDUMP013I Processed dump event "systhrow", detail "java/lang/OutOfMemoryError".
HTTP JVM: Exception in thread "AgentThread: JavaAgent"
HTTP JVM: java.lang.OutOfMemoryError
HTTP JVM: at
HTTP JVM: com.mysql.jdbc.Buffer
HTTP JVM: .
HTTP JVM: ensureCapacity
HTTP JVM: (
HTTP JVM: Buffer.java
HTTP JVM: :
HTTP JVM: 1
HTTP JVM: 2
HTTP JVM: 3
HTTP JVM: )
HTTP JVM: at
HTTP JVM: com.mysql.jdbc.PreparedStatement
HTTP JVM: .
HTTP JVM: fillSendPacket
HTTP JVM: (
HTTP JVM: PreparedStatement.java
...
Avez-vous une idée svp ? Peut on insérer de gros fichiers avec jdbc ?
Merci.
Partager