1 5 6 package simpleapp.data; 7 8 import java.sql.*; 9 import com.lutris.appserver.server.Enhydra; 10 import com.lutris.appserver.server.sql.*; 11 import java.util.Vector ; 12 13 public class SimpleDiscQuery 14 { 15 DBConnection connection; 16 17 public SimpleDiscQuery() { 18 try { 19 connection = Enhydra.getDatabaseManager().allocateConnection(); 20 21 } catch (Exception e) { 22 e.printStackTrace(); 23 } 24 } 25 26 public Vector query() { 27 ResultSet resultSet = null; 28 Vector vResultSet = new Vector (); 29 30 try { 31 resultSet = connection.executeQuery("SELECT * FROM LE_TUTORIAL_DISCS"); 32 int i=0; 33 if (resultSet != null) { 34 while (resultSet.next()) { 35 Vector vRow = new Vector (4); 36 vRow.addElement( resultSet.getString("artist") ); 37 vRow.addElement( resultSet.getString("title") ); 38 vRow.addElement( resultSet.getString("genre") ); 39 vRow.addElement( Integer.toString( resultSet.getInt("isLiked") ) ); 40 vResultSet.addElement( vRow ); 41 } 42 } 43 connection.reset(); 44 connection.release(); 45 46 } catch (Exception e) { 47 e.printStackTrace(); 48 } 49 50 return vResultSet; 51 } 52 53 } 54 | Popular Tags |