Does following codes work in your JDBC driver and/or database server?
Posted in 1998
This is a multi-part message in MIME format. --------------AEDE7D5FE6D5BA9C8993F273 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit The following code is print a list of tables in a database. It works fine with Connecting Software Type 4 FastForward JDBC driver, Sybase SQL Server 10/11. But it not work with Weblogic Type 4 jdbcKona/Informix4 JDBC driver, Informix Dynamic Server 7.3x. Also not works with jdbc-odbc bridge, MS-Access neither. I don't have MS SQL Server (you can use Connecting Software Type 4 FastForward JDBC driver or Weblogic Type 4 jdbcKona/MSSQLSERVER JDBC driver). And I don't have Oracle 7/8, Type 4 Oracle thin JDBC driver. Can you test following code for me? Thanks! try { driverName = "connect.sybase.SybaseDriver"; url = "jdbc:ff-sybase://database.host.name:2025/database_name"; uid = "myname"; passwd = "mypasswd"; Driver driver = (Driver) Class.forName(driverName).newInstance(); Properties p = new Properties(); p.put("user", uid); p.put("password", passwd); Connection con = driver.connect(url, p); DatabaseMetaData db = con.getMetaData(); ResultSet result = db.getTables("database_name", "database_owner", "%", null); while (result.next()) { System.out.println(result.getString(3)); } con.close(); } catch (SQLException e) { System.err.println("SQL Error"); } catch ( Exception e ) { e.printStackTrace(System.out); } -- RC Square Team. --------------AEDE7D5FE6D5BA9C8993F273 Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf" Content-Transfer-Encoding: 7bit Content-Description: Card for Chui /Chen, Raymond/Ruiming Content-Disposition: attachment; filename="vcard.vcf" begin: vcard fn: Raymond/Ruiming Chui /Chen n: Chui /Chen;Raymond/Ruiming org: RC Square adr: ;;;;;;U.S.A. email;internet: rctwo@erols.com title: CS tel;work: 301-498-8959 tel;fax: 301-498-8959 tel;home: URL http://www.erols.com/rctwo/ note: Raymond Chui & Ruiming Chen Company x-mozilla-cpt: ;0 x-mozilla-html: TRUE version: 2.1 end: vcard --------------AEDE7D5FE6D5BA9C8993F273--