home *** CD-ROM | disk | FTP | other *** search
/ ftp.disi.unige.it / 2015-02-11.ftp.disi.unige.it.tar / ftp.disi.unige.it / pub / .person / MesitiM / teach / templateJava.java < prev   
Text File  |  2003-06-10  |  959b  |  42 lines

  1. // Cognome e Nome:  
  2. // Numero di matricola: 
  3. // Data di Nascita: 
  4. // login su SQL server:
  5. // Password su SQL server:
  6.  
  7.  
  8. import java.sql.*; 
  9. import java.io.*; 
  10.  
  11. class templateJavaEsame
  12.   
  13. // subname deve essere sostituito con l'identificatore ODBC creato
  14.  
  15.  static String Con_URL = "jdbc:odbc:subname";
  16.    
  17.  public static void main (String args []) 
  18.  { 
  19.      Connection con = null;    
  20.      try{
  21.           Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  22.     
  23.          // inserire codice
  24.             
  25.  
  26.       } 
  27.         catch(java.lang.ClassNotFoundException e) {
  28.                 System.err.print("ClassNotFoundException: "); 
  29.                 System.err.println(e.getMessage());
  30.             }
  31.         catch (SQLException e) {
  32.                          while( e!=null){ 
  33.                                 System.out.println("SQLState: " + e.getSQLState());
  34.                             System.out.println("    Code: " + e.getErrorCode());
  35.                             System.out.println(" Message: " + e.getMessage());
  36.                             e = e.getNextException();
  37.                             }    
  38.        }
  39.     }
  40. }
  41.