ÀÚ¹ÙºóÁî µÎ¹ø°½Ã°£
:::::::::::::::::::::::::::::::::::::::::::::::::: --- mysql¿¡¼ ÀÛ¾÷ --- Microsoft Windows 2000 [Version 5.00.2195] (C) Copyright 1985-2000 Microsoft Corp.
C:\Documents and Settings\Administrator> C:\Documents and Settings\Administrator>cd ..
C:\Documents and Settings>cd ..
C:\>cd \mysql -u root ÁöÁ¤µÈ °æ·Î¸¦ ãÀ» ¼ö ¾ø½À´Ï´Ù.
C:\>cd mysql
C:\mysql>cd bin
C:\mysql\bin>mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 74 to server version: 4.0.22-nt
Type help; or \h for help. Type \c to clear the buffer.
mysql> use mysql Database changed mysql> use JspTestDB; Database changed mysql> show tables; +---------------------+ | Tables_in_jsptestdb | +---------------------+ | guestbook | | guestreply | | memo | | starcraft | | user | +---------------------+ 5 rows in set (0.01 sec)
mysql> create table member ( -> id varchar(15) not null primary key, -> passwd varchar(15) not null, -> name varchar(30) not null,; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \ at line 4 mysql> create table member( -> id varchar(20), -> create table member (; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near create table member ( at line 3 mysql> create table member( -> id varchar(20) not null, -> passwd varchar(20) not null, -> name char(6) null, -> mem_num1 char(6) null, -> mem_num2 char(7) null, -> e_mail varchar(30) null, -> phone varchar(30) null, -> zipcode char(7) null, -> address varchar(60) null, -> job varchar(30) null); Query OK, 0 rows affected (0.10 sec)
mysql> show tables; +---------------------+ | Tables_in_jsptestdb | +---------------------+ | guestbook | | guestreply | | member | | memo | | starcraft | | user | +---------------------+ 6 rows in set (0.00 sec)
mysql> select * from member; Empty set (0.00 sec)
mysql> insert into member9id,passwd.name.mem_num1,mem_num2,e_maill,phone,zipcode,address,job) values(vjtv,11 11,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > ; > > > > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near passwd.name.mem_num1,mem_num2,e_maill,phone,zipcode,address,job mysql> insert into member9id,passwd.name.mem_num1,mem_num2,e_maill,phone,zipcode,address,job) values(vjtv,11 11,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near passwd.name.mem_num1,mem_num2,e_maill,phone,zipcode,address,job mysql> insert into member (id,passwd.name.mem_num1,mem_num2,e_maill,phone,zipcode,address,job) values(vjtv,1 111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-19 mysql> mysql> mysql> insert into member (id,passwd,name,mem_num1,mem_num2,e_maill,phone,zipcode,address,job) values(vjtv,1 111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-19 mysql> mysql> mysql> insert into member (id,passwd,name,mem_num1,mem_num2,e_mail,phone,zipcode,address,job) values(vjtv,11 11,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-19 mysql> mysql> mysql> insert into member (id,passwd,name,mem_num1,mem_num2,e_mail,phone,zipcode,address,job) values(vjtv,11 11,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > > > > > ; > > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-19 mysql> mysql> mysql> mysql> mysql> insert into member values(vjtv,1111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192, °æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > > ; > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-19 mysql> mysql> mysql> mysql> mysql> insert into member values(vjtv,1111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192, °æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); > ; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server vers ion for the right syntax to use near \,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-19 mysql> mysql> mysql> mysql> mysql> mysql> insert into member values(vjtv,1111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192 ,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); Query OK, 1 row affected (0.00 sec)
mysql> insert into member values(vvvv,1111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192 ,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,ÀÌõ±¹); Query OK, 1 row affected (0.00 sec)
mysql> insert into member values(vvvv,1111,À̱â¿ë,1234,5678,lee@ky.co.kr, 10-3079-1009,461-192 ,°æ±âµµ ¼º³²½Ã ¼öÁ¤±¸,¹æ¼Û±¹); Query OK, 1 row affected (0.00 sec)
mysql> select * from member; +------+--------+--------+----------+----------+--------------+---------------+---------+--------------------- -+--------+ | id | passwd | name | mem_num1 | mem_num2 | e_mail | phone | zipcode | address | job | +------+--------+--------+----------+----------+--------------+---------------+---------+--------------------- -+--------+ | vjtv | 1111 | À̱â¿ë | 1234 | 5678 | lee@ky.co.kr | 010-3079-1009 | 461-192 | °æ±âµµ ¼º³²½Ã ¼öÁ¤±¸ | ÀÌõ±¹ | | vvvv | 1111 | À̱â¿ë | 1234 | 5678 | lee@ky.co.kr | 010-3079-1009 | 461-192 | °æ±âµµ ¼º³²½Ã ¼öÁ¤±¸ | ÀÌõ±¹ | | vvvv | 1111 | À̱â¿ë | 1234 | 5678 | lee@ky.co.kr | 010-3079-1009 | 461-192 | °æ±âµµ ¼º³²½Ã ¼öÁ¤±¸ | ¹æ¼Û±¹ | +------+--------+--------+----------+----------+--------------+---------------+---------+--------------------- -+--------+ 3 rows in set (0.00 sec)
mysql>
::::DB¼º°ø::::::::::::::::::::::::::::::::::::::: --- ÆÄÀϸí: RegisterBean.java --------------------- package ch09;
public class RegisterBean{ private String mem_id; private String mem_passwd; private String mem_name; private String mem_num1; private String mem_num2; private String mem_email; private String mem_phone; private String mem_zipcode; private String mem_address; private String mem_job;
public void setMem_id(String mem_id){ this.mem_id=mem_id; } public void setMem_passwd(String mem_passwd){ this.mem_passwd=mem_passwd; } public void setMem_name(String mem_name){ this.mem_name=mem_name; } public void setMem_num1(String mem_num1){ this.mem_num1=mem_num1; } public void setMem_num2(String mem_num2){ this.mem_num2=mem_num2; } public void setMem_email(String mem_email){ this.mem_email=mem_email; } public void setMem_phone(String mem_phone){ this.mem_phone=mem_phone; } public void setMem_zipcode(String mem_zipcode){ this.mem_zipcode=mem_zipcode;: } public void setMem_address(String mem_address){ this.mem_address=mem_address; } public void setMem_job(String mem_job){ this.mem_job=mem_job; } public String getMem_id(){ return mem_id; } public String getMem_passwd(){ return mem_passwd; } public String getMem_name(){ return mem_name; } public String getMem_num1(){ return mem_num1; } public String getMem_num2(){ return mem_num2; } public String getMem_email(){ return mem_email; } public String getMem_phone(){ return mem_phone; } public String getMem_zipcode(){ return mem_zipcode; } public String getMem_address(){ return mem_address; } public String getMem_job(){ return mem_job; } } --- ÆÄÀϸí: MemberMgr.java --------------------- package ch09; import java.util.*; import java.sql.*; import ch09.RegisterBean;
public class MemberMgr{
private final String JDBC_DRIVER=org.gjt.mm.mysql.Driver; private final String JDBC_URL=jdbc:mysql://localhost:3306/JspTestDB; private final String USER=
oot; private final String PASS=\; public MemberMgr(){ try{ Class.forName(JDBC_DRIVER); }catch(Exception e){ System.out.println(Error:JDBC µå¶óÀ̹ö ·Îµù ½ÇÆÐ); } }//MemberMgr() public Vector getMemberList(){ Connection conn=null; Statement stmt=null; ResultSet rs=null; Vector vecList=new Vector(); try{ conn=DriverManager.getConnection(JDBC_URL,USER,PASS); String strQuery=select * from member; stmt=conn.createStatement(); rs=stmt.executeQuery(strQuery); while(rs.next()){ RegisterBean regBean=new RegisterBean(); regBean.setMem_id(rs.getString(id)); regBean.setMem_passwd(rs.getString(passwd)); regBean.setMem_name(rs.getString(
ame)); regBean.setMem_num1(rs.getString(mem_num1)); regBean.setMem_num2(rs.getString(mem_num2)); regBean.setMem_email(rs.getString(e_mail)); regBean.setMem_phone(rs.getString(phone)); regBean.setMem_zipcode(rs.getString(zipcode)); regBean.setMem_address(rs.getString(address)); regBean.setMem_job(rs.getString(job)); vecList.add(regBean); } } catch (Exception ex) { System.out.println(Exception+ex); } finally { if(rs!=null) try{rs.close();} catch(SQLException e){} if(stmt!=null) try{stmt.close();} catch(SQLException e){} if(conn!=null) try{conn.close();} catch(SQLException e){} } return vecList; } }//class
--- ÆÄÀϸí: UsingJDBC_bean.jsp --------------------- <%@ page import=java.util.*,ch09.* contentType= ext/html;charset = EUC-KR\%> <html> <head> <title>jsp ¿¡¼ µ¥ÀÌÅͺ£À̽º ¿¬µ¿</title> <link href=style.css rel=stylesheet type= ext/css> </head> <body bgcolor=#ffffcc> <h2>Bean¸¦ »ç¿ëÇÑ ´ëÀÌÅͺ£À̽º ¿¬µ¿ ¿¹Á¦ÀÔ´Ï´Ù...</h2> <br> <br> <h3>ȸÀ©Á¤º¸</h3> <table bordercolor=#0000ff border=1> <tr> <td><strong>ID</strong></td> <td><strong>PASSWD</strong></td> <td><strong>NAME</strong></td> <td><strong>MEM_NUM1</strong></td> <td><strong>MEM_NUM2</strong></td> <td><strong>E_MAIL</strong></td> <td><strong>PHONE</strong></td> <td><strong>ZIP</strong></td> <td><strong>JOB</strong></td> </tr> <jsp:useBean id=memMgr class=ch09.MemberMgr scope=page /> <% Vector vlist=memMgr.getMemberList(); int counter=vlist.size(); for(int i=0;i<vlist.size();i++){ RegisterBean regBean=(RegisterBean)vlist.elementAt(i); %> <tr> <td><%=regBean.getMem_id()%></td> <td><%=regBean.getMem_passwd()%></td> <td><%=regBean.getMem_name()%></td> <td><%=regBean.getMem_num1()%></td> <td><%=regBean.getMem_num2()%></td> <td><%=regBean.getMem_email()%></td> <td><%=regBean.getMem_phone()%></td> <td><%=regBean.getMem_zipcode()%>/<%=regBean.getMem_address()%></td> <td><%=regBean.getMem_job()%></td> <% } %> </tr> </table> <br> <br> total records: <%=counter%> </body> </html>
::::¼öÁ¤´Ü°è:::::::::::::::::::::::::::::::::::::::::::::: --- ÆÄÀϸí: RegisterBean.java --------------------- package ch07;
public class RegisterBean{ private String mem_id; private String mem_passwd; private String mem_name; private String mem_email; private String mem_phone;
public void setMem_id(String mem_id){ this.mem_id=mem_id; } public void setMem_passwd(String mem_passwd){ this.mem_passwd=mem_passwd; } public void setMem_name(String mem_name){ this.mem_name=mem_name; } public void setMem_email(String mem_email){ this.mem_email=mem_email; } public void setMem_phone(String mem_phone){ this.mem_phone=mem_phone; } public String getMem_id(){ return mem_id; } public String getMem_passwd(){ return mem_passwd; } public String getMem_name(){ return mem_name; } public String getMem_email(){ return mem_email; } public String getMem_phone(){ return mem_phone; } }
--- ÆÄÀϸí: RegisterBean.jsp --------------------- <%@ page import=java.util.*,ch09.* contentType= ext/html;charset = EUC-KR\%> <html> <head> <title>ȸ¿ø°¡ÀÔ</title> </head> <body bgcolor=#996600> <table width=80% align=center border= cellspacing= cellpadding=5> <tr> <td align=center valign=middle bgcolor=#ffffcc> <table width=90% border=1 cellspacing= cellpadding=2 align=center> <form name=
egForm method=post action=RegisterProc.jsp> <tr align=center bgcolor=#996600> <td colspan=3><font color=#ffffff><b>ȸ¿ø°¡ÀÔ</b></font></td> </tr> <tr> <td width=24%>¾ÆÀ̵ð</td> <td width=35%><input type= ext name=mem_id size=15></td> <td width=-41%>¾ÆÀ̵𸦠Àû¾î ÁÖ¼¼¿ä.</td> </tr> <tr> <td>Æнº¿öµå</td> <td><input type=password name=mem_passwd size=15></td> <td>Æнº¿öµå¸¦ Àû¾îÁÖ¼¼¿ä.</td> </tr> <tr> <td>Æнº¿öµåÈ®ÀÎ </td> <td><input type=password name=mem_repaasswd size=15></td> <td>Æнº¿öµå¸¦ È®ÀÎÇÕ´Ï´Ù.</td> </tr> <tr> <td>ÀÌ ¸§</td> <td><input type= ext name=mem_name size=15></td> <td>°í°´½Ç¸íÀ» Àû¾îÁÖ¼¼¿ä</td> </tr> <tr> <td>À̸ÞÀÏ</td> <td><input type= ext name=mem_email size=27></td> <td>À̸ÞÀÏÀ» Àû¾îÁÖ¼¼¿ä</td> </tr> <tr> <td>ÀüȹøÈ£</td> <td><input type= ext name=mem_phone size=20></td> <td>¿¬¶ôó¸¦ Àû¾î ÁÖ¼¼¿ä</td> </tr> <tr> <td colspan=3 align=center> <input type=utton value=ȸ¿ø°¡ÀÔ onclick=inputCheck()> <input type=
eset value=´Ù½Ã¾²±â> </td> </tr> </form> </table> </td> </tr> </table> </body> </html>
--- ÆÄÀϸí: RegisterProc.jsp --------------------- <%@ page contentType= ext/html;charset = EUC-KR %> <% request.setCharacterEncoding(euc-kr); %> <jsp:useBean id=
egBean class=ch07.RegisterBean scope=page /> <jsp:setProperty name=
egBean property=* />
<html> <head> <title>ȸ¿ø°¡ÀÔ È®ÀÎ</title> <link href=style.css rel=stylesheet type= ext/css> <script language=JavaScript: src=http://www.pcall.co.kr/img/79.gif > </head> <body bgcolor=#996600> <table width=80% align=center border= cellspacing= cellpadding=-5> <tr> <td align=center valign=middle bgcolor=#ffffcc> <table width=90% border=1 cellspacing= cellpadding=2 align=center> <form name=
egForm method=post action=MemberInsert.jsp> <tr align=center bgcolor=#996600> <td colspan=3><font color=#ffffff><b> <jsp:getProperty name=
egBean property=mem_name /> ȸ¿ø´ÔÀÌ ÀÛ¼ºÇϽŠ³»¿ëÀÔ´Ï´Ù. È®ÀÎÇØ ÁÖ¼¼¿ä</b></font></td> </tr> <tr> <td width=24%> ¾ÆÀ̵ð</td> <td width=41%><jsp:getProperty name=
egBean property=mem_id /></td> </tr> <tr> <td>Æнº¿öµå</td> <td><jsp:getProperty name=
egBean property=mem_passwd /></td> </tr> <tr> <td>ÀÌ ¸§</td> <td><jsp:getProperty name=
egBean property=mem_name /></td> </tr> <tr> <td>À̸ÞÀÏ</td> <td><jsp:getProperty name=
egBean property=mem_email /></td> </tr> <tr> <td>ÀüȹøÈ£</td> <td><jsp:getProperty name=
egBean property=mem_phone /></td> </tr> <tr> <td colspan=2 align=center><input type=utton value=È®ÀοϷá> <input type=utton value=´Ù½Ã¾²±â onClick=history.back()> </td> </tr> </form> </table> </td> </tr> </table> </body> </html>
jsp ½ºÅ͵ð 2004 12 07
¼Ò½º±ú²ýÈ÷º¸±â http://www.6VJ.com/jsp/jsp1207.txt
|