2009. 8. 18.

HSQLDB 가동 및 JNDI 설정

1. HSQLDB서버 기동
java -cp ..\lib\hsqldb.jar org.hsqldb.Server -database TEST

2. DatabaseManager 기동
java -cp ..\lib\hsqldb.jar org.hsqldb.util.DatabaseManager

3.web.xml설정



.....
.....


jdbc/library
javax.sql.DataSource
Container





4.server.xml설정






type="javax.sql.DataSource" />



driverClassName
org.hsqldb.jdbcDriver


username
sa


password



url
jdbc:hsqldb:hsql://localhost






5. JNDI와 DataSource

Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup(
"java:comp/env/jdbc/library");
Connection con = ds.getConnection();

댓글 없음: