Client 4—An Interactive Query Processor

Now, let's move on to the final JDBC client. As in previous chapters, we'll wrap up by looking at an application that processes arbitrary commands entered by the user.

Listing 13.9 shows the client4.main() method.

Listing 13.9. client4.java (Part 1)
 1 // 2 // File: client4.java 3 // 4 5 import java.sql.*; 6 import java.io.*; 7 8 public class client4 9 { 10 static String blanks = " "; 11 static String dashes = "-----------------------------------"; 12 13 public static void main( String args[] ) 14 throws SQLException 15 { 16 Class driverClass = loadDriver( "org.postgresql.Driver" ); 17 18 if( driverClass == null ) 19 return; 20 21 if( args.length != 1 ) 22 { 23 System.err.println( "usage: java client4 ...

Get PostgreSQL, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.