MM.MySQL uses the table name provided by MySQL itself to produce the query for updatable result sets, so it appears as if MySQL server is returning the wrong table name for your query.
-Mark Original message: ---------------------------------------------------------- From: "Alan Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: Problem with JDBC2 driver across databases Date: Thu, 25 Apr 2002 15:10:58 +0100 Message-ID: <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello. There appears to be a problem when using the JDBC driver on a foreign database (i.e. not your "current" database). MySQL version is : 3.23.49-max-debug JDBC version is : mm.mysql-2.0.4-bin.jar Consider the following situation: use sales; create table contacts (uid integer, name varchar(30)); ... use sales_demo; select * from sales.contacts where ...; This behaves as expected; the rows are shown. Now try this in JDBC to insert a new row into sales.contacts. Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/sales_demo"); PreparedStatement ps = conn.prepareStatement("select uid, name from sales.contacts where uid = ?", ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ps.setInt(1, 42); ResultSet rs = ps.executeQuery(); if (!rs.next()) { rs.moveToInsertRow(); rs.setInt(1, 42); rs.setString(2, "Fred Bloggs"); rs.insertRow(); } An SQLException is reported saying that table "sales_demo.contacts" does not exist. It should be inserting into table "sales.contacts". --Alan --------------------------------------------------------------------- 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