/* ' Copyright by Erica Andrews aka CyLiKoN JeZuZ aka Li'L CJ, ' December 1999. No one is permitted to implement this Java class ' or any portion of it on their site without the express written consent ' of the author (cylikon@hotmail.com - ./IcedPinky/). ' All rights reserved. ' This class was hand-coded in by Erica on Dec. 24,1999 ' It simply lists (as links) all the sites in one table of my database. ' The servlet uses the ' gweMySQLJDBC 0.9.2 driver (rather than the JDBC-ODBC bridge) ' and MySQL 3.22.9 for database connectivity. It's NOT an applet, just ' a simple command-line class. */ import java.sql.*; import java.io.*; class ListAll { public static void main (String args []) throws SQLException, ClassNotFoundException { // Load the GWE Mysql JDBC driver Class.forName ("gwe.sql.gweMysqlDriver"); Connection conn = DriverManager.getConnection ("jdbc:mysql://:3306/siteindex2","guest","guest"); // Create a Statement Statement stmt = conn.createStatement (); // Select all columns from the thesites table ResultSet rset = stmt.executeQuery ("select * from thesites"); // Iterate through the result and print the records while (rset.next ()) { String id=rset.getString(1).trim(); String title=rset.getString(2).trim(); String url=rset.getString(3).trim(); String blanks= " "; // print the data in a table format System.out.print (id); System.out.print(blanks.substring(1,8-id.length())); System.out.print (title); System.out.print(blanks.substring(1,41-title.length())); System.out.println (url); } } }