사용자 도구

사이트 도구


wiki:eclipse:resin

Resin

  • description : Resin과 관련된 내용 기술
  • author : 주레피
  • email : dhan@repia.com
  • lastupdate : 2020-06-04

Eclipse(Photon(4.8) 이상) 연동 방법

1. resin 다운로드
resin download
Resin Pro 4.0.x를 OS에 맞게 다운로드 합니다.

2. resin 압축 해제
Tip: 컴퓨터내에 WAS 폴더를 지정하여 모아 둡니다. (jboss, tomcat, weblogic, jeus, resin, …)


3. eclipse 서버 추가
3.1 Window > Preferences → Server > Runtime Environments 차례로 클릭합니다.

3.2 Add…를 클릭합니다.

3.3 Regin > Resin (Java EE Web Profile) Server > Next

Next 누르면 5분정도 소요 됩니다.

당연히 I accept the terms of the license agreement Click & Finish

Finish 누른 후 위 사진처럼 안뜨면 뒤에서 돌고 있기 때문에 아래 초록색 Progress 를 확인하면 install 중인걸 알 수 있습니다.

Install, Restart …

3.4 Window > Preferences → Server > Runtime Environments > Add 차례로 클릭하면 Resin 4.0 이 생성된 것을 확인할 수 있습니다.
Create a new local server 체크한 후 Next 클릭

3.5 JRE와 2번에서 설치한 경로 지정 후 Next 클릭

3.6 Apply for the free development license [enables 'Pro' features) 체크하고, 메일주소와 이름, 추가 프로젝트 체크한 후 Next 클릭

3.7 Resin Configuring & Finish 클릭

3.8 추가가 되었으며, Apply and Close 클릭

3.9 Dyanmic Web Project를 선택하여 Run As > Run on Server 클릭하면 Resin이 보이면 성공입니다.

Jndi 설정법

jndi(Java Naming and Directory interface) 설정 // Was Server 마다 넣는 위치와 포맷이 다름

<database>
  <jndi-name>jdbc/mysql</jndi-name>
  <driver type="com.mysql.jdbc.Driver">
    <url>jdbc:mysql://localhost:3306/database</url>
    <user>user</user>
    <password>password</password>
  </driver>
  <prepared-statement-cache-size>64</prepared-statement-cache-size>
  <max-connections>20</max-connections>
  <max-idle-time>30s</max-idle-time>
</database>
 
<database>
  <jndi-name>jdbc/oracle</jndi-name>
  <driver type="oracle.jdbc.pool.OracleConnectionPoolDataSource">
    <url>jdbc:oracle:thin:@127.0.0.1:1521:xe</url>
    <user>user</user>
    <password>password</password>
    <connectionProperties>
      <SetBigStringTryClob>true</SetBigStringTryClob>
    </connectionProperties>
  </driver>
 
  <prepared-statement-cache-size>64</prepared-statement-cache-size>
  <max-connections>20</max-connections>
  <max-idle-time>30s</max-idle-time>
</database>
 
<database>
  <jndi-name>jdbc/mssql</jndi-name>
  <driver type="com.microsoft.sqlserver.jdbc.SQLServerDriver">
    <url>jdbc:sqlserver:// 127.0.0.1:1433;DatabaseName=database</url>
    <user>user</user>
    <password>password</password>
  </driver>
  <prepared-statement-cache-size>64</prepared-statement-cache-size>
  <max-connections>20</max-connections>
  <max-idle-time>30s</max-idle-time>
</database>
 
<database>
  <jndi-name>jdbc/db2</jndi-name>
  <driver type="com.ibm.db2.jcc.DB2Driver">
    <url>jdbc:db2://127.0.0.1:50000/database</url>
    <user>user</user>
    <password>password</password>
  </driver>
  <prepared-statement-cache-size>64</prepared-statement-cache-size>
  <max-connections>20</max-connections>
  <max-idle-time>30s</max-idle-time>
</database>


사용 예시

<%@ page contentType="text/html; charset=utf-8" %>
<%@ page import="javax.naming.*, java.sql.*, javax.sql.*" %>
<%
String jndi = "java:comp/env/jdbc/mysql";
InitialContext ctx = new InitialContext();    // 현재 실행중인 등록된 컨텍스트를 가져옴
DataSource ds = (DataSource)ctx.lookup(jndi); // 데이터소스 획득 
 
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
 
try
{
   conn = ds.getConnection();
   stmt = conn.createStatement();
   rs = stmt.executeQuery("SELECT name, email, age FROM tb_user");
   while(rs.next())
   {
      out.println(rs.getString("name") + "<br>");
   }
 
}
catch(Exception e)
{
   out.print(e);
}
finally // 리소스 반환
{
   if(rs != null) rs.close(); rs = null;
   if(stmt != null) stmt.close(); stmt = null;
   if(conn != null) conn.close(); conn = null;
}
%>

Tip

Troubleshooting

Ref

/var/services/web/dokuwiki/data/pages/wiki/eclipse/resin.txt · 마지막으로 수정됨: 2023/01/13 18:44 (바깥 편집)