<data-sources>
<data-source key="dataSources">
<set-property value="oracle.jdbc.driver.OracleDriver" property="driverClass" />
<set-property value="jdbc:oracle:thin:@192.168.100.100:1521:ORCL" property="url" />
<set-property value="5" property="maxCount" />
<set-property value="1" property="minCount" />
<set-property value="**" property="user" />
<set-property value="**" property="password" />
</data-source>看清楚呀,很简单
ServletContext context = servlet.getServletContext(); DataSource dataSource = (DataSource)context.getAttribute("dataSources"); conn = dataSource.getConnection(); stmt = conn.createStatement();
<data-source key="dataSources">
<set-property value="oracle.jdbc.driver.OracleDriver" property="driverClass" />
<set-property value="jdbc:oracle:thin:@192.168.100.100:1521:ORCL" property="url" />
<set-property value="5" property="maxCount" />
<set-property value="1" property="minCount" />
<set-property value="**" property="user" />
<set-property value="**" property="password" />
</data-source>看清楚呀,很简单
ServletContext context = servlet.getServletContext(); DataSource dataSource = (DataSource)context.getAttribute("dataSources"); conn = dataSource.getConnection(); stmt = conn.createStatement();
解决方案 »
- struts2运行时出错 求大神指导
- myeclipse后台怎么打印那么多TRACE,跪求大虾了
- 请问如何用itext读取pdf模板后 在模板需要的位置添加上一个表格呢?
- XML解析问题求教高手!!!!!!!!
- 怎么每隔一定时间自动执行一个方法
- 求助:利用struts前台页面无法显示
- 100分问题,不够加分!关于tomcat版本升级的问题??
- 那里有jsp+ejb的源程序下载?
- spring获取数据源dataSource为空null
- mina2 疑问
- 急,谁能帮忙给mail一份《j2ee应用与bea weblogic server》的源代码?
- 用J2EE实现大并发SOCKET通讯的系统构架的几点想法,望大侠们给予指点
String url="jdbc:oracle:thin:@localhost:1521:orcl";
//orcl为数据库的SID
String user="test";
String password="test";
Connection conn= DriverManager.getConnection(url,user,password);