캠핑과 개발

월드컵 조추첨

낙서장2009. 12. 5. 17:39



드디어 남아공 월드컵 조추첨을 했네요.
아침에 눈 뜨니 여기저기에서 전력분석 기사를 내 놓고 각 조에 대한 평가를 하는데 벌써 부터 기대가 됩니다.
한국은 B조에 편성이 되었는데 약팀들은 아니지만 나름대로 선전을 하면 16강에 오르지 않을까 생각이 되네요. 
제가 생각하기엔 1승 2무 정도 되지 않을까요?
그리고 북한.. G조 죽음의 조입니다.
정말 최악입니다. 다들 강팀이라니 16강은 아니더라도 후회없는 경기를 할수 있을꺼 같습니다.
언제 이런 최고의 선수들과 맞붙을수 있을까요? 준비를 많이 해서 재밌는 경기를 보여줬으면 좋겠네요.

E조의 일본도 나름 괜찮아 보입니다.
하지만 올라가지 않았으면 좋겠네요 기본좋게 1무 2패정도...
그냥 제 생각입니다.ㅡ,.ㅡ;;

전세계가 열관하는 내년 6월이 어서 빨리 왔으면 좋겠습니다.


 

'낙서장' 카테고리의 다른 글

아이폰(Iphone)으로 원격접속  (0) 2009.12.15
기상용어  (0) 2009.12.07
화나는 아이폰 미개통 상황  (0) 2009.12.03
Coming soon iphone..  (0) 2009.11.26
iphone 지르다.  (0) 2009.11.24


java.util.Properties 파일 사용 예제

package kr.pe.anaconda.test.io.file;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * @author diem
 * 
 */
public class PropertiesSample {

	private static String defaultPropertiesPath = "c:\\example.properties";

	public static String getDefaultPropertiesPath() {
		return defaultPropertiesPath;
	}

	public static void setDefaultPropertiesPath(String defaultPropertiesPath) {
		PropertiesSample.defaultPropertiesPath = defaultPropertiesPath;
	}

	public static String getKey(String key) throws Exception {

		// ClassLoader.getResourceAsStream("some/pkg/resource.properties");
		// Class.getResourceAsStream("/some/pkg/resource.properties");
		// ResourceBundle.getBundle("some.pkg.resource");
		String value = null;
		InputStream is = new FileInputStream(defaultPropertiesPath);
		Properties p = null;
		try {
			p = new Properties();
			p.load(is);
			value = p.getProperty(key);
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally {
			try {is.close();} catch (IOException e) {}
		}
		return value;
	}

	/**
	 * 프로퍼티 파일에 사용자 값을 넣는다.
	 */
	public static void putPropertie(Map paramMap)
			throws FileNotFoundException, IOException {
		// 프로퍼티 파일 경로 key
		String propertiesKey = "properties.file.path";
		Properties proper = null;
		FileOutputStream output = null;
		try {
			String comment = paramMap.get("properties.comment");
			// 사용자가 프로퍼티 파일 경로를 넘기지 않을 경우 default properties로 셋팅하다.
			if (!paramMap.containsKey(propertiesKey)) {
				paramMap.put(propertiesKey, defaultPropertiesPath);
			}
			output = new FileOutputStream(paramMap.get(propertiesKey));
			// paramMap.remove(propertiesKey);
			proper = new Properties();
			proper.putAll(paramMap);
			proper.store(output, comment);
		} catch (FileNotFoundException fnfe) {
			throw new FileNotFoundException("properties 파일을 찾을수 없습니다.");
		} catch (IOException ioe) {
			throw new IOException("putPropertie Exception!", ioe);
		} finally {
			try {
				output.close();
			} catch (IOException e) {
			}
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception {
		// TODO Auto-generated method stub
		Map paramMap = new HashMap();
		paramMap.put("properties.file.path", "c:\\example12.properties");
		paramMap.put("name", "홍길동");
		paramMap.put("age", "31");
		paramMap.put("phone", "0111234567");
		PropertiesSample.putPropertie(paramMap);

		PropertiesSample.setDefaultPropertiesPath(paramMap
				.get("properties.file.path"));

		System.out.println(PropertiesSample.getDefaultPropertiesPath());
		System.out.println(PropertiesSample.getKey("name"));
	}
}


날씨가 조금 추워지네요..
요즘 아이폰 만지는 재미에 아침이 밝아 오는지도 모르고 유용한 어플을 찾아서 헤매고 있습니다. 이제 좀 정신좀 차려야 되는데 말이죠.. ㅜㅜ

간단하게 ResourceBundle을 사용하는 법을 올려봅니다.
좀 더 사용하기 쉽게 만들수도 있겠지만 그건 개인에 따라서 수정하면 될테고 어떻게 사용되는지만 알면 수정은 쉬우니까요^^


package pe.kr.anaconda.hmjkor.util;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.ResourceBundle;

/**
 * @author diem
 *
 */
public class ResourceUtil {
	
	
	/*
	 * url.properties
	 * url = http://hmjkor.tistory.com
	 */
	private static final String CONF_PATH = "config.url";	
	private static ResourceBundle resource = ResourceBundle.getBundle(CONF_PATH);
	private static HashMap sourceMap = new HashMap();
	
	static{
		Enumeration enu = resource.getKeys();
		String key = null;
		while(enu.hasMoreElements()){
			key = enu.nextElement();
			sourceMap.put(key, resource.getString(key));
		}		
	}	
	public static String getKey(String key){
		return sourceMap.get(key);
	}
	
	public static Map getSourceMap(){
		return sourceMap;
	}
	
	public static void main(String args){
		System.out.println(ResourceUtil.getKey("url"));
	}
}

월요일에 아이폰을 받았는데 오늘이 목요일인데 아직도 미개통 상태입니다.
어째서 이럴수가 있는건지..

개통 알림 문자도 못받았고..

고객센터에 여러번 전화를 해봐도 순차적으로 처리를 하니 기다리라는 말만 하는군요.
23일 오전에 예약을 했는데 언제까지 기다려야 하는건지..
그래도 친절하게 상담해주시니 화도 낼수 없고.

근데 주위에 저보다 하루 늦게 예약하신 분이 있더군요..
24일 저녁에 예약을 했다고 하는데 벌써 개통이 되었답니다..
그분도 SKT -> KTF 로 옮겼다고 하고 상황이 저랑 똑같은데 순차적으로 개통이 된다고 하면서 어째서 그분이 먼저 개통이 되는건가요??

통신사 까지 옮겨 가면서 예약을 했는데 벌써부터 KT에 신뢰가 가지 않는 상황입니다.
적어도 내가 언제쯤 개통이 될지 아니면 앞에 얼마나 남아야 되는지는 알아야 개통시점을 가늠하고 답답해 하지 않을텐데요.

순차적으로 개통된다하면서도 순자적이지 못한 이런 상황이 정말 화가 납니다.
 내부적으로 어떻게 진행되는지도 알수가 없네요.
전혀 순차적으로라는 말만 하는데 정말 화가나네요.
고객센터에 전화만 벌써 4번째입니다.

지금 내 손에 있는건 전화 기능이 있는 그냥 아이팟일 뿐입니다.




'낙서장' 카테고리의 다른 글

기상용어  (0) 2009.12.07
월드컵 조추첨  (0) 2009.12.05
Coming soon iphone..  (0) 2009.11.26
iphone 지르다.  (0) 2009.11.24
네이트온 피해 사례 두번째  (0) 2009.11.05

 파일 클래스 속성 및 사용법

1. File 클래스 및 속성
package kr.pe.anaconda.test.io.file;

import java.io.File;
import java.io.IOException;

/**
 * File 클래스 사용법 및 속성
 * @author diem
 *
 */
public class FileEx1 {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		File f = new File("c:\\logs\\123.txt");
		
		String fileName = f.getName();
		int pos = fileName.lastIndexOf(".");
		
		System.out.println("경로를 제외한 파일 이름 : " + f.getName());
		System.out.println("확장자를 제외한 파일 이름 : " + fileName.substring(0, pos));
		System.out.println("확장자 : " + fileName.substring(pos + 1));
		System.out.println("경로를 포함한 파일이름 : " + f.getPath());
		System.out.println("파일의 절대경로 : " + f.getAbsolutePath());
		System.out.println("파일이 속해 있는 경로 : " + f.getParent());
		System.out.println();
		System.out.println("File.pathSeparator : " + File.pathSeparator);
		System.out.println("File.pathSeparatorChar : " + File.pathSeparatorChar);
		System.out.println("File.separator : " + File.separator);
		System.out.println("File.separatorChar : " + File.separatorChar);
		System.out.println();
		System.out.println("user.dir : " + System.getProperty("user.dir"));
		System.out.println("sun.boot.class.path : " + System.getProperty("sun.boot.class.path"));
	}
}


2. 파일 리스트
package kr.pe.anaconda.test.io.file;

import java.io.File;

/**
 * 디렉터리 리스트
 * @author diem
 *
 */
public class FileEx2 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		if(args.length != 1){
			System.out.println("USAGE : java FileEx2 DIRECTORY");
			System.exit(0);
		}
		File f = new File("c:\\log");
		//File f = new File(args[0]);
		
		if(!f.exists() || !f.isDirectory()){
			System.out.println("유효하지 않은 디렉토리입니다.");
			System.exit(0);
		}
		
		File[] files = f.listFiles();
		
		for(int i = 0; i < files.length; i++){
			String fileName = files[i].getName();
			System.out.println(files[i].isDirectory() ? "["+ fileName +"]" : fileName);
		}
	}
}

3. 파일 디렉터리의 파일 갯수와 디렉터리 숫자 보여주기
package kr.pe.anaconda.test.io.file;

import java.io.File;
import java.util.ArrayList;

/**
 * 특정 디렉터리의 파일의 갯수와 디렉터리의 숫자를 보여준다.
 * @author diem
 *
 */
public class FileEx3 {

	static int totalFiles = 0;
	static int totalDirs = 0;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub	
		
		if(args == null || args.length == 0){
			args = new String[1];
		}
		
		System.out.println(args.length);
		
		args[0] = "c:\\logs";
		
		if(args.length != 1){
			System.out.println("USAGE : java FileEx3 DIRECTORY");
			System.exit(0);
		}
		
		File dir = new File(args[0]);
		if(!dir.exists() || !dir.isDirectory()){
			System.out.println("유효하지 않은 디렉토리입니다.");
			System.exit(0);
		}
		
		printFileList(dir);
		System.out.println();
		System.out.println("총 " + totalFiles + "개의 파일");
		System.out.println("총 " + totalDirs + "개의 디렉터리");
		
	}

	public static void printFileList(File dir) {
		System.out.println(dir.getAbsolutePath() + " 디렉터리");
		File[] files = dir.listFiles();
		
		ArrayList subDir = new ArrayList();
				
		for(int i = 0; i < files.length; i++){
			String fileName = files[i].getName();
			if(files[i].isDirectory()){
				fileName = "["+ fileName +"]";
				subDir.add(i+"");
			}
			System.out.println(fileName);
		}
		
		int dirNum = subDir.size();
		int fileNum = files.length - dirNum;
		
		totalFiles += fileNum;
		totalDirs += dirNum;
		
		System.out.println(fileNum + "개의 파일, " + dirNum + "개의 디렉터리");
		System.out.println();
		
		for(int i = 0; i < subDir.size(); i++){
			int index = Integer.parseInt((String)subDir.get(i));
			printFileList(files[index]);
		}
	}
}

4. 파일 리스트를 출력

package kr.pe.anaconda.test.io.file;

import java.io.File;
import java.text.SimpleDateFormat;

/**
 * 파일 리스트를 출력한다.
 * 출력시 파일의 속성과 수정일을 함께 출력한다.
 * @author diem
 *
 */
public class FileEx4 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub	
		String currDir = System.getProperty("user.dir");
		File dir = new File(currDir);
		
		File[] files = dir.listFiles();
		
		for(int i = 0; i < files.length; i++){
			File f = files[i];
			String name = f.getName();
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mma");
			String attribute = "";
			String size = "";
			
			if(files[i].isDirectory()){
				attribute = "DIR";
			}else{
				size = f.length() + "";
				attribute = f.canRead() ? "R" : "";
				attribute += f.canWrite() ? "W" : "";
				attribute += f.isHidden() ? "H" : "";
			}
			
			System.out.printf("%s %3s %6s %s\n", df.format(f.lastModified()), attribute, size, name);
		}
	}
}

5. 파일 정렬
package kr.pe.anaconda.test.io.file;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Comparator;

/**
 * 파일 정렬을 한다.
 * @author diem
 *
 */
public class FileEx5 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		if (args.length != 1 || args[0].length() != 1
				|| "tTlLnN".indexOf(args[0]) == -1) {
			System.out.println("USAGE : java FileEx5 SORT_OPTION ");
			System.out.println("	SORT_OPTION : 				");
			System.out.println(" 	t Time asending sort.		");
			System.out.println("	T Time descending sort.		");
			System.out.println("	l Length ascending sort.	");
			System.out.println("	L Length descending sort.	");
			System.out.println("	n Name asending sort.		");
			System.out.println("	N Name descending sort.		");
		}

		final char option = args[0].charAt(0);

		String currDir = System.getProperty("user.dir");
		File dir = new File(currDir);

		File[] files = dir.listFiles();

		Comparator comp = new Comparator() {
			public int compare(Object o1, Object o2) {
				long time1 = ((File) o1).lastModified();
				long time2 = ((File) o2).lastModified();

				long length1 = ((File) o1).length();
				long length2 = ((File) o2).length();

				String name1 = ((File) o1).getName().toLowerCase();
				String name2 = ((File) o2).getName().toLowerCase();

				int result = 0;

				switch (option) {
				case 't':
					if (time1 - time2 > 0)
						result = 1;
					else if (time1 - time2 == 0)
						result = 0;
					else if (time1 - time2 < 0)
						result = -1;
					break;
				case 'T':
					if (time1 - time2 > 0)
						result = -1;
					else if (time1 - time2 == 0)
						result = 0;
					else if (time1 - time2 < 0)
						result = 1;
					break;
				case 'l':
					if (length1 - length2 > 0)
						result = -1;
					else if (length1 - length2 == 0)
						result = 0;
					else if (length1 - length2 < 0)
						result = 1;
					break;
				case 'L':
					if (length1 - length2 > 0)
						result = 1;
					else if (length1 - length2 == 0)
						result = 0;
					else if (length1 - length2 < 0)
						result = -1;
					break;
				case 'n':
					result = name1.compareTo(name2);
					break;
				case 'N':
					result = name2.compareTo(name1);
					break;
				}
				return result;
			}

			public boolean equals(Object o) {
				return false;
			}
		};

		Arrays.sort(files, comp);

		for (int i = 0; i < files.length; i++) {
			File f = files[i];
			String name = f.getName();
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mma");
			String attribute = "";
			String size = "";

			if (files[i].isDirectory()) {
				attribute = "DIR";
			} else {
				size = f.length() + "";
				attribute = f.canRead() ? "R" : "";
				attribute += f.canWrite() ? "W" : "";
				attribute += f.isHidden() ? "H" : "";
			}

			System.out.printf("%s %3s %6s %s\n", df.format(f.lastModified()),
					attribute, size, name);
		}
	}
}


6. 특정 확장자를 가진 파일 출력
package kr.pe.anaconda.test.io.file;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;

/**
 * 특정 확장자를 가진 파일을 출력한다.
 * @author diem
 *
 */
public class FileEx6 {

	static int found = 0;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length != 2) {
			System.out.println("USAGE : java FileEx6 DIRECTORY KEYWORD");
			System.exit(0);
		}

		File dir = new File(args[0]);
		String keyword = args[1];

		if (!dir.exists() || !dir.isDirectory()) {
			System.out.println("유효하지 않은 디렉터리 입니다.");
			System.exit(0);
		}

		try {
			findInFiles(dir, keyword);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void findInFiles(File dir, String keyword) throws IOException {
		// TODO Auto-generated method stub
		File[] files = dir.listFiles();

		for (int i = 0; i < files.length; i++) {
			if (files[i].isDirectory()) {
				findInFiles(files[i], keyword);
			} else {
				//파일이름
				String filename = files[i].getName();
				//파일 확장자
				String extension = filename
						.substring(filename.lastIndexOf(".") + 1);
				extension = "," + extension + ",";
				
				if(",java,txt,bak,".indexOf(extension) == -1) continue;
				
				filename = dir.getAbsolutePath() + File.separator + filename;
				
				FileReader fr = new FileReader(files[i]);
				BufferedReader br = new BufferedReader(fr);
				
				String data = "";
				int lineNum = 0;
				
				while((data = br.readLine()) != null){
					lineNum++;
					if(data.indexOf(keyword) != -1){
						found++;
						System.out.println("["+filename+"("+lineNum+") ]" + data);
					}					
				}
				br.close();
			}
		}
	}
}

7. 특정한 이름을 포함한 파일의 목록을 출력

package kr.pe.anaconda.test.io.file;

import java.io.File;
import java.io.FilenameFilter;

/**
 * 특정한 이름을 포함한 파일의 목록을 보여준다.
 * @author diem
 *
 */
public class FileEx7 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length != 1) {
			System.out.println("USAGE : java FileEx7 pattern");
			System.exit(0);
		}
		
		String currDir = System.getProperty("user.dir");
		//currDir = "c:\\logs";

		File dir = new File(currDir);
		final String pattern = args[0];
		
		
		//String[] list = (FilenameFilter filter)
		String[] files = dir.list(new FilenameFilter() {
			@Override
			public boolean accept(File dir, String name) {
				// TODO Auto-generated method stub
				return name.indexOf(pattern) != -1;
			}
		});
		
		for(int i = 0; i < files.length; i++){
			System.out.println(files[i]);
		}		
	}
}

8. 지정된 디렉터리에 정의한 확장자를 가진 파일을 삭제
package kr.pe.anaconda.test.io.file;

import java.io.File;
import java.io.FilenameFilter;

/**
 * 지정된 디렉터리에 정의한 확장자를 가진 파일을 삭제한다.
 * @author diem
 *
 */
public class FileEx8 {
	
	static int deleteFiles = 0;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length != 1) {
			System.out.println("USAGE : java FileEx8 Extension");
			System.exit(0);
		}
		
		String currDir = System.getProperty("user.dir");
		currDir = "c:\\logs";

		File dir = new File(currDir);
		//final String ext = "." + args[0];
		final String ext = ".bak";
		delete(dir, ext);
		System.out.println(deleteFiles + " 개의 파일이 삭제 되었습니다.");
	}

	private static void delete(File dir, String ext) {
		// TODO Auto-generated method stub
		
		File[] files = dir.listFiles();
		
		for(int i = 0; i < files.length; i++){
			if(files[i].isDirectory()){
				delete(files[i], ext);
			}else{
				String filename = files[i].getAbsolutePath();
				
				if(filename.endsWith(ext)){
					System.out.print(filename);
					if(files[i].delete()){
						System.out.println("-삭제 성공");
						deleteFiles++;
					}else{
						System.out.println("-삭제 실패");
					}
				}				
			}
		}		
	}		
}

9. 지정된 디렉터리에 파일명이 숫자인 경우 파일명을 변경
package kr.pe.anaconda.test.io.file;

import java.io.File;

/**
 * 지정된 디렉터리에 파일명이 숫자인 경우 파일명을 변경한다.
 * ex) 1.gif -> 00001.gif
 * @author diem
 *
 */
public class FileEx9 {	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		if (args.length != 0) {
			System.out.println("USAGE : java FileEx9 DIRECTORY");
			System.exit(0);
		}
		
		//File dir = new File(args[0]);
		File dir = new File("c:\\logs");
		if(!dir.exists() || !dir.isDirectory()){
			System.out.println("유효하지 않은 디렉토리입니다.");
			System.exit(0);
		}
		
		File[] files = dir.listFiles();
		for(int i = 0; i < files.length; i++){
			String fileName = files[i].getName();
			//파일명
			System.out.println("파일이름 :" + fileName);
			String newFileName = "0000" + fileName;
			newFileName = newFileName.substring(newFileName.length() - 7);
			System.out.println("변경된 파일 이름 : " + newFileName );
			files[i].renameTo(new File(dir, newFileName));
		}
	}		
}

Coming soon iphone..

낙서장2009. 11. 26. 10:49




아이폰이 발매된다 하면서 1년정도의 시간이 흐르고 11월 22일 드디어 예약판매가 실시되었습니다. 저 또한 예약 구매를 한 상태이고 28일을 손 꼽아서 기다리고 있습니다.

예약 판매가 시작 되고 혹시나 해서 애플 공식 사이트에 방문하여 Choose your country 메뉴를 봐도 우리나라의 국기는 볼 수가 없더니 오늘 오전에 보니 드디어 대한민국 국기가 떳습니다. 기쁘네요 이젠 정말 나오긴 하나 봅니다.




'낙서장' 카테고리의 다른 글

월드컵 조추첨  (0) 2009.12.05
화나는 아이폰 미개통 상황  (0) 2009.12.03
iphone 지르다.  (0) 2009.11.24
네이트온 피해 사례 두번째  (0) 2009.11.05
신종플루 가장 기본적인 예방법은?  (0) 2009.11.03

java에서 파일에 추가 라인을 입력하고 싶을때 옵션입니다. 15라인 참고하면 됩니다.

  1. package kr.pe.anaconda.test;
  2.  
  3. import java.io.FileNotFoundException;
  4. import java.io.FileWriter;
  5. import java.io.IOException;
  6. import java.io.PrintWriter;
  7.  
  8. public class Test {
  9.  
  10.     public static void main(String[] args) {       
  11.        
  12.         String file = "C:/logs/log.log";
  13.         PrintWriter pw = null;
  14.         try {
  15.             pw = new PrintWriter(new FileWriter(file, true));
  16.             pw.write(String.valueOf(System.currentTimeMillis()));
  17.             pw.write("\n");
  18.         } catch (FileNotFoundException e) {        
  19.             e.printStackTrace();
  20.         } catch (IOException e) {          
  21.             e.printStackTrace();
  22.         }finally{
  23.             if(pw != null) pw.close();
  24.         }
  25.     }
  26. }


JDBC 커넥션 풀을 지원하는 대표적인 오픈소스 중에 아파치 DBCPC3P0가 있다. 이들은 Spring, Hibernate 등과 통합되어 DB 커넥션 풀을 제공하는 DataSource를 구성하여 자주 쓰인다.

오라클이나 MySQL 등 DBMS들은 기본적으로 특정 시간동안 실행이 없으면 해당 세션을 종료하게 된다. 이렇게 종료된 커넥션은 어플리케이션에서 오류를 발생시키게 되므로 커넥션을 유지하기 위한 별도 설정을 필요로 하게 된다. 커넥션을 얻어올 때 커넥션 테스트를 수행하고 실패하면 새로운 커넥션을 생성할 수 있다. 또한 idle 타임에 주기적으로 커넥션 테스트를 수행할 수도 있다.

아래는 dbcp를 이용하여 구성한 스프링 DataSource 설정의 예이다.

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
        destroy-method="close">
    <property name="driverClassName" 
value="oracle.jdbc.driver.OracleDriver"/> <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"/> <property name="username" value="${jdbc.username}"/> <property name="password" value="${jdbc.password}"/> <property name="defaultAutoCommit" value="true"/> <property name="initialSize" value="5"/> <property name="maxActive" value="30"/> <property name="maxIdle" value="5"/> <property name="maxWait" value="30000"/> <property name="validationQuery" value="SELECT 1 FROM DUAL"/> <property name="testOnBorrow" value="true"/> <property name="testOnReturn" value="false"/> <property name="testWhileIdle" value="true"/> <property name="timeBetweenEvictionRunsMillis" value="60000"/> </bean>


아래는 c3p0를 이용하여 구성한 스프링 DataSource 설정의 예이다.

<bean id="dataSource" 
class="com.mchange.v2.c3p0.ComboPooledDataSource"
        destroy-method="close">
    <property name="driverClass" value="org.gjt.mm.mysql.Driver" />
    <property name="jdbcUrl" value="jdbc:mysql://localhost/testdb" />
    <property name="user" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    <property name="initialPoolSize" value="5" />
    <property name="maxPoolSize" value="30" />
    <property name="minPoolSize" value="5" />
    <property name="acquireIncrement" value="3" />
    <property name="acquireRetryAttempts" value="30" />
    <property name="acquireRetryDelay" value="1000" />
    <property name="idleConnectionTestPeriod" value="60" />
    <property name="preferredTestQuery" value="SELECT 1" />
    <property name="testConnectionOnCheckin" value="true" />
    <property name="testConnectionOnCheckout" value="false" />
</bean>


참조:
  - DBCP Configuration: http://commons.apache.org/dbcp/configuration.html
  - C3P0 Configuraion: http://www.mchange.com/projects/c3p0/index.html

출처 : http://www.java2go.net/blog/117

iphone 지르다.

낙서장2009. 11. 24. 18:03



언제 나오나 언제 나오나 목빠지게 기다리던 아이폰 출시가 되었습니다.
이번에도 아니겠지.
단순히 낚시 글이려니 했는데
22일부터 정말 예약 판매를 하는걸 보고 가슴이 두근거리더군요..

그래도 좀 참다가 사야지.
좀 더 가격이 내려갈수도 있잖아. 하는 냉정한 판단을 가차 없이 무너 뜨리고
예약 사이트를 둘러보다가 그만
질러 버렸습니다.

블랙
32GB..
I-미디엄 요금제..

후덜덜덜..

그래도 어서 내 두손에 사뿐이 잡히길
어서 빨리 28일이 오길 손꼽아 기다립니다.



'낙서장' 카테고리의 다른 글

화나는 아이폰 미개통 상황  (0) 2009.12.03
Coming soon iphone..  (0) 2009.11.26
네이트온 피해 사례 두번째  (0) 2009.11.05
신종플루 가장 기본적인 예방법은?  (0) 2009.11.03
네이트온 사기 피해  (4) 2009.10.28