首页 > 代码库 > oracle配置与server.xml配置

oracle配置与server.xml配置

*

 1,java web工程可以部署到tomcat上,也可以通过配置server.xml映射到工程实际目录,这样在tomcat的webapps目录下就没有工程了,下面是server.xml中的配置

<Context  path="/myfirst"  docBase="E:\myJava\project2\first\WebRoot" debug="0" reloadable="false">               <Resource name="jdbc/oracle" type="javax.sql.DataSource" username="aaa"            password="password"            driverClassName="oracle.jdbc.driver.OracleDriver"            maxIdle="2" maxWait="5000"            url="jdbc:oracle:thin:@localhost:1521:orcl"            maxActive="4" /></Context>

工程名是first,映射成myfirst,以后访问直接通过

http://localhost:80/myfirst即可

2,oracle的tnsnames.ora中的配置

Info =  (DESCRIPTION =    (ADDRESS_LIST =      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))    )    (CONNECT_DATA =      http://www.mamicode.com/(SERVICE_NAME = orcl)>

注意:1,因为这里

 (SERVICE_NAME = orcl)
(HOST = localhost)

所以server.xml中

url="jdbc:oracle:thin:@localhost:1521:orcl"
如果plsql连接的是其他主机的数据库,如host=192.168.1.101
,service_name=info,
则url="jdbc:oracle:thin:@192.168.1.101:info"

技术分享

database对应的是service_name

 

 

*

oracle配置与server.xml配置