13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

338Chapter 15Accessing the Data: An Introducti<strong>on</strong> to JDBCIf you are working with a database other than mySQL or Oracle, youmight want to check out http://servlet.java.sun.com/products/jdbc/drivers for a list of approximately two hundred JDBC implementati<strong>on</strong>s forvarious databases.15.10EXERCISES1. Write a program that c<strong>on</strong>nects to a database and, for each of the tablesspecified <strong>on</strong> the command line, prints out the table name and the numberof rows in that table.2. Using what has been covered in this chapter, write a simple n<strong>on</strong>-GUI SQLprogram, allowing the user to enter SQL statements, executing them, andshowing the results (like a simplified SQL/Plus program). Can you providesome simple editing of the SQL? Or can you implement escaping to anexternal editor, for example, vi?3. Make it possible for the user of your SQL program to set and change thec<strong>on</strong>necti<strong>on</strong> URL—via an envir<strong>on</strong>ment variable, command-line parameter,or even from within the program. Your SQL program will then be able toquery a variety of databases from various vendors.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!