Tomcat的数据库连接配置(E:\tomcat\conf\server.xml):
<Context path="/" docBase="E:\workspace\xxxProject\WebRoot" reloadable="true" debug="5">
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="19" maxIdle="10" maxWait="-1" name="jdbc/xx" password="111" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:xe" username="dbtest"/>
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="19" maxIdle="10" maxWait="-1" name="jdbc/xxx" password="111" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:xe" username="dbtest"/>
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="19" maxIdle="10" maxWait="-1" name="jdbc/test" password="111" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:xe" username="dbtest"/>
</Context>
<!-- 因为放了两个工程 所以需要两个Context 配置 -->
<Context path="/mgr" docBase="E:\workspace\web_mgr\WebRoot" reloadable="true" debug="5">
<Resource auth="Container" driverClassName="oracle.jdbc.driver.OracleDriver" maxActive="19" maxIdle="10" maxWait="-1" name="jdbc/test" password="111" type="javax.sql.DataSource" url="jdbc:oracle:thin:@localhost:1521:xe" username="dbtest"/>
</Context>
对应的Java代码
private final static void initDataSource() throws Exception{
show_sql = true;
Context initCtx = new InitialContext();
dataSource =(DataSource)initCtx.lookup("java:comp/env/jdbc/test");
log.info("Using DataSource : " + dataSource.getClass().getName());
Connection conn = getConnection();
DatabaseMetaData mdm = conn.getMetaData();
log.info("Connected to " + mdm.getDatabaseProductName() +
" " + mdm.getDatabaseProductVersion());
closeConnection();
}
Oracle 10 创建表空间
创建数据表空间 create tablespace stbss datafile 'E:\oracle\product\10.2.0\oradata\orcl\stbss_temp01.dbf' size 100m autoextend on next 32m maxsize 2048m --------------------------------- stbss 是表空间名称 D:xxxxx.dbf 是你表空间数据的存放地址和文件名称 size 100m 开始是100M的大小 autoextend on next 32m 不够的话会自动增长32M maxsize 2048m 最多增加到 2048mhttp://www.liferay.com/community/liferay-projects/alloy-ui/demo?title=community-liferay-projects-alloy-ui-demos-charts