java SmallProgram 23
Cannot load database driverException in thread "main" java.lang.NullPointerException:
     at SmallProgram.getIds(SmallProgram.java:102)
     at SmallProgram.main(SmallProgram.java:50)
Here is the code:
imports .*;
public class SmallProgram extends Object {
   private static Statement statement;
   private static Connection connection;
   private static String URL = "jdbc:mysql://foo";
private static DBManager manager;
public static void main ( String args[] ) {
      try {
      Class.forName( "org.gjt.mm.mysql.Driver"
);
      connection = DriverManager.getConnection(
URL, "foo", "foobar" );
      statement = connection.createStatement();
      manager = new DBManager(statement);
       manager.setDebug(true);
       }
      catch (SQLException e) {
      System.out.print("SQL Exception");
      } catch (ClassNotFoundException e) {
      System.out.print("Cannot load database
driver");
      } catch (Exception e) {
      System.out.print("Exception in init");
      }
      String intDom = args[0];
      int intDomID = Integer.parseInt(intDom);
 
      Vector pgwd = new Vector(1);
      Vector kwdph = new Vector(1);
String kwdQry = "SELECT * FROM ??"
      String pgwdQry = "SELECT * FROM ??"
 
try {
[**line 50]       pgwd = getIds( kwdQry
);
       kwdph = getIds( pgwdQry );
      } catch (SQLException sqlex) {
        sqlex.printStackTrace();
      }
      Integer tmpkwd;
      Integer tmppgwd;
      for (int j= 1; j < kwdph.size(); j++
) {
        for (int k =1; k < pgwd.size();
k++ ) {
           tmpkwd
= (Integer) kwdph.get(j);
           tmppgwd
= (Integer) pgwd.get(k);
                  
Keyword keyword = new Keyword();
             
Page page = new Page();
             
Master mas = new Master();
try {
                
keyword.id = new DBForeignKey( tmpkwd.intValue() );
                
page.id = new DBForeignKey( tmppgwd.intValue() );
                
mas.setKeyword( keyword );
                
mas.setPage( page );
                
manager.createObject(mas);
                
} catch (SQLException sqlex) {
           
sqlex.printStackTrace();
           
} catch (ClassNotFoundException e) {
           
System.out.print("Cannot load database driver");
           
} catch (Exception e) {
           
System.out.print("Exception in init");
           
}
 
        }
      }
    } // end of main
 
      public static Vector getIds( String query
)throws SQLException  {
          ResultSet res;
           int id=0;
          Vector vect
= new Vector(1);
                  
// statement = connection.createStatement();
[*line 102]    res = statement.executeQuery( query );
        int i=0;
        while (res.next())
               
{ i++; };
       for(int j=0;j < i; j++) {
          id  = res.getInt("id");
          vect.addElement(new
Integer(id));
          res.next();
          }
         return vect;
      }  // end of getIDs
}  // end of class
 
 
-- _______________________________________________ Erick Stohr - PageLab Network, Inc. mailto:erick@pagelab.net http://pagelab.net Your search-to-sale global e-commerce solution! Toll free 1-800-447-0607 Voice 612-362-9224 Fax 612-362-9227 43 Main Street SE, Suite 228 Minneapolis, Minnesota 55414 _______________________________________________