仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1505|回复: 19
打印 上一主题 下一主题

[学习教程] JAVA网页编程之设置weblogic的connection pool和Data ...

[复制链接]
变相怪杰 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-1-18 11:48:46 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
用winrar打包j2ee的程序和用IDE打包应用程序是一样的。按照你的想法,你是不是也希望服务器都整合由一家公司提供呢?connection|web
osversion:windwos2000serverhostname:mytestdatabase:oracle9.2.0.1port:1521table:test(anumber(2))user:systempassword:oracleweblogicversion:7.0.4domain:mydomainserver:myserverport:7001WL_HOME:d:eaweblogic1.设置connectionpool打_weblogic办理把持台[http://mytest:7001/console]mydomain->services->jdbc->connectionpools新增一connectionpoolname:OraThinpoolurl:jdbc:oracle:thin:@mytest:1521:technetDriverClassname:oracle.jdbc.driver.OracleDriverproperties:user=systempassword:oracletarget:myservertesttablename:dual2.设置DataSource打_weblogic办理把持台[http://mytest:7001/console]mydomain->services->jdbc->DataSource新增一DataSourcename:OraThinDSJNDIName:jndi_orathinDSPoolName:OraThinPooltarget:myserver3.y代aContextctx=null;Hashtableht=newHashtable();ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");ht.put(Context.PROVIDER_URL,"t3://mytest:7001");try{ctx=newInitialContext(ht);javax.sql.DataSourceds=(javax.sql.DataSource)ctx.lookup("jndi_orathinDS");java.sql.Connectionconn=ds.getConnection();Statementstmt=conn.createStatement();Stringsql="selectafromtest";ResultSetrs=stmt.executeQuery(sql);while(rs.next()){inti=rs.getInt(1);System.out.println(i);}}catch(Exceptione){e.printStackTrace();}rs.close();stmt.close();conn.close();4.附注的jdbc游恢在h境量classpath中出F,本例利用的classes12.zip位於d:eaweblogicerverlibtclasspath=d:eaweblogicerverlibclasses12.zip;%CLASSPATH%修正d:eaweblogicerverintartWLS.cmd中的classpath後从头weblogic便可

专门做了这个例子;而java的这个例子好像就是为了教学而写的,很多教学目的的例子是不考虑优化、性能的。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-21 21:21

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表