{"id":173,"date":"2010-04-18T00:09:33","date_gmt":"2010-04-18T09:09:33","guid":{"rendered":"\/blog\/?p=173"},"modified":"2023-09-21T09:39:14","modified_gmt":"2023-09-21T00:39:14","slug":"tomcatmysql-%ec%84%a4%ec%b9%98","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=173","title":{"rendered":"tomcat+mysql \uc124\uce58"},"content":{"rendered":"\n1. JDK\ub97c \uc124\uce58\ud55c\ub2e4.<br \/><br \/>2. PATH\uc5d0 C:\\Program Files\\Java\\jdk1.6.0_12\\bin \uc744 \n\ucd94\uac00\ud55c\ub2e4.<br \/><br \/>3. CLASSPATH=C:\\Program Files\\Java\\jdk1.6.0_12\\lib\\tools.jar \ud658\uacbd\ubcc0\uc218 \n\ucd94\uac00<br \/><br \/>4. tomcat \uc124\uce58<br \/><br \/>5. mysql \uc124\uce58<br \/><br \/>6. \nmysql-connector-java-x.x.x-bin.jar \ub2e4\uc6b4\ub85c\ub4dc<br \/><br \/>7. \nmysql-connector-java-5.0.7-bin.jar -&gt; c:\\Program Files\\Apache Software \nFoundation\\Tomcat 5.5\\common\\lib\\ \uc5d0 \ubcf5\uc0ac<br \/><br \/>8. Tomcat 5.5\/conf\/server.xml\uc5d0\uc11c \n&lt;Service name=\"Catalina\"&gt;~&lt;\/Service&gt;\ubc11\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \ud638\uc2a4\ud2b8\ubcc4\ub85c \ucd94\uac00\uc2dc\ucf1c \n\uc900\ub2e4.<br \/><br \/>&nbsp; &nbsp; &nbsp; <span style=\"color: rgb(255, 108, 0);\">&lt;!-- localhost \ud638\uc2a4\ud2b8 \ucd94\uac00 \n(\uae30\ubcf8\uc801\uc73c\ub85c \uc788\uc74c) --&gt;<\/span><br style=\"color: rgb(255, 108, 0);\"><span style=\"color: rgb(255, 108, 0);\">&nbsp; &nbsp; &nbsp; &lt;Host name=\"localhost\" \nappBase=\"webapps\"<\/span><br style=\"color: rgb(255, 108, 0);\"><span style=\"color: rgb(255, 108, 0);\">&nbsp; &nbsp; &nbsp;&nbsp; unpackWARs=\"true\" \nautoDeploy=\"true\"<\/span><br style=\"color: rgb(255, 108, 0);\"><span style=\"color: rgb(255, 108, 0);\">&nbsp; &nbsp; &nbsp;&nbsp; xmlValidation=\"false\" \nxmlNamespaceAware=\"false\"&gt;<\/span><br style=\"color: rgb(255, 108, 0);\"><span style=\"color: rgb(255, 108, 0);\">&nbsp; &nbsp; &nbsp; &lt;\/Host&gt;<\/span><br style=\"color: rgb(255, 108, 0);\"><br \/>&nbsp; &nbsp; &nbsp; <span style=\"color: rgb(0, 158, 37);\">&lt;!-- www.borewa.com \ud638\uc2a4\ud2b8 \ucd94\uac00 --&gt;<\/span><br style=\"color: rgb(0, 158, 37);\"><span style=\"color: rgb(0, 158, 37);\">&nbsp; &nbsp; &nbsp; &lt;Host \n<font color=\"#0075c8\">name=\"www.borewa.com\"<\/font> <font color=\"#ff0000\">appBase=\"d:\/borewa\"<\/font><\/span><br style=\"color: rgb(0, 158, 37);\"><span style=\"color: rgb(0, 158, 37);\">&nbsp; &nbsp; &nbsp;&nbsp; \nunpackWARs=\"true\" autoDeploy=\"true\"<\/span><br style=\"color: rgb(0, 158, 37);\"><span style=\"color: rgb(0, 158, 37);\">&nbsp; &nbsp; &nbsp;&nbsp; xmlValidation=\"false\" \nxmlNamespaceAware=\"false\"&gt;<\/span><br style=\"color: rgb(0, 158, 37);\"><span style=\"color: rgb(0, 158, 37);\">&nbsp; &nbsp; &nbsp; &lt;\/Host&gt;<\/span><br \/><br \/>&nbsp; &nbsp; &nbsp; <span style=\"color: rgb(58, 50, 195);\">&lt;!-- www.pigbutton.com \ud638\uc2a4\ud2b8 \ucd94\uac00 --&gt;<\/span><br style=\"color: rgb(58, 50, 195);\"><span style=\"color: rgb(58, 50, 195);\">&nbsp; &nbsp; &nbsp; &lt;Host \n<font color=\"#0075c8\">name=\"www.pigbutton.com\"<\/font> <font color=\"#ff0000\">appBase=\"d:\/pigbutton\"<\/font><\/span><br style=\"color: rgb(58, 50, 195);\"><span style=\"color: rgb(58, 50, 195);\">&nbsp; &nbsp; &nbsp;&nbsp; \nunpackWARs=\"true\" autoDeploy=\"true\"<\/span><br style=\"color: rgb(58, 50, 195);\"><span style=\"color: rgb(58, 50, 195);\">&nbsp; &nbsp; &nbsp;&nbsp; \nxmlValidation=\"false\" xmlNamespaceAware=\"false\"&gt;<\/span><br style=\"color: rgb(58, 50, 195);\"><span style=\"color: rgb(58, 50, 195);\">&nbsp; &nbsp; &nbsp; \n&lt;\/Host&gt;<\/span><br \/><br \/>&nbsp; &nbsp; &nbsp; <span style=\"color: rgb(28, 72, 39);\">&lt;!-- \nwww.m-attraction.com \ud638\uc2a4\ud2b8 \ucd94\uac00 --&gt; <\/span><br style=\"color: rgb(28, 72, 39);\"><span style=\"color: rgb(28, 72, 39);\">&nbsp; &nbsp; &nbsp; &lt;Host <font color=\"#0075c8\">name=\"www.m-attraction.com\"<\/font> <font color=\"#ff0000\">appBase=\"d:\/m-attraction\"<\/font><\/span><br style=\"color: rgb(28, 72, 39);\"><span style=\"color: rgb(28, 72, 39);\">&nbsp; &nbsp; &nbsp;&nbsp; \nunpackWARs=\"true\" autoDeploy=\"true\"<\/span><br style=\"color: rgb(28, 72, 39);\"><span style=\"color: rgb(28, 72, 39);\">&nbsp; &nbsp; &nbsp;&nbsp; xmlValidation=\"false\" \nxmlNamespaceAware=\"false\"&gt;<\/span><br style=\"color: rgb(28, 72, 39);\"><span style=\"color: rgb(28, 72, 39);\">&nbsp; &nbsp; &nbsp; &lt;\/Host&gt;<\/span><br \/><br \/>9. \uac01 \ud638\uc2a4\ud2b8\ubcc4 HOME \n\ub514\ub809\ud1a0\ub9ac\ub294 \uc740 d:\/&lt;appBase&gt;\/ROOT \ubc11\uc774 \ub41c\ub2e4.<br \/><br \/>10. index.jsp \ub97c \ub9cc\ub4e4\uc5b4 DB \ucee8\ub125\uc158\uc744 \ud14c\uc2a4\ud2b8 \n\ud55c\ub2e4.<br \/>\uc608\uc81c) d:\\borewa\\ROOT\\index.jsp<br \/>(\"password\"\ubd80\ubd84\uc740 \uc2e4\uc81c MySQL\uc758 root password\ub97c \n\ub123\ub294\ub2e4.)<br \/><br \/><span style=\"color: rgb(27, 73, 106);\">&lt;%@ page import = \n\"java.sql.*\"%&gt;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">&lt;html&gt;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">&lt;head&gt;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">&lt;title&gt;Obtaining a Connection \n&lt;\/title&gt;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">&lt;\/head&gt;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">&lt;body&gt;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">&lt;%<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">Connection \nconn=null;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">ResultSet result=null;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">Statement \nstmt=null;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">ResultSetMetaData rsmd=null;<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">try<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">{<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">Class \nc=Class.forName(\"com.mysql.jdbc.Driver\");<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">}<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">catch(Exception e)<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">{<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">out.write(\"Error!!!!!!\" + e);<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">}<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">try<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">{<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">conn=DriverManager.getConnection(\"jdbc:mysql:\/\/localhost:3306\/mysql\",\"root\",\"password\");<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">out.write(\"www.borewa.com&lt;br&gt;MySQL Databse \nTest : Connected!!\");<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">}<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">catch(SQLException e)<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">{<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">System.out.println(\"Error!!!!!!\" + e);<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">}<\/span><br style=\"color: rgb(27, 73, 106);\"><span style=\"color: rgb(27, 73, 106);\">%&gt;<\/span> <br \/>\n","protected":false},"excerpt":{"rendered":"<p>1. JDK\ub97c \uc124\uce58\ud55c\ub2e4. 2. PATH\uc5d0 C:\\Program Files\\Java\\jdk1.6.0_12\\bin \uc744 \ucd94\uac00\ud55c\ub2e4. 3. CLASSPATH=C:\\Program Files\\Java\\jdk1.6.0_12\\lib\\tools.jar \ud658\uacbd\ubcc0\uc218 \ucd94\uac00 4. tomcat \uc124\uce58 5. mysql \uc124\uce58 6. mysql-connector-java-x.x.x-bin.jar \ub2e4\uc6b4\ub85c\ub4dc 7. mysql-connector-java-5.0.7-bin.jar -&gt; c:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\common\\lib\\ \uc5d0 \ubcf5\uc0ac 8. Tomcat 5.5\/conf\/server.xml\uc5d0\uc11c &lt;Service name=&#8221;Catalina&#8221;&gt;~&lt;\/Service&gt;\ubc11\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \ud638\uc2a4\ud2b8\ubcc4\ub85c \ucd94\uac00\uc2dc\ucf1c \uc900\ub2e4. &nbsp; &nbsp; &nbsp; &lt;!&#8211; localhost \ud638\uc2a4\ud2b8 \ucd94\uac00 (\uae30\ubcf8\uc801\uc73c\ub85c \uc788\uc74c) &#8211;&gt;&nbsp; &nbsp; &nbsp; [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[23],"tags":[],"class_list":["post-173","post","type-post","status-publish","format-standard","hentry","category-development_web"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}