Thanks Jeff, I'll see if it fixes it. I've got round the problem in the meantime by opening two connections, one to each database, but that's a bit messy and shouldn't be necessary.
Incidentally, the MySQL page for JDBC (http://www.mysql.com/downloads/api-jdbc.html) still offers version 2.0.4 for download. Should this be updated? --Alan -----Original Message----- From: Jeff Kilbride [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 25, 2002 6:44 PM To: Alan Jones; [EMAIL PROTECTED] Subject: Re: Problem with JDBC2 driver across databases First, I would recommend upgrading to the latest release of mm.mysql -- which I think is 2.0.12. You can get the latest from sourceforge: http://mmmysql.sourceforge.net/ 2.0.4 is pretty old now. --jeff ----- Original Message ----- From: "Alan Jones" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, April 25, 2002 7:10 AM Subject: Problem with JDBC2 driver across databases > 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 > > > > > ------------------------------------------------------------ > Alan Jones, Senior Software Engineer > Yospace: Creating Value for Wireless > 7 The Courtyard, High Street, Staines, UK, TW18 4DR > Tel: +44 1784 466388 > Fax: +44 1784 466387 > http://www.yospace.com > > This email and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are addressed. > Any unauthorised dissemination or copying of this email or its attachments, > and any use or disclosure of any information contained in them, is strictly > prohibited and may be illegal. If you have received the email in error > please notify [EMAIL PROTECTED] and delete it from your system. > > > > --------------------------------------------------------------------- > 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 > --------------------------------------------------------------------- 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