public ChatChannel createAndJoinChannel(ChatChannel chatChannel, User user){
		try {
			Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
			String url = "jdbc:derby:" + DBName;
			Connection connection = DriverManager.getConnection(url);
			Statement statement = connection.createStatement();
			String insertIntoChatChannels = "INSERT INTO chatchannels (channeltype, channelname) "
											+ "VALUES ((SELECT cctid FROM chatchanneltypes WHERE cctype = 'custom' ), '" + chatChannel.getChannelName() + "')";
			statement.executeUpdate(insertIntoChatChannels);
		
			String getChannel = "SELECT channelID "
								+ "FROM CHATCHANNELS "
								+ "WHERE channelname = '" + chatChannel.getChannelName() + "' "
								+ "AND channeltype = (SELECT cctid FROM chatchannelTypes WHERE cctype = 'custom')";

			ResultSet rs = statement.executeQuery(getChannel);
			if(rs.next()){
				chatChannel.setChannelID(rs.getInt("channelID"));
			}
			
			String joinUserInChannelUpdate = "INSERT INTO USERCHATRELATIONS (userID, channelID, relationshiptype) "
											+"VALUES (" + user.getID() + ", " + chatChannel.getChannelID() +", (SELECT ucrtID FROM UserChannelRelationshipTypes WHERE rtype = 'online' ))";

			statement.executeUpdate(joinUserInChannelUpdate);
			
			statement.close();
			connection.close();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return chatChannel;
	}