Heikki Tuuri wrote:
Ryan,----- Original Message ----- From: "rcandersonmn" Newsgroups: mailing.database.mysql Sent: Thursday, October 31, 2002 4:23 PM Subject: Prepared Statement Problem >I'm new to MySQL and am having problems with Prepared Statements in >MySQL. I'm using the latest MySQL beta version, Innodb, and the latest >JDBC driver. Here is what I'm trying to do: > > >Connection con = x.getConnection(); /* gets the connection > >PreparedStatement ps = con.prepareStatement(sql); /* set up prepared >statement > >x.bindExampleWhere(ps, example); /* sets the preparedstatement's >variables > >ResultSet rs=ps.executeQuery(); > > >The SQL is: >select * from Vendor >where (Vendor.agreement_id = ?) > >The BindExample will produce: >(1,'1001') > > >The result set is always empty. When I run the query directly, I get >the expected result.
You don't say how you determine the result set is empty, which might be where your problem is. Also, I would like to see what the code in ".bindExampleWhere()" actually does.
[snip]
If you are running with
SET AUTOCOMMIT = 0
and inserted the row during the current read transaction, then it might also
be that you are reading too old a snapshot. The transaction doing the SELECT
can issue a COMMIT to refresh the snapshot.
Heikki has a good point here, as this confuses many people who are not used to using transactions under a REPEATABLE_READ isolation level.
I haven't replied to the original sender, as his e-mail has been stripped from the original mail :(
-Mark
sql,query
--
For technical support contracts, visit https://order.mysql.com/?ref=mmma
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mark Matthews <[EMAIL PROTECTED]>
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
/_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
<___/ www.mysql.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php