2013년 10월 29일 화요일

Mac에서 MySQL ssh 포트 포워딩

Mac에서 ssh 포트 포워딩을 이용하여 접속할 수 있도록 한다.

ssh -f root@210.112.127.51 -L 3305:localhost:3306 -N 

-f 는 백그라운드로 실행하라는 의미이다.

mysql에서는 다음과 같이 접속한다.

driver=org.gjt.mm.mysql.Driver
url=jdbc:mysql://localhost:3305/데이터베이스이름
username=계정아이디
password=계정암호

JBoss 7.1.0 AS startup / shutdown

JBoss AS 7.1.0 서버의 시작

$ cd JBOSS_HOME/bin 경로로 이동한다.
$ nohup ./standalone.sh &


JBoss AS 7.1.0 서버의 셧다운 

$ cd JBOSS_HOME/bin
$ ./jboss-admin.sh --connect command=:shutdown

또는

$ ./jboss-admin.sh --connect --controller=127.0.0.1:1999 command=:shutdown

JavaDoc 생성 시 unmapped UTF-8 오류 날 때

이클립스에서 JavaDoc 생성 시 VM Option 항목에 아래와 같이 기록한다.

-locale ko_KR -encoding UTF-8 -charset UTF-8 -docencoding UTF-8

iBatis Mapping a composite key

Composite Keys or Multiple Complex Parameters Properties

You might have noticed that in the above examples there is only a single key being used as specified in the resultMap by the column attribute. This would suggest that only a single column can be associated to a related mapped statement. However, there is an alternate syntax that allows multiple columns to be passed to the related mapped statement. This comes in handy for situations where a composite key relationship exists, or even if you simply want to use a parameter of some name other than #value#. The alternate syntax for the column attribute is simply {param1=column1, param2=column2, …, paramN=columnN}. Consider the example below where the PAYMENT table is keyed by both Customer ID and Order ID:


Example. Mapping a composite key

<resultMaps>  
    <resultMap id="select-order-result" class="order">    
        <result property="id" column="ORD_ID"/>    
        <result property="customerId" column="ORD_CST_ID"/>    
        …    
        <result property="payments" column="itemId=ORD_ID, custId=ORD_CST_ID"             select="selectOrderPayments"/>  
    </resultMap>
<resultMaps>

<statements>  
    <statement id="selectOrderPayments" resultMap="select-payment-result">    
    select 

        * 
    from 
        PAYMENT
    where
        PAY_ORD_ID = #itemId#
        and
        PAY_CST_ID = #custId#  
    </statement>
</statements>


JBoss AS 7 v7.1.0 사용자 등록

JBOSS_HOME/bin/add-user.sh

JBoss AS 7에서 URIEncoding 설정

참고 URL : http://jboss7-oracle.blogspot.com/




Old way: <Connector name="http" ... URIEncoding="UTF-8" useBodyEncodingForURI="true"/>
 This can be edited in standalone.xml file to take effect in old way

New Way:

In Jboss7 there are 2 methods by which you can add these:

Method 1:

Using the jboss-admin.sh adn updating the system-property like:

[standalone@amghost3.cup.com:9009 /] 
/system-property=org.apache.catalina.connector.URI_ENCODING:add(value="UTF-8")
{"outcome" => "success"}


[standalone@amghost3.cup.com:9009 /] 
/system-property=org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING:add(value="true")
{"outcome" => "success"}
[standalone@amghost3.cup.com:9009 /] 

Verify these property by:

[standalone@amghost3.cup.com:9009 /]  /system-property=org.apache.catalina.connector.URI_ENCODING:read-resource
{
    "outcome" => "success",
    "result" => {"value" => "UTF-8"}
}
[standalone@amghost3.cup.com:9009 /] 

[standalone@amghost3.cup.com:9009 /]  /system-property=org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING:read-resource
{
    "outcome" => "success",
    "result" => {"value" => "true"}
}
[standalone@amghost3.cup.com:9009 /] 


Method 2:

cd $JBOSS_HOME/standalone/configuration

vi standalone.xml   ad add the following lines just below the </extensions>

    <system-properties>
        <property name="org.apache.catalina.connector.URI_ENCODING" value="UTF-8"/>
        <property name="org.apache.catalina.connector.USE_BODY_ENCODING_FOR_QUERY_STRING" value="tru
e"/>
    </system-properties>

JBoss AS 7 외부 접속가능하게 설정

JBOSS_HOME/standalone/configuration/standalone.xml

<interface name="public">
    <inet-address value="${jboss.bind.address:127.0.0.1}"/>
</interface>

부분을 아래와 같이 변경한다.

<interface name="public">
    <any-address/>
</interface>