public ChatMessage[] loadMessages(ChatChannel channel, Date joinDate){
		ChatMessage[] chatMessages = null;
		try {
			Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
			String url = "jdbc:derby:" + DBName;
			Connection connection = DriverManager.getConnection(url);
			Statement statement = connection.createStatement();
			
			DateFormat dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String formattedDate = dtf.format(joinDate);
			
			String sqlStatement = "SELECT jnick, uid, message, messagedate "
								+ "FROM chatmessages, users "
								+ "WHERE chatmessages.channel_cid = " + channel.getChannelID() + " "
								+ "AND chatmessages.user_uid = users.uid "
								+ "AND messagedate >= '" + formattedDate + "'";
			
			ResultSet rs = statement.executeQuery(sqlStatement);
			ArrayList<ChatMessage> alstMessages = new ArrayList<>();
			while(rs.next()){
				ChatMessage message = new ChatMessage(rs.getString("jnick"), rs.getInt("uid"), channel.getChannelID(), rs.getString("message"));
				message.setMessageDate(rs.getTimestamp("messagedate"));
				alstMessages.add(message);
			}
			chatMessages = alstMessages.toArray(new ChatMessage[0]);
			statement.close();
			connection.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return chatMessages;
	}