import java.awt.*; import java.sql.*; import java.io.*; public class Gallerie { static BufferedWriter myOutput; public static void main(String[] args) throws IOException{ String nome = " "; String commento = " "; String indirizzo = " "; String miniatura = " "; int id=0,ida=0; String nomeautore=""; int i=0,ngall=0; try { // Load the Mysql JDBC driver try { Class.forName("org.gjt.mm.mysql.Driver"); } catch (ClassNotFoundException e) { System.out.println ("Mysql device driver does not exist"); System.exit(1); } // Connect to the database // You can put a database name after the @ sign in the connection URL. Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost/Frattali?user=utente&password="); // Create a Statement Statement stmt = conn.createStatement (); File outputFile = new File("gallerie.html"); myOutput = new BufferedWriter(new FileWriter(outputFile)); ResultSet rset0 = stmt.executeQuery (" select COUNT(*) from gallerie" ); ngall=rset0.getInt(1); myOutput.write(" Internet Fractal Database

IFD : Internet Fractal Database

Text only   Presentation with frames

Here a small sample of images from the galleries and a list of resources to find more galleries

\n"); myOutput.write(" \n The database contains "+ngall+" galleries.A list ordered by author name is also available

\n"); ResultSet rset = stmt.executeQuery (" select Nome,Commento,Indirizzo,ID,autore,miniatura,nome_autore from gallerie,autore WHERE autore=ID_autore ORDER BY Nome" ); while (rset.next ()) { i = i + 1; nome =rset.getString (1); commento=rset.getString (2); indirizzo = rset.getString(3); id = rset.getInt(4); ida =rset.getInt (5); miniatura = rset.getString(6); nomeautore = rset.getString(7); myOutput.write( "

"+nome+""); if(ida>0)myOutput.write( " by "+nomeautore+"\n"); if(commento != null)myOutput.write(" : "+commento+" \n"); } myOutput.write( "


Pagina curata da Giuseppe Zito: zito@ba.infn.it
ultimo aggiornamento: \n"); myOutput.write( " \n"); myOutput.close(); stmt.close(); // Close the connection conn.close(); } catch (SQLException e) { System.out.println("Error accessing DB "); System.out.println(" Error code is : "+e.getErrorCode()); System.out.println(" Error message is :"+e.getMessage()); } } }