} catch (Exception e) { System.out.println (e.getMessage()); } } // Below is the same as before except for the new ColorGenerator class // that we needed to produce distinct colors. public String[] getData( String QueryLine ) { int columns, pos; String column[]=new String[4]; boolean more; try { Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(QueryLine); columns=(rs.getMetaData()).getColumnCount(); column = new String[columns]; // Initialize the columns to be blank for(pos=1; pos<=columns; pos++) { column[pos-1]=""; } more=rs.next(); while(more) {for (pos=1; pos<=columns; pos++) { column[pos-1]+=(rs.getString(pos)); } more=rs.next(); for (pos=1; pos<=columns; pos++) { if(more) { column[pos-1]+=(","); } } } stmt.close(); // con.close(); } catch( Exception e ) { e.printStackTrace(); System.out.println(e.getMessage()); } return column; } public void destroy() { try {con.close();} catch( Exception e ) { e.printStackTrace(); System.out.println(e.getMessage()); }
Dear Canadians, choose Canadian Web Hosting and your Canadian website will benefit in every way from the reliability, security, and speed.