O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SQLWarnings Versus SQLExceptions

Apache Derby can generate warnings in certain circumstances. A warning is generated if, for example, you try to connect to a database with the create attribute set to true, but the database already exists. Aggregates such as SUM() also raise a warning if null values are encountered during the evaluation. A warning will also being raised if an UPDATE or a DELETE statement affects no rows.

The following code uses a catch statement to capture any errors that occur during the execution of an UPDATE statement.

 try { conn = DriverManager.getConnection("jdbc:derby:YMLD"); s = conn.createStatement(); s.execute("UPDATE PRODUCTIONS SET PRODUCTION_NO = 10 WHERE PRODUCTION_NO = 0"); s.close(); } catch (SQLException se) { ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required