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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.