티스토리 뷰
<%@ page contentType="text/html;charset=KSC5601" %>
<%@ page import="java.sql.*"%>
<%
Connection con = null;
ResultSet rs = null;
Statement stmt = null;
String url = "jdbc:mysql://localhost:3306/EMS51?useUnicode=true&characterEncoding=euckr";
String usr = "usr";
String pwd = "pwd
String drv = "org.gjt.mm.mysql.Driver";
String query1_pre = " UPDATE EBCD0030 SET CODE_NAME = '";
String query1_suf = "' WHERE CODE_TYPE = '00' AND CODE_CODE = ";
String query2 = " SELECT CODE_NAME EBCD0030 WHERE CODE_TYPE = '00' AND CODE_CODE = '01' ";
String value = request.getParameter("value");
value = value==null?"":value;
value = new String( value.getBytes("8859_1"), "EUC-KR" );
String codeName = "";
try {
if( !value.equals("") ) {
con = DriverManager.getConnection( url, usr, pwd );
stmt = con.createStatement();
stmt.executeUpdate( query1_pre + new String( value.getBytes("8859_1"), "EUC-KR" ) + query1_suf + " '01' " );
stmt.executeUpdate( query1_pre + new String( value.getBytes("EUC-KR"), "EUC-KR" ) + query1_suf + " '02' " );
stmt.executeUpdate( query1_pre + new String( value.getBytes("EUC-KR"), "8859_1" ) + query1_suf + " '03' " );
stmt.executeUpdate( query1_pre + new String( value.getBytes("8859_1"), "8859_1" ) + query1_suf + " '04' " );
stmt.executeUpdate( query1_pre + new String( value.getBytes("8859_1"), "UTF8" ) + query1_suf + " '05' " );
stmt.executeUpdate( query1_pre + new String( value.getBytes("UTF8"), "UTF8" ) + query1_suf + " '06' " );
stmt.executeUpdate( query1_pre + new String( value.getBytes("EUC-KR"), "UTF8" ) + query1_suf + " '07' " );
}
// rs = stmt.executeQuery( query2 );
// if( rs.next() )
// codeName= rs.getString("CODE_NAME");
} catch(Exception e) {
out.println( e.toString() );
} finally {
if( con!=null ) try { con.close(); } catch(Exception e) {};
if( rs!=null ) try { rs.close(); } catch(Exception e) {};
if( stmt!=null ) try { stmt.close(); } catch(Exception e) {};
}
%>
http://localhost:8181/ems51/jsp/test.jsp?value=테스트 확인
'Database' 카테고리의 다른 글
[ORACLE] Toad 에서 단축키로 주석처리 (0) | 2008.04.28 |
---|---|
[MYSQL] mysql 5.0 사용자 추가 명령문 (Field 'ssl_cipher' doesn't have a default value) (0) | 2008.04.25 |
[MSSQL] 화폐단뒤, 세번째콤마 (0) | 2008.04.17 |
[ORACLE] SEQUENCE 추가 (0) | 2008.04.16 |
[ORACLE] 10g XE에서 8080포트바꾸기 (0) | 2008.01.10 |
- Total
- Today
- Yesterday
- 자동차
- apache
- eclipse
- 설정
- delete
- DB
- 리눅스
- 오라클
- Shell
- mssql
- table
- 테이블
- 서버
- DATABASE
- sql
- 파일
- 데이터
- IP
- tomcat
- java
- Windows
- Linux
- 윈도우
- Toad
- user
- select
- Oracle
- server
- 백업
- MySQL
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |