MS에서 제공하는 JDBC Type 4 드라이버인 sqljdbc4.jar를 통해서 DB에 연결하기 위한 내용입니다.
아래는 mssql 2008의 db에 접근하기 위한 connection url string 입니다..
MS의 jdbc사용에 대한 내용은 http://msdn.microsoft.com/en-us/library/ms378526.aspx 에서 참고하시면 됩니다. 그리고, 아래의 4147포트는 SqlServer Configuration Manager를 통해서 TCP/IP 프로토콜에 할당된 포드입니다.
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connUrl = "jdbc:sqlserver://HOST\\SQLEXPRESS:4147;databaseName=testdb;integratedSecurity=true;";
Connection connection = DriverManager.getConnection(connUrl, "id", "pw");
저작자 표시
아융..
DB 연결하기 위해서 Connection Url 세팅하는게 은근히 짜증나네요.. ^^;;
아래는 mssql 2008의 db에 접근하기 위한 connection url string 입니다..
그리고, 아래의 4147포트는 SqlServer Configuration Manager를 통해서 TCP/IP 프로토콜에 할당된 포드입니다.

Class.forName("net.sourceforge.jtds.jdbc.Driver");
String connUrl = "jdbc:sqlserver://HOST\\SQLEXPRESS:4147;databaseName=testdb;integratedSecurity=true;";
Connection connection = DriverManager.getConnection(connUrl, "id", "pw");
저작자 표시

JDBC Type 별 내용

from Java 2010/06/25 15:01
JDBC 1,2,3,4의 타입별 드라이버의 동작 방식과 설명입니다.
개인적으로는 가능한 JDBC4 타입으로 사용하는 것이 좋을듯 합니다.
아래내용은 http://www.precisejava.com/javaperf/j2ee/JDBC.htm#JDBC102 에서 참고를 하였습니다.

 Type
 Tier  Driver mechanism  Description
 1  Two  JDBC-ODBC  This driver converts JDBC calls to ODBC calls through JDBC-ODBC Bridge driver which in turn converts to database calls. Client requires ODBC libraries.
 2  Two  Native API - Partly - Java driver  This driver converts JDBC calls to database specific native calls. Client requires database specific libraries.
 3  Three  JDBC - Net -All Java driver  This driver passes calls to proxy server through network protocol which in turn converts to database calls and passes through database specific protocol. Client doesn't require any driver.
 4  Two  Native protocol - All - Java driver  This driver directly calls database. Client doesn't require any driver.

저작자 표시

'Java' 카테고리의 다른 글

ubuntu(linux) server에서 java 설치하기  (2) 2010/07/20
java signal handling  (0) 2010/07/16
JDBC Type 별 내용  (0) 2010/06/25
외부 API를 JDK에서 내포한 경우, 최신의 외부 API 사용하기..  (0) 2010/06/22
#ifdef #ifndef in Java  (0) 2010/06/15
Tag // java, jdbc, jdbc type
아 ~~~
로그오프를 해야죵.. 혼자만 쓰는게 아닌데 말입니다..
아래의 명령을 이용해서 shadow session으로 접속을 해서 누군지 확인해 봅니다.. ^^;;

mstsc -v:host /f -console

그리곤 터미널 서버스 관리자에서 살포시 세션을 날려줍니다. ^^;;
http://www.sjava.net/97도 참고해 보세요..

저작자 표시
Apache Ant 프로젝트의 서브 프로젝트로 Ivy 프로젝트(http://ant.apache.org/ivy/)가 있습니다.
 Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.
아래의 IvyTest 클래스, ivy.xml을 만들고 build.xml파일에서 resolve target을 실행하게 아래와 같은 결과를 얻을 수 있습니다.

IvyTest.java
package dev;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.WordUtils;

import static java.lang.System.out;

public class IvyTest {

    /**
     * @param args
     */
    public static void main(String[] args) {
        try {
            Option msg = OptionBuilder.withArgName("msg").hasArg().withDescription("the message to capitalize").create("message");
           
            Options options = new Options();
            options.addOption(msg);
   
            CommandLineParser parser = new GnuParser();
            CommandLine line = parser.parse(options, args);
   
            String  message = line.getOptionValue("message", "default message");
            out.println("standard message : " + message);
            out.println("capitalized by " + WordUtils.class.getName() + " : " + WordUtils.capitalizeFully(message));
           
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}


build.xml
<?xml version="1.0"?>
<project name="ivy-test" default="resolve" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
    <property name="project.name" value="ivy-test" />
     <property name="project.version" value="1.0.0" />
     <property name="project.owner" value="mcsong@gmail.com" />
   
    <!-- src -->
    <property name="src.dir" value="src" />
    <property name="src.main.dir" value="src/main" />
    <property name="src.test.dir" value="src/test" />
   
    <!-- build -->
    <property name="build.dir" value="build" />
    <property name="build.main.classes" value="${build.dir}/classes/main" />
    <property name="build.test.classes" value="${build.dir}/classes/test" />
   
    <!-- lib -->
    <property name="lib.dir" value="lib" />
    <property name="lib.ext.dir" value="lib-ext" />
   
    <!-- dist -->
    <property name="dist.dir" value="dist" />
   
    <!-- doc -->
    <property name="doc.dir" value="doc" />
   
    <!-- ivy -->
    <property name="ivy.install.version" value="2.1.0" />
    <property name="ivy.dir" value="ivy" />
    <property name="ivy.jar.file" value="${lib.dir}/ivy-2.1.0.jar" />
   
    <!-- test -->
    <property name="test.dir" value="test" />
   
    <tstamp>
        <format property="time" pattern="yyyyMMdd" />
    </tstamp>
   
    <!-- setting class path -->
    <path id="class.path">
        <pathelement location="${build.main.classes}"/>
        <pathelement location="${build.test.classes}"/>
        <pathelement location="${dist.dir}"/>
        <pathelement location="${lib.dir}"/>
 
        <pathelement location="${lib.dir}/junit.jar"/>
        <pathelement location="${lib.dir}/commons-cli-1.2.jar"/>
        <pathelement location="${lib.dir}/commons-lang-2.5.jar"/>
        <pathelement location="${lib.dir}/ivy-2.1.0.jar"/>
        <pathelement location="${ant.home}/lib"/>
    </path>   
   
    <!-- initialize -->
    <target name="init" description="--> create directories">
        <echo>init target started</echo>
        <mkdir dir="${doc.dir}"/>
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.main.classes}"/>
        <mkdir dir="${build.test.classes}"/>
        <mkdir dir="${test.dir}"/>
        <!--mkdir dir="${test.result.dir}"/>
        <mkdir dir="${test.report.dir}"/-->
        <mkdir dir="${dist.dir}"/>
        <echo>init target completed</echo>
    </target>       
   
    <!-- clean -->
    <target name="clean" description="--> clean created directories">
        <echo>clean target started</echo>       
        <delete dir="${doc.dir}" />
        <delete dir="${build.dir}"/>
        <delete dir="${build.main.classes}"/>
        <delete dir="${build.test.classes}"/>
        <delete dir="${test.dir}"/>
        <!--delete dir="${test.result.dir}"/>
        <delete dir="${test.report.dir}"/-->
        <delete dir="${dist.dir}"/>
        <echo>clean target completed</echo>
    </target>       
   
    <macrodef name="compile_">
        <attribute name="srcdir" />
        <attribute name="destdir" />
        <sequential>
            <javac srcdir="@{srcdir}" destdir="@{destdir}">
                <classpath refid="class.path" />
            </javac>
        </sequential>
    </macrodef>   

       <!-- compile source -->
    <target name="compile" depends="clean, init" description="compile this project">
        <echo>compile target started</echo>
        <compile_ srcdir="${src.main.dir}" destdir="${build.main.classes}" />
        <compile_ srcdir="${src.test.dir}" destdir="${build.test.classes}" />
        <echo>compile target completed</echo>
    </target>   

    <!-- run -->
    <target name="run" depends="compile" description="run the project">
        <echo>run target started</echo>
        <property name="arg.01" value="ivy testing !"/>
        <java classpathref="class.path" classname="dev.IvyTest">
            <arg value="-message"/>
            <arg value="${arg.01}"/>
        </java>
        <echo>run target completed</echo>
    </target>
   
   
    <target name="resolve" depends="init" description="retreive dependencies with ivy">
        <ivy:retrieve />
    </target>       
   
    <target name="report" depends="resolve" description="generates a report of dependencies">
        <ivy:report todir="${build.dir}"/>
    </target>
  
    <target name="clean-cache" description="clean the ivy cache">
        <ivy:cleancache />
    </target>
       
</project>

ivy.xml
<ivy-module version="2.0">
    <info organisation="org.apache" module="hello-ivy"/>
    <dependencies>
        <dependency org="commons-lang" name="commons-lang" rev="2.5"/>
        <dependency org="commons-cli" name="commons-cli" rev="1.2"/>
    </dependencies>
</ivy-module>

결과
Buildfile: C:\dev\works\ivy_test\build.xml
init:
     [echo] init target started
     [echo] init target completed
resolve:
[ivy:retrieve] :: Ivy 2.1.0 - 20090925235825 :: http://ant.apache.org/ivy/ ::
[ivy:retrieve] :: loading settings :: url = jar:file:/C:/Program%20Files/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/ivy-2.1.0.jar!/org/apache/ivy/core/settings/ivysettings.xml
[ivy:retrieve] :: resolving dependencies :: org.apache#hello-ivy;working@LENOVO-FAD74E43
[ivy:retrieve]     confs: [default]
[ivy:retrieve]     found commons-lang#commons-lang;2.5 in public
[ivy:retrieve]     found commons-cli#commons-cli;1.2 in public
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.5/commons-lang-2.5-javadoc.jar ...
[ivy:retrieve] ......
[ivy:retrieve] .......
[ivy:retrieve] .....
[ivy:retrieve] ........
[ivy:retrieve] ........
[ivy:retrieve] ..........
[ivy:retrieve] .........
[ivy:retrieve] ....
[ivy:retrieve] ...
[ivy:retrieve] ....
[ivy:retrieve] ......
[ivy:retrieve] .... (1557kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] commons-lang#commons-lang;2.5!commons-lang.jar(javadoc) (24578ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.5/commons-lang-2.5-sources.jar ...
[ivy:retrieve] ......
[ivy:retrieve] ...... (357kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] commons-lang#commons-lang;2.5!commons-lang.jar(source) (4109ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-lang/commons-lang/2.5/commons-lang-2.5.jar ...
[ivy:retrieve] ........
[ivy:retrieve] ..... (272kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] commons-lang#commons-lang;2.5!commons-lang.jar (5313ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2-sources.jar ...
[ivy:retrieve] ... (47kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] commons-cli#commons-cli;1.2!commons-cli.jar(source) (2203ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2.jar ...
[ivy:retrieve] ... (40kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] commons-cli#commons-cli;1.2!commons-cli.jar (1610ms)
[ivy:retrieve] downloading http://repo1.maven.org/maven2/commons-cli/commons-cli/1.2/commons-cli-1.2-javadoc.jar ...
[ivy:retrieve] .....
[ivy:retrieve] .. (209kB)
[ivy:retrieve] .. (0kB)
[ivy:retrieve]     [SUCCESSFUL ] commons-cli#commons-cli;1.2!commons-cli.jar(javadoc) (3734ms)
[ivy:retrieve] :: resolution report :: resolve 12688ms :: artifacts dl 41562ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      default     |   2   |   2   |   2   |   0   ||   6   |   6   |
    ---------------------------------------------------------------------
[ivy:retrieve] :: retrieving :: org.apache#hello-ivy
[ivy:retrieve]     confs: [default]
[ivy:retrieve]     4 artifacts copied, 2 already retrieved (2171kB/47ms)
BUILD SUCCESSFUL

위의 내용을 통해서, 프로젝트의 의존성 있는 바이너리들을 쉽게 관리(?) 할 수 있을듯 합니다.
개발팀에서 적용하기에는 좀 귀찮은 작업일듯 하나, 개발팀의 모임인 개발실 급의 규모에서는 적용할 만한 기술인거 같네요..

참고로, Ivy 프로젝트의 설치는 아래와 같습니다.
1. 다운로드
2. ivy-2.1.0.jar를 ${ant.home}/lib에 카피를 합니다.
3. eclipse에서 window --> preference --> ant --> runtime --> classpath의 ant home entries에서 add external jars 버튼을 통해서 ivy-2.1.0.jar를 잡아주면 됩니다. 

위 데이타에 대한 리포팅 결과는 아래의 첨부파일을 참고하세요..

* 참고자료
 - 사람을 위한 자동화: Ivy로 의존성 관리하기
저작자 표시
외부 API들이 JDK에 많이 포함이 되어 있습니다.
http://java.sun.com/javase/6/docs/api/ 문서의 package들을 보시면, javax나 org로 시작하는 외부(?) API들을 보실 수가 있는데요.. JDK에서는 rt.jar에 포함되어 잇지만, 아래의 내용처럼, http://aploit.egloos.com/4806304 님의 블로그에 포스팅된 내용을 보시면, 최신의 외부 API를 사용하기 위해서 java.endorsed.dirs 옵션을 사용해서 해결하는 내용을 보실 수가 있습니다.
java로 작업을 하다보면 가끔씩 endorsed라는 디렉토리 명이 보였다. 사전을 찾아보면 배서하다, 추천하다, 양도하다 정도의 뜻이고, 사전적 의미가 아닌 java쪽에서는 어떤 의미로 사용되는지 몰랐다.

그냥 몰라도 별 문제는 없었고 해서 그냥 넘어갔었다.

그런데 의미를 확실히 알게 되었다. 

jdk1.4에는 JAXP1.2의 라이브러리들이 포함되어 있다. 대표적으로 org.w3c.dom의 패키지와 javax.xml의 패키지가 그것이다.

그런데 JAXP1.3, 1.4가 나왔고, jdk1.4의 환경에서 이들을 사용하고자 할 경우에 문제가 된다.
(참고로 JAXP1.3은 JDK5.0에 JAXP1.4는 JDK6.0에 포함되었다. 따라서 JDK5.0에서는 JAXP1.3 라이브러리를 따로 설치할 필요가 없다.) jdk는 1.4이고 어플리케이션에서 JAXP1.3을 설치했다고 하면(구체적인 jar 파일은 jaxp-api.jar와 jaxp-ri.jar이다) 같은 패키지 이름까지 같은 클래스가 2개 존재하게된다. 예를 들면 org.w3c.dom.Document이다. 하나는 rt.jar에 있는 것이고(버전은 JAXP1.2) 하나는 jaxp-api.jar에 있는 것이다(요 버전은 JAXP1.3). 원했던 것은 rt.jar의 것이 아닌 jaxp-api.jar의 것이 로딩되는것이였는데, 그렇게 동작하지 않는다. 설치한 라이브러리들 간의 로딩 순서는 classpath에 설정한 순서로 조절할 수 있지만, rt.jar는 설정 순서로 조절할 수 없다.

JDK 자체에 포함된 것이 아닌 설치한 라이브러리의 것을 로딩할때 사용하는 매커니즘이 바로 endorsed이다. "java.endorsed.dirs"라는 시스템 파라매터를 설정하면 된다. 다음과 같이 java를 실행할 때 jaxp-api.jar가 있는 디렉토리를 설정해 주면 된다.
java -Djava.endorsed.dirs=/path/where/jar/is ......
여기서 /path/where/jar/is 디렉토리는 jaxp-api.jar가 있는 곳이다.

TOMCAT의 경우 endorsed 매카니즘을 사용하고 있다. tomcat 4.1.39의 bin/setclasspath.bat에서 set JAVA_ENDORSED_DIRS=%BASEDIR%\common\endorsed 으로 endorsed 디렉토리를 설정하고 catalina.bat에서 다음과 같이 java 실행 시에 시스템 파라매터로 설정해 주고 있다.
%_EXECJAVA% ... -Djava.endorsed.dirs="%JAVA_ENDORSED_DIRS%"

TOMCAT_HOME/common /endorsed에 가보면 xercesImpl.jar, xml-apis.jar가 있는데 이들은 JAXP 1.3의 것이다.


참 고로 클래스로딩의 매카니즘에서 "java." 로 시작하는 패키지의 클래스는 endorsed가 적용되지 않는다.


JAXP 에 대한 기타.
JAXP1.4가 설치되어 있다면 apache xalan의 다음과 같은 라이브러리들을 따로 설치할 필요 없다. JAXP안에 포함되어 있기 때문이다. 설치할 필요가 없는 것 보다는 쫑나는 상황을 피하기 위하여 설치해서는 안된다.
  serializer.jar
  xalan.jar
  xercesImpl.jar
  xml-apis.jar
  xsltc.jar

jaxp 는 sun의 glassfish 프로젝트에서 관리하고 있다.
저작자 표시

'Java' 카테고리의 다른 글

java signal handling  (0) 2010/07/16
JDBC Type 별 내용  (0) 2010/06/25
외부 API를 JDK에서 내포한 경우, 최신의 외부 API 사용하기..  (0) 2010/06/22
#ifdef #ifndef in Java  (0) 2010/06/15
멀티쓰레드 프로그램 평가기준  (0) 2010/06/01
storage-conf.xml 의  <ClusterName>을 Cluster1으로 바꾸니 에러가 나네요.. ^^;;
아래처럼요....
INFO 10:00:53,760 Saved ClusterName found: Test Cluster
ERROR 10:00:53,760 ClusterName mismatch: Test Cluster != Cluster1

storage-conf.xml의 <DataFileDirectory>에서 설정한 위치의 하위 디렉토리인 system 디렉토리의 LocationInfo 파일들 다 지우면 된다고 하네요..

저작자 표시

무료 CAPTCHA 서비스

from Tools 2010/06/16 18:29
무료로 CAPTCHA 서비스를 이용할 수 있는 reCAPTCHA 라는 서비스가 있네요.. ^^
아래 그림과 같은 형태로, 웹에서 회원가입이나 스팸성 기능을 제한하기 위해서 사용하면 될거 같습니다.
http://www.recaptcha.net/resources.html에서 쉽게 사용할 수 있도록 대부분의 환경을 지원하고 있습니다. ^^


저작자 표시

'Tools' 카테고리의 다른 글

jtds를 이용해서 db 연결하기 with mssql 2008  (0) 2010/06/25
eclipse에서 apache ivy로 binary 의존성 확인  (0) 2010/06/22
무료 CAPTCHA 서비스  (0) 2010/06/16
json simple library  (0) 2010/05/18
java c/c++, c# 호출방식  (0) 2010/04/29
Cassandra.Client는 http://incubator.apache.org/thrift/ 를 이용해서 Cassandra에 데이타를 insert하고 select하는 inner 클래스 입니다. Cassandra.Client를 생성하고 사용하기 위해서 제가 사용하는 CassandraClientFactory 클래스는 아래와 같습니다.

import org.apache.cassandra.thrift.Cassandra;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

public class CassandraClientFactory {
    private final String SERVER = "localhost";
    private final int PORT = 9160;
   
    // inner class
    private Cassandra.Client client;
    // singleton instance   
    private static CassandraClientFactory instance = new CassandraClientFactory();
   
    private CassandraClientFactory() {
        try {
            TTransport socket = new TSocket(SERVER, PORT);
            //out.println(String.format("connected to %s : %d .", SERVER, PORT));
            TBinaryProtocol binaryProtocol = new TBinaryProtocol(socket, false, false);
            this.client = new Cassandra.Client(binaryProtocol);
            socket.open();
        } catch(org.apache.thrift.transport.TTransportException e) {
            e.printStackTrace();
        }
    }
   
    public static CassandraClientFactory getInstance() {
        return instance;
    }

    public Cassandra.Client getClient() {
        return this.client;
    }
}

저작자 표시

CAP Theorem

from Lectures 2010/06/16 14:39
CAP Theorem은 분산 시스템이 갖추면 좋은 3가지의 특성입니다 .
wikipedia에 정리된 CAP Theorem의 특성은 아래와 같습니다.

Consistency : all nodes see the same data at the same time
Availability : node failures do not prevent survivors from continuing to operate
Partition Tolerance : the system continues to operate despite arbitrary message loss

흠,, 대충 C, A는 알겠는데, Partition Tolerance는 생소하네요..
Partition Tolerance에 대해서 살펴보니, http://devblog.streamy.com/tag/partition-tolerance/에 잘 설명이 되어 있네요..

Partition tolerance refers to the ability for a system to continue to operate in the presence of a network partitions.  For example, if I have a database running on 80 nodes across 2 racks and the interconnect between the racks is lost, my database is now partitioned.  If the system is tolerant of it, then the database will still be able to perform read and write operations while partitioned.  If not, often times the cluster is completely unusable or is read-only.
모, 대충 이해하기로 네트웍의 문제로 인해서 정말로 서비스하는 노드가 분리(partition)되어서 잘 동작(tolerance)을 해야 된다는 얘기인듯..

그리고, 분산 시스템은 위의 CAP Theorem의 3가지 특성을 만족시킬 수 없기 때문에, 한가지 특성은 포기를 해야 한다고 하는  Brewer's CAP Theorem도 있네요..

위 내용은 분산시스템에 대한 기본적인 이론이라서, 꼭 알아둘 필요가 있을거 같습니다.
추후 NOSQL 관련 시스템 공부를 위해서.. ^^
저작자 표시

'Lectures' 카테고리의 다른 글

NOSQL 정리  (0) 2010/07/06
CI(Continuous Integration)  (0) 2010/07/05
CAP Theorem  (0) 2010/06/16
Reentrant 와 Thread-safe 의 차이  (0) 2010/04/29
uml - relationships image  (0) 2010/04/17

#ifdef #ifndef in Java

from Java 2010/06/15 17:30
C구문의 전처리 구문인 #ifdef나 #ifndef같은 넘을 자바에서 사용하는 기본적인 내용입니다.
아래처럼 println이 DEF가 정의되었냐 혹은 DEBUG모드냐에 따라 달라지는 형태로 되어 있는 구문인 경우
public class IFDef{
public IFDef(){
 int i = 100;
 #ifdef DEF
  System.out.println("DEF");
 #else
  System.out.println("not DEF");
 #endif  
 }
}

아래처럼, 바꿔주면 됩니다.
private static final boolean def = false;

if (def) {
System.out.println("DEF");
} else {
System.out.println("not DEF");
}

Tag // ifdef, ifndef, java
mssql 2008을 ibatis에서 사용하기 위한 세팅입니다.
흠.. mssql을 잘 몰라서 포트 세팅하는데 힘들었네요.. ^^;;
전에는 default port가 1433이었는데..

Sql Server Configuration Manager --> SQL Server 네트워크 구성 --> TCP/IP 사용의 속성창을 보시면 아래의 화면이 나옵니다.. 그리고 TCP 동적포트로 접근을 하시면 됩니다.. ^^;;



<sqlMapConfig>
    <transactionManager type="JDBC" commitRequired="false">
        <dataSource type="SIMPLE">
            <property name="JDBC.Driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <property name="JDBC.ConnectionURL" value="jdbc:sqlserver://computer-name\SQLEXPRESS:4147;databaseName=testdb;integratedSecurity=true;"/>
            <property name="JDBC.Username" value="id"/>
            <property name="JDBC.Password" value="password"/>
            <property name="Pool.MaximumIdleConnections" value="5"/>
            <property name="Pool.MaximumCheckoutTime" value="120000"/>
            <property name="Pool.TimeToWait" value="500"/>
        </dataSource>
    </transactionManager>
    <sqlMap resource="article.xml"/>
</sqlMapConfig>

그리고, 혹시  경고: Failed to load the sqljdbc_auth.dll 메세지를 뿌르게 되면..
플랫폼에 맞는 sqljdbc_auth.dl를 windows\system32폴더에 카피를 하시면 됩니다. 
유명한 Doug Lea 교수님의 멀티 쓰레드 프로그램의 평가기준에 대한 내용입니다.
"Java 언어로 배우는 디자인 패턴 입문 멀티 쓰레드편, Yuki Hiroshi" 의 Introduction 2 챕터에 나오는 내용입니다. 아래 내용의 출처는 http://ethdemor.springnote.com/pages/4349969 입니다.

아래의 기준들은 Doug Lea 분류를 기준으로 한 것이며, 이런 류의 평가 기준은 대개 상반(trade-off)되는 경우가 있습니다.

필 수
안전성 (safety) - 객체를 망가트리지 않을 것
 - "망가 진다"는 것은 비유적 표현으로 객체의 필드가 예상 외의 값을 취하는 것을 의미합니다.
 - 복수의 스레드가 이용해도 안전성이 유지되는 클래스를 스레드 세이프(thread-safe)한 클래스라고 하며 자바 API에는 명시되어 있습니다.
생존성 (liveness) - 필요한 처리가 이뤄질 것

옵 션
재사용성 (resuability) - 클래스를 다시 사용할 수 있는 것
 - 멀티 스레드 프로그램에서는 스레드 배타제어, 구조, 방침을 캡슐화 하는 것이 관건이며 Java SE 5.0의 java.util.concurrent 패키지에서 이를 잘 실현하고 있습니다.
 - 수행 능력(performance) - 고속 / 대량으로 처리할 수 있을 것
   - throughput - 단위 시간 당 처리 수
   - 응답성 (responsiveness) - 요청을 한 뒤 반응이 나타날 때까지 걸리는 시간
      - GUI 프로그램에서는 요청의 완료까지 걸리는 시간보다 처리 시작까지의 시간을 중요하게 생각하기도 합니다. 여기서 완료는 요청 -> 처리 -> 응답 까지의 시간이며 처 리 시작은 완료까지의 시간은 좀 더 걸리더라도 클라이언트에게 먼저 응답(~을 처리 중입니다 등)을 보내는 것을 말합니다.
      - 응답성이 높은 프로그램은 대기 시간(latency)이 짧다고 표현합니다.
   - 용량 (capacity) - 동시에 처리할 수 있는 수
   - 그 밖에 효율(efficiency), 확장성(scalability), 저하(degradation) 등이 있습니다.

평가기준 정리
멀티 스레드 시스템에서 안전성과 생존성이 지켜지지 않으면 제대로된 프로그램이라고 할 수 없습니다.
따라서 이 필수 조건을 만족한 상태에서 재사용성과 수행 능력을 어떻게 높이느냐가 관건이 되겠습니다.




'Java' 카테고리의 다른 글

외부 API를 JDK에서 내포한 경우, 최신의 외부 API 사용하기..  (0) 2010/06/22
#ifdef #ifndef in Java  (0) 2010/06/15
멀티쓰레드 프로그램 평가기준  (0) 2010/06/01
간단한 SOAP 메시지 콜  (0) 2010/05/26
garbage collector  (0) 2010/04/29

특수문자 네이밍

from 분류없음 2010/06/01 10:16
특수문자 네이밍에 대한 내용입니다.
아래 내용의 출처는 http://mimul.com/pebble/default/2009/07/07/1246961520000.html 입니다.

& : Ampersand (앰퍼샌드)
, : Apostrophe (어파스트로피)
* : Asterisk (애스터리스크)
. : Period (피리어드), Full Stop (풀스탑)
! : Exclamation Point (엑스클러메이션 포인트)
" : Quotation Mark (쿼테이션 마크)
# : Crosshatch (크로스해치), Sharp(샵), Pound Sign(파운드 사인)
$ : Dollar Sign (달러사인)
% : Percent Sign (퍼센트사인)
@ : At Sign (앳 사인, 혹은 앳), Commercial At(커머셜 앳)
/ : Slash (슬래시), Virgule (버귤)
\:  Back Slash (백슬래시)
\ : Won sign (원사인)
: : Colon (콜론)
; : Semicolon (세미콜론)
^ : Circumflex (서컴플렉스)
` : Grave (그레이브)
{ : Left Brace (레프트 브레이스)
} : Right Brace (라이트 브레이스)
[ : Left Bracket (레프트 브래킷)
] : Right Bracket (라이트 브래킷)
( : Left Parenthesis (레프트 퍼렌씨시스)
) : Right Parenthesis (라이트 퍼렌씨시스)
| : Vertical Bar (버티컬바)
~ : Tilde (틸드)
= : Equal Sign (이퀄사인)
+ : Plus Sign (플러스사인)
- : Minus Sign (마이너스사인) Hyphen (하이픈), Dash (대시)
_ : Underscore (언더스코어), Underline (언더라인)
< : Less Than Sign (레스댄 사인), Left Angle Bracket(레프트 앵글브래킷)
> : Greater Than Sign (그레이터댄 사인), Right Angle Bracket (라이트 앵글브래킷)

Tag // 특수문자