Re: com.mysql.jdbc.UpdatableResultSet.updateBlob gives AbstractMethodError



pjvleeuwen@xxxxxxxxx wrote:
PreparedStatement pstmt = con
.prepareStatement("INSERT INTO `image` "
+ "(`house_id`, `image`) "
+ "VALUES(4, ?)");

Remember, prepareStatement() "[t]hrows ... SQLException ... if a database access error occurs or this method is called on a closed connection."

pstmt.executeUpdate();

This method call returns a value that you should not ignore, nor should you ignore the possible SQLException.

// read from DB
Statement readstmt = con
.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);

"Throws ... SQLException ... if a database access error occurs or this method is called on a closed connection"

ResultSet resultset = readstmt
.executeQuery("SELECT * FROM `image` " //
+ "WHERE `house_id` = 4;");

possible SQLException

resultset.first();

Why not call next(), and why, oh, why do you disregard the returned value?

--
Lew
.



Relevant Pages

  • SQL Connection Failure
    ... 1st error occurs twice and the 2nd error, which is an Access Error occurs, 1 ... this connection error occurs. ... SQLState '01000' ... SQL Sever Error: 2 ...
    (microsoft.public.sqlserver.connect)
  • VLC & Freebox
    ... i'have installed the vlc-devel in the port tree. ... VLC media player 0.8.6a Janus ... main access error: Connection to mafreebox.freebox.fr port 80 failed: Operation timed out ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Memory Leak in swing application (ImageIcon problem)
    ... private class Person extends Object { ... public void run{ ... java.sql.Connection con = ... I.E you fire your timer, do the random, which opens your connection. ...
    (comp.lang.java.gui)
  • Re: where should I dispose the connection ?
    ... Con variable points to the same connection object you created in ... connection was opened before closing it otherwise you'll get the exception ... Dim da As SqlDataAdapter ... >> Public Class Connection ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Row cannot be located for updating
    ... > result a recordset containing one row, ... > Strangly enough, the value that I changed, is changed in the database ... > Dim Con As New ADODB.Connection ... > 'Execute the query and remove the active connection ...
    (microsoft.public.data.ado)