재미진걸 만들고 있어요 'ㅡ'/
컨텐츠 정보
- 1,002 조회
- 14 댓글
- 0 추천
- 0 비추천
-
목록
본문
관련자료
댓글 14

세아니님의 댓글의 댓글
서버마다 틀려서, 일단 제기준으로 에바기준
datatables에 chattable.java 하나 만들고
public void ChatTable(L1PcInstance pc, L1ItemInstance key,
String date, int id) {
int count = 0;
Connection con = null;
PreparedStatement pstm1 = null;
ResultSet rs = null;
PreparedStatement pstm2 = null;
try {
con = L1DatabaseFactory.getInstance().getConnection();
pstm1 = con
.prepareStatement("SELECT * FROM chattable ORDER BY chat_id DESC");
rs = pstm1.executeQuery();
while (rs.next()) {
if (rs.getInt(6) == id) {
if (count < rs.getInt(1)){
count = rs.getInt(1);
}
}
}
pstm2 = con
.prepareStatement("INSERT INTO chattable SET id=?, name=?, date=?, talk=?");
pstm2.setInt(1, (count + 1));
pstm2.setString(2, pc.getName());
pstm2.setString(3, date);
pstm2.setString(4, talk);
pstm2.execute();
} catch (SQLException e) {
_log.log(Level.SEVERE, "ChatTable[]Error5", e);
} finally {
SQLUtil.close(rs);
SQLUtil.close(pstm1);
SQLUtil.close(pstm2);
SQLUtil.close(con);
}
작성한다음 C_CHAT.java에 서버에 맞게 일반 채팅 들어올경우
다른 DB에서 입력받듯이 DB에 넣어주면 될겁니다.
datatables에 chattable.java 하나 만들고
public void ChatTable(L1PcInstance pc, L1ItemInstance key,
String date, int id) {
int count = 0;
Connection con = null;
PreparedStatement pstm1 = null;
ResultSet rs = null;
PreparedStatement pstm2 = null;
try {
con = L1DatabaseFactory.getInstance().getConnection();
pstm1 = con
.prepareStatement("SELECT * FROM chattable ORDER BY chat_id DESC");
rs = pstm1.executeQuery();
while (rs.next()) {
if (rs.getInt(6) == id) {
if (count < rs.getInt(1)){
count = rs.getInt(1);
}
}
}
pstm2 = con
.prepareStatement("INSERT INTO chattable SET id=?, name=?, date=?, talk=?");
pstm2.setInt(1, (count + 1));
pstm2.setString(2, pc.getName());
pstm2.setString(3, date);
pstm2.setString(4, talk);
pstm2.execute();
} catch (SQLException e) {
_log.log(Level.SEVERE, "ChatTable[]Error5", e);
} finally {
SQLUtil.close(rs);
SQLUtil.close(pstm1);
SQLUtil.close(pstm2);
SQLUtil.close(con);
}
작성한다음 C_CHAT.java에 서버에 맞게 일반 채팅 들어올경우
다른 DB에서 입력받듯이 DB에 넣어주면 될겁니다.