Search

'Programming/Java'에 해당되는 글 76건

  1. 2009.01.12 Tomcat 5.5 Connection Pool 설정
  2. 2008.11.07 Eclipse에서 Subversion을 사용
  3. 2008.11.07 eclipse - config.ini
  4. 2008.06.25 Java - 정규표현식 ( Regular Expressions )

Tomcat 5.5 Connection Pool 설정

Programming/Java 2009.01.12 01:37 Posted by 파란크리스마스

출처 : http://blog.bagesoft.com/725
http://fallacy.tistory.com/76
http://kwon37xi.egloos.com/2852803?89a004e0

1) C:\apache-tomcat-5.5.27\conf\server.xml 내용추가

   <Resource name="jdbc/myoracle" auth="Container"
              type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:127.0.0.1:1521:orcl"
              username="scott" password="tiger" maxActive="20" maxIdle="10"
              maxWait="-1"/>   

2) C:\apache-tomcat-5.5.27\conf\context.xml 내용추가

  <ResourceLink global="jdbc/myoracle" name="jdbc/myoracle" type="javax.sql.DataSource"/> 

3) C:\oracle\product\10.2.0\db_1\jdbc\lib 폴더의 ojdbc14.jar 파일을 C:\apache-tomcat-5.5.27\common\lib 폴더에 복사

4) C:\apache-tomcat-5.5.27\webapps\ROOT\WEB-INF\web.xml 내용 추가

    <resource-ref>
      <description>Oracle Datasource example</description>
      <res-ref-name>jdbc/myoracle</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
    </resource-ref>

5) Tomcat 재실행

6) 테스트 JSP 파일 작성

<%@ page import="java.sql.*, javax.naming.*, javax.sql.*"%>
<%

Context initCtx = new InitialContext();

/*
  Context envContext  = (Context)initContext.lookup("java:/comp/env");
  DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
*/

DataSource ds =  (DataSource)initCtx.lookup("java:comp/env/jdbc/myoracle");
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;

try {
 conn = ds.getConnection();
 stmt = conn.createStatement();
  String query = "select to_char(sysdate,'yyyy/mm/dd hh24:mi:ss') from dual"; // 현재 시간을 구하는 query
  rs = stmt.executeQuery(query);

  if(rs.next()) {
    out.println("<br>" + rs.getString(1));
  }
} catch (Exception e) {
  out.println("<br>" + e.toString());
} finally {
  if (rs!=null) try { rs.close(); } catch (Exception e) { }
  if (stmt!=null) try { stmt.close(); } catch (Exception e) { }
  if (conn!=null) try { conn.close(); } catch (Exception e) { }
}

%>


Eclipse에서 Subversion을 사용

Programming/Java 2008.11.07 23:37 Posted by 파란크리스마스

출처 : http://www.ibm.com/developerworks/kr/library/os-ecl-subversion/index.html
http://subclipse.tigris.org/install.html

Eclipse의 Help 메뉴에서 Software Updates 선택

 

[Available Software]텝 선택




[Add Site] 버튼 선택



    Name: Subclipse 1.8.x (Eclipse 3.2/Callisto, 3.3/Europa, 3.4/Ganymede, 3.5/Galileo, 3.6/Helios, 3.7/Indigo, +)
    URL: http://subclipse.tigris.org/update_1.8.x

    Name: Subclipse 1.6.x (Eclipse 3.2+)
    URL: http://subclipse.tigris.org/update_1.6.x

    Name: Subclipse 1.4.x (Eclipse 3.2+)
    URL:  http://subclipse.tigris.org/update_1.4.x

    Name: Subclipse 1.2.x (Eclipse 3.2+)
    URL:  http://subclipse.tigris.org/update_1.2.x
   
    Name: Subclipse 1.0.x (Eclipse 3.0/3.1)
    URL:  http://subclipse.tigris.org/update_1.0.x




[Install] 버튼 선택





[Next ] 버튼 선택



동의하고 [Finish] 버튼 선택



[Yes]버튼 실행 후 재실행



신규 프로젝트 생성을 위해서
[New] -> [Project] 선택





http://wowcast.googlecode.com/svn/trunk/ 사이트 입력






 

eclipse - config.ini

Programming/Java 2008.11.07 10:18 Posted by 파란크리스마스

출처 : http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F

eclipse - config.ini

JRE 지정

-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256M
-vm
C:\jdk1.6.0_06\jre\bin\javaw.exe

-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m   


Java - 정규표현식 ( Regular Expressions )

Programming/Java 2008.06.25 02:07 Posted by 파란크리스마스
출처 : http://www.java2go.net/blog/tag/Regular%20Expression

1. 링크 정보 추출하기


 public String getTagA_href_Value(String html) {
  Pattern p = Pattern.compile("([ ]+href[ ]*=\")([^\"]+)\"");
  Matcher m = p.matcher(html);
  if (m.find())
  {
   System.out.println(m.group(0));
   System.out.println(m.group(1));
   System.out.println(m.group(2));
   System.out.println("----------------");
   return m.group(2);
  }
  return "";
 }

2. HTML 태그 없애기

 public String getTagA_String(String html) {
  Pattern p = Pattern.compile("\\<(\\/?)(\\w+)*([^<>]*)>");
     Matcher m = p.matcher(html);
  if (m.find()) {
   return m.replaceAll("");
  }
  return "";
 }