锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲一区二区三区夜色 ,亚洲一区二区三区在线播放 ,亚洲日本va午夜中文字幕一区http://m.tkk7.com/ashutc/category/42983.html鏈夊灝戦潰璇曢鏄痗trl+c鐒跺悗ctrl+v鐨勫憿錛熻冮偅涔堥毦鐨勯鐪熺殑鍏誨緱璧蜂箞錛?/description>zh-cnMon, 21 Mar 2011 22:06:00 GMTMon, 21 Mar 2011 22:06:00 GMT60c3p0璇︾粏閰嶇疆http://m.tkk7.com/ashutc/archive/2011/03/16/346365.html瑗跨摐瑗跨摐Wed, 16 Mar 2011 02:31:00 GMThttp://m.tkk7.com/ashutc/archive/2011/03/16/346365.htmlhttp://m.tkk7.com/ashutc/comments/346365.htmlhttp://m.tkk7.com/ashutc/archive/2011/03/16/346365.html#Feedback0http://m.tkk7.com/ashutc/comments/commentRss/346365.htmlhttp://m.tkk7.com/ashutc/services/trackbacks/346365.html
<c3p0-config>
<default-config>
<!--褰撹繛鎺ユ睜涓殑榪炴帴鑰楀敖鐨勬椂鍊檆3p0涓嬈″悓鏃惰幏鍙栫殑榪炴帴鏁般侱efault: 3 -->
<property name="acquireIncrement">3</property>

<!--瀹氫箟鍦ㄤ粠鏁版嵁搴撹幏鍙栨柊榪炴帴澶辮觸鍚庨噸澶嶅皾璇曠殑嬈℃暟銆侱efault: 30 -->
<property name="acquireRetryAttempts">30</property>

<!--涓ゆ榪炴帴涓棿闅旀椂闂達紝鍗曚綅姣銆侱efault: 1000 -->
<property name="acquireRetryDelay">1000</property>

<!--榪炴帴鍏抽棴鏃墮粯璁ゅ皢鎵鏈夋湭鎻愪氦鐨勬搷浣滃洖婊氥侱efault: false -->
<property name="autoCommitOnClose">false</property>

<!--c3p0灝嗗緩涓寮犲悕涓篢est鐨勭┖琛紝騫朵嬌鐢ㄥ叾鑷甫鐨勬煡璇㈣鍙ヨ繘琛屾祴璇曘傚鏋滃畾涔変簡榪欎釜鍙傛暟閭d箞
灞炴referredTestQuery灝嗚蹇界暐銆備綘涓嶈兘鍦ㄨ繖寮燭est琛ㄤ笂榪涜浠諱綍鎿嶄綔錛屽畠?yōu)畣鍙緵c3p0嫻嬭瘯
浣跨敤銆侱efault: null-->
<property name="automaticTestTable">Test</property>

<!--鑾峰彇榪炴帴澶辮觸灝嗕細寮曡搗鎵鏈夌瓑寰呰繛鎺ユ睜鏉ヨ幏鍙栬繛鎺ョ殑綰跨▼鎶涘嚭寮傚父銆備絾鏄暟鎹簮浠嶆湁鏁?br /> 淇濈暀錛屽茍鍦ㄤ笅嬈¤皟鐢╣etConnection()鐨勬椂鍊欑戶緇皾璇曡幏鍙栬繛鎺ャ傚鏋滆涓簍rue錛岄偅涔堝湪灝濊瘯
鑾峰彇榪炴帴澶辮觸鍚庤鏁版嵁婧愬皢鐢蟲槑宸叉柇寮騫舵案涔呭叧闂侱efault: false-->
<property name="breakAfterAcquireFailure">false</property>

<!--褰撹繛鎺ユ睜鐢ㄥ畬鏃跺鎴風璋冪敤getConnection()鍚庣瓑寰呰幏鍙栨柊榪炴帴鐨勬椂闂達紝瓚呮椂鍚庡皢鎶涘嚭
SQLException,濡傝涓?鍒欐棤闄愭湡絳夊緟銆傚崟浣嶆縐掋侱efault: 0 -->
<property name="checkoutTimeout">100</property>

<!--閫氳繃瀹炵幇ConnectionTester鎴朡ueryConnectionTester鐨勭被鏉?/span> 嫻嬭瘯榪炴帴銆傜被鍚嶉渶鍒跺畾鍏ㄨ礬寰勩?br /> Default: com.mchange.v2.c3p0.impl.DefaultConnectionTester-->
<property name="connectionTesterClassName"></property>

<!--鎸囧畾c3p0 libraries鐨勮礬寰勶紝濡傛灉錛堥氬父閮芥槸榪欐牱錛夊湪鏈湴鍗沖彲鑾峰緱閭d箞鏃犻渶璁劇疆錛岄粯璁ull鍗沖彲
Default: null-->
<property name="factoryClassLocation">null</property>

<!--Strongly disrecommended. Setting this to true may lead to subtle and bizarre bugs.
錛堟枃妗e師鏂囷級浣滆呭己鐑堝緩璁笉浣跨敤鐨勪竴涓睘鎬?->
<property name="forceIgnoreUnresolvedTransactions">false</property>

<!--姣?0縐掓鏌ユ墍鏈夎繛鎺ユ睜涓殑絀洪棽榪炴帴銆侱efault: 0 -->
<property name="idleConnectionTestPeriod">60</property>

<!--鍒濆鍖栨椂鑾峰彇涓変釜榪炴帴錛屽彇鍊煎簲鍦╩inPoolSize涓巑axPoolSize涔嬮棿銆侱efault: 3 -->
<property name="initialPoolSize">3</property>

<!--鏈澶х┖闂叉椂闂?60縐掑唴鏈嬌鐢ㄥ垯榪炴帴琚涪寮冦傝嫢涓?鍒欐案涓嶄涪寮冦侱efault: 0 -->
<property name="maxIdleTime">60</property>

<!--榪炴帴姹犱腑淇濈暀鐨勬渶澶ц繛鎺ユ暟銆侱efault: 15 -->
<property name="maxPoolSize">15</property>

<!--JDBC鐨勬爣鍑嗗弬鏁幫紝鐢ㄤ互鎺у埗鏁版嵁婧愬唴鍔犺澆鐨凱reparedStatements鏁伴噺銆備絾鐢變簬棰勭紦瀛樼殑statements
灞炰簬鍗曚釜connection鑰屼笉鏄暣涓繛鎺ユ睜銆傛墍浠ヨ緗繖涓弬鏁伴渶瑕佽冭檻鍒板鏂歸潰鐨勫洜绱犮?br /> 濡傛灉maxStatements涓巑axStatementsPerConnection鍧囦負0錛屽垯緙撳瓨琚叧闂侱efault: 0-->
<property name="maxStatements">100</property>

<!--maxStatementsPerConnection瀹氫箟浜嗚繛鎺ユ睜鍐呭崟涓繛鎺ユ墍鎷ユ湁鐨勬渶澶х紦瀛榮tatements鏁般侱efault: 0 -->
<property name="maxStatementsPerConnection"></property>

<!--c3p0鏄紓姝ユ搷浣滅殑錛岀紦鎱㈢殑JDBC鎿嶄綔閫氳繃甯姪榪涚▼瀹屾垚銆傛墿灞曡繖浜涙搷浣滃彲浠ユ湁鏁堢殑鎻愬崌鎬ц兘
閫氳繃澶氱嚎紼嬪疄鐜板涓搷浣滃悓鏃惰鎵ц銆侱efault: 3-->

<property name="numHelperThreads">3</property>

<!--褰撶敤鎴瘋皟鐢╣etConnection()鏃朵嬌root鐢ㄦ埛鎴愪負鍘昏幏鍙栬繛鎺ョ殑鐢ㄦ埛銆備富瑕佺敤浜庤繛鎺ユ睜榪炴帴闈瀋3p0
鐨勬暟鎹簮鏃躲侱efault: null-->
<property name="overrideDefaultUser">root</property>

<!--涓巓verrideDefaultUser鍙傛暟瀵瑰簲浣跨敤鐨勪竴涓弬鏁般侱efault: null-->
<property name="overrideDefaultPassword">password</property>

<!--瀵嗙爜銆侱efault: null-->
<property name="password"></property>

<!--瀹氫箟鎵鏈夎繛鎺ユ祴璇曢兘鎵ц鐨勬祴璇曡鍙ャ傚湪浣跨敤榪炴帴嫻嬭瘯鐨勬儏鍐典笅榪欎釜涓鏄捐憲鎻愰珮嫻嬭瘯閫熷害銆傛敞鎰忥細
嫻嬭瘯鐨勮〃蹇呴』鍦ㄥ垵濮嬫暟鎹簮鐨勬椂鍊欏氨瀛樺湪銆侱efault: null-->

<property name="preferredTestQuery">select id from test where id=1</property>

<!--鐢ㄦ埛淇敼緋葷粺閰嶇疆鍙傛暟鎵ц鍓嶆渶澶氱瓑寰?00縐掋侱efault: 300 -->
<property name="propertyCycle">300</property>

<!--鍥犳ц兘娑堣楀ぇ璇峰彧鍦ㄩ渶瑕佺殑鏃跺欎嬌鐢ㄥ畠銆傚鏋滆涓簍rue閭d箞鍦ㄦ瘡涓猚onnection鎻愪氦鐨?br /> 鏃跺欓兘灝嗘牎楠屽叾鏈夋晥鎬с傚緩璁嬌鐢╥dleConnectionTestPeriod鎴朼utomaticTestTable
絳夋柟娉曟潵鎻愬崌榪炴帴嫻嬭瘯鐨勬ц兘銆侱efault: false -->
<property name="testConnectionOnCheckout">false</property>

<!--濡傛灉璁句負true閭d箞鍦ㄥ彇寰楄繛鎺ョ殑鍚屾椂灝嗘牎楠岃繛鎺ョ殑鏈夋晥鎬с侱efault: false -->
<property name="testConnectionOnCheckin">true</property>

<!--鐢ㄦ埛鍚嶃侱efault: null-->
<property name="user">root</property>

<!--鏃╂湡鐨刢3p0鐗堟湰瀵笿DBC鎺ュ彛閲囩敤鍔ㄦ佸弽灝勪唬鐞嗐傚湪鏃╂湡鐗堟湰鐢ㄩ斿箍娉涚殑鎯呭喌涓嬭繖涓弬鏁?br /> 鍏佽鐢ㄦ埛鎭㈠鍒板姩鎬佸弽灝勪唬鐞嗕互瑙e喅涓嶇ǔ瀹氱殑鏁呴殰銆傛渶鏂扮殑闈炲弽灝勪唬鐞嗘洿蹇茍涓斿凡緇忓紑濮?br /> 騫挎硾鐨勮浣跨敤錛屾墍浠ヨ繖涓弬鏁版湭蹇呮湁鐢ㄣ傜幇鍦ㄥ師鍏堢殑鍔ㄦ佸弽灝勪笌鏂扮殑闈炲弽灝勪唬鐞嗗悓鏃跺彈鍒?br /> 鏀寔錛屼絾浠婂悗鍙兘鐨勭増鏈彲鑳戒笉鏀寔鍔ㄦ佸弽灝勪唬鐞嗐侱efault: false-->
<property name="usesTraditionalReflectiveProxies">false</property>

<property name="automaticTestTable">con_test</property>
<property name="checkoutTimeout">30000</property>
<property name="idleConnectionTestPeriod">30</property>
<property name="initialPoolSize">10</property>
<property name="maxIdleTime">30</property>
<property name="maxPoolSize">25</property>
<property name="minPoolSize">10</property>
<property name="maxStatements">0</property>
<user-overrides user="swaldman">
</user-overrides>
</default-config>
<named-config name="dumbTestConfig">
<property name="maxStatements">200</property>
<user-overrides user="poop">
<property name="maxStatements">300</property>
</user-overrides>
</named-config>
</c3p0-config>


杞細http://www.wujianrong.com/archives/2007/08/c3p0.html
瑙e喅MYSQL 8灝忔椂闂

鏈榪戠殑涓涓」鐩湪Hibernate浣跨敤C3P0鐨勮繛鎺ユ睜錛屾暟鎹簱涓篗ysql銆傚紑鍙戞祴璇曟病鏈夐棶棰橈紝鍦ㄨ繍琛屼腑姣忎釜涓孌甸暱鐨勭┖闂叉椂闂村氨鍑虹幇寮傚父:

java 浠g爜
  1. org.hibernate.exception.JDBCConnectionException: could not execute query
  2. at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java: 74 )
  3. at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java: 43 )
  4. .......
  5. Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:
  6. ** BEGIN NESTED EXCEPTION **
  7. com.mysql.jdbc.CommunicationsException
  8. MESSAGE: Communications link failure due to underlying exception:
  9. ** BEGIN NESTED EXCEPTION **
  10. java.net.SocketException
  11. MESSAGE: Broken pipe
  12. STACKTRACE:
  13. java.net.SocketException: Broken pipe
  14. at java.net.SocketOutputStream.socketWrite0(Native Method)
  15. ......
  16. ** END NESTED EXCEPTION **

鏌ョ湅浜哅ysql鐨勬枃妗o紝浠ュ強Connector/J鐨勬枃妗d互鍙婂湪綰胯鏄庡彂鐜幫紝鍑虹幇榪欑寮傚父鐨勫師鍥犳槸錛?/p>

Mysql鏈嶅姟鍣ㄩ粯璁ょ殑“wait_timeout”鏄?灝忔椂錛屼篃灝辨槸璇翠竴涓猚onnection絀洪棽瓚呰繃8涓皬鏃訛紝Mysql灝嗚嚜鍔ㄦ柇寮璇? connection銆傝繖灝辨槸闂鐨勬墍鍦紝鍦–3P0 pools涓殑connections濡傛灉絀洪棽瓚呰繃8灝忔椂錛孧ysql灝嗗叾鏂紑錛岃孋3P0騫朵笉鐭ラ亾璇onnection宸茬粡澶辨晥錛屽鏋滆繖鏃舵湁 Client璇鋒眰connection錛孋3P0灝嗚澶辨晥鐨凜onnection鎻愪緵緇機lient錛屽皢浼氶犳垚涓婇潰鐨勫紓甯搞?/p>

瑙e喅鐨勬柟娉曟湁3縐嶏細

  1. 澧炲姞wait_timeout鐨勬椂闂淬?
  2. 鍑忓皯Connection pools涓璫onnection鐨刲ifetime銆?
  3. 嫻嬭瘯Connection pools涓璫onnection鐨勬湁鏁堟с?

褰撶劧鏈濂界殑鍔炴硶鏄悓鏃剁患鍚堜嬌鐢ㄤ笂榪?縐嶆柟娉曪紝涓嬮潰灝盌BCP鍜孋3P0鍒嗗埆鍋氫竴璇存槑錛屽亣璁緒ait_timeout涓洪粯璁ょ殑8灝忔椂

DBCP澧炲姞浠ヤ笅閰嶇疆淇℃伅:

  1. //set to 'SELECT 1'
  2. validationQuery = "SELECT 1"
  3. //set to 'true'
  4. testWhileIdle = "true"
  5. //some positive integer
  6. timeBetweenEvictionRunsMillis = 3600000
  7. //set to something smaller than 'wait_timeout'
  8. minEvictableIdleTimeMillis = 18000000
  9. //if you don't mind a hit for every getConnection(), set to "true"
  10. testOnBorrow = "true"

C3P0澧炲姞浠ヤ笅閰嶇疆淇℃伅:

  1. //鑾峰彇connnection鏃舵祴璇曟槸鍚︽湁鏁?/span>
  2. testConnectionOnCheckin = true
  3. //鑷姩嫻嬭瘯鐨則able鍚嶇О
  4. automaticTestTable=C3P0TestTable
  5. //set to something much less than wait_timeout, prevents connections from going stale
  6. idleConnectionTestPeriod = 18000
  7. //set to something slightly less than wait_timeout, preventing 'stale' connections from being handed out
  8. maxIdleTime = 25000
  9. //if you can take the performance 'hit', set to "true"
  10. testConnectionOnCheckout = true

鏇村鐨勯厤緗俊鎭ぇ瀹跺彲浠ユ煡鐪婥3P0鏂囨。錛孋onnector/J鏂囨。錛屼互鍙奃BCP鐨勬枃妗c?/p>

杞? http://www.javaeye.com/article/38506

鎴戣嚜宸辯殑閰嶇疆:

jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.jdbcUrl = jdbc:mysql://localhost:3306/test
jdbc.user = root
jdbc.password = 12345
jdbc.miniPoolSize = 1
jdbc.maxPoolSize = 20
jdbc.initialPoolSize = 1
jdbc.maxIdleTime = 25000
jdbc.acquireIncrement = 1

jdbc.acquireRetryAttempts = 30
jdbc.acquireRetryDelay = 1000
jdbc.testConnectionOnCheckin = true
jdbc.automaticTestTable = c3p0TestTable
jdbc.idleConnectionTestPeriod = 18000
jdbc.checkoutTimeout=3000

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
   <property name="driverClass" value="${jdbc.driverClass}" />
   <property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
   <property name="user" value="${jdbc.user}" />
   <property name="password" value="${jdbc.password}" />
   <property name="minPoolSize" value="${jdbc.miniPoolSize}" />
   <property name="maxPoolSize" value="${jdbc.maxPoolSize}"/>  
   <property name="initialPoolSize" value="${jdbc.initialPoolSize}"/>
   <property name="maxIdleTime" value="${jdbc.maxIdleTime}"/>
   <property name="acquireIncrement" value="${jdbc.acquireIncrement}"/>
  
   <property name="acquireRetryAttempts" value="${jdbc.acquireRetryAttempts}"/>
   <property name="acquireRetryDelay" value="${jdbc.acquireRetryDelay}"/>
   <property name="testConnectionOnCheckin" value="${jdbc.testConnectionOnCheckin}"/>
   <property name="automaticTestTable" value="${jdbc.automaticTestTable}"/>
   <property name="idleConnectionTestPeriod" value="${jdbc.idleConnectionTestPeriod}"/>
   <property name="checkoutTimeout" value="${jdbc.checkoutTimeout}"/>

</bean>

+++++++++++

鎶ラ敊璇細
APPARENT DEADLOCK!!! Creating emergency threads for unassigned pending tasks!

涓鑸緗甿axStatements=0瑙e喅璇ラ棶棰?
浣嗘槸錛?
鎶妋ax_statements璁劇疆涓?銆?
c3p0鍦ㄥ悓鏃跺叧闂璼tatement鍜宑onnection鐨勬椂鍊欙紝鎴栬呭叧闂粬浠箣闂寸殑鏃墮棿寰堢煭鐨勬椂鍊欙紝鏈夋椂鍊檆onnection騫舵病鏈夎鍏抽棴錛屽洜涓烘湁浜沺reparedstatement榪樺湪琚玞ached浣忋傝繖鏄痗3p0鐨勪綔鑰呰嚜宸辮鐨勩?
http://forum.hibernate.org/viewtopic.php?t=947246&highlight=apparent+deadlock+c3p0

C3P0澧炲姞浠ヤ笅閰嶇疆淇℃伅:


//set to 'SELECT 1'      
preferredTestQuery = 'SELECT 1'    
//set to something much less than wait_timeout, prevents connections from going stale   
idleConnectionTestPeriod = 18000     
//set to something slightly less than wait_timeout, preventing 'stale' connections from being handed out   
maxIdleTime = 25000    
//if you can take the performance 'hit', set to "true"   
testConnectionOnCheckout = true    



A c3p0 pool with the settings you have should recover from a database reset, but that doesn't mean you will never see an Exception. Stale Connections from the old database session will still be broken, and if those Connections have already been checked out, or if they are in the pool and not tested on checkout, the application will see the broken Connection, in the form of an Exception.

You can use c3p0 to minimize the likelihood that your application will see a stale Connection on database shutdown/restart. The most reliable means of preventing this is to set hibernate.c3p0.validate to true (in a hibernate application -- all other c3p0 apps should use the c3p0-native property c3p0.testConnectionOnCheckout). If you set this property to true, c3p0 will test Connections prior to checkout, and your app will never see a stale Connection on database restart unless the Connection had already been checked out when the database went down.

Another less reliable, but potentially less expensive, strategy is to set c3p0.testConnectionsOnCheckin and hibernate.c3p0.idle_test_period (c3p0-native c3p0.idleConnectionTestPeriod) to a low value, in which case all connection tests are asynchronous and you are guanteed that no Connection will be checked out that hasn't been tested in the last idle_test_period seconds. Thus, your app will only see broken Connections from the pool if Connections are checked out during a short window of time.

In either case, I recommend setting "c3p0.preferredTestQuery " or "c3p0.automaticTestTable" in your c3p0 properties file, as c3p0's default Connection test is often slow.

See "Configuring Connection Testing" in c3p0's docs for more information.



鍦? 浣跨敤c3p0浣滀負榪炴帴姹犳椂錛屽叾涓殑涓浜涢厤緗弬鏁伴渶瑕佷慨鏀廣備富瑕佹槸maxIdleTime鍜宨dleConnectionTestPeriod銆? MySQL榛樿鏄?灝忔椂錛?8800縐掞級鍚庤嚜鍔ㄥ叧闂凡鎵撳紑鐨勮繛鎺ワ紝鎵浠3p0瑕佸湪8灝忔椂鍐呭叧闂笉浣跨敤鐨勮繛鎺ワ紝涓婇潰鐨?鍙傛暟瑕佸皬浜?8800縐掋傞檮涓婂湪 hibernate涓厤緗甤3p0鐨勫叧閿瓧銆?

c3p0-native property name hibernate configuration key
c3p0.acquireIncrement hibernate.c3p0.acquire_increment
c3p0.idleConnectionTestPeriod hibernate.c3p0.idle_test_period
c3p0.initialPoolSize not available -- uses minimum size
c3p0.maxIdleTime hibernate.c3p0.timeout
c3p0.maxPoolSize hibernate.c3p0.max_size
c3p0.maxStatements hibernate.c3p0.max_statements
c3p0.minPoolSize hibernate.c3p0.min_size

杞澆鑷細http://handawei.javaeye.com/blog/651046





瑗跨摐 2011-03-16 10:31 鍙戣〃璇勮
]]>
C3P0鍦╯pring涓殑閰嶇疆http://m.tkk7.com/ashutc/archive/2010/08/09/328287.html瑗跨摐瑗跨摐Mon, 09 Aug 2010 02:30:00 GMThttp://m.tkk7.com/ashutc/archive/2010/08/09/328287.htmlhttp://m.tkk7.com/ashutc/comments/328287.htmlhttp://m.tkk7.com/ashutc/archive/2010/08/09/328287.html#Feedback0http://m.tkk7.com/ashutc/comments/commentRss/328287.htmlhttp://m.tkk7.com/ashutc/services/trackbacks/328287.html
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"    destroy-method="close">
          
<property name="driverClass"><value>${jdbc.driverClassName}</value></property>
          
<property name="jdbcUrl"><value>${jdbc.url}</value></property>               
          
<property name="user"><value>${jdbc.username}</value></property>
          
<property name="password"><value>${jdbc.password}</value></property>
          
          
<property name="minPoolSize"><value>1</value></property>
          
<property name="maxPoolSize"><value>20</value></property>
          
<property name="maxIdleTime"><value>1800</value></property>
          
<property name="acquireIncrement"><value>2</value></property>
          
<property name="maxStatements"><value>0</value></property>
          
<property name="initialPoolSize"><value>2</value></property>
          
<property name="idleConnectionTestPeriod"><value>1800</value></property>
          
<property name="acquireRetryAttempts"><value>30</value></property>
          
<property name="breakAfterAcquireFailure"><value>true</value></property>
          
<property name="testConnectionOnCheckout"><value>false</value></property>           
</bean>


<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
   
<property name="dataSource" ref="dataSource"/>
   
<property name="mappingDirectoryLocations">
       
<list>
    
<value>classpath:/com/licaionline/domain/</value>
       
</list>
   
</property>
   
<property name="hibernateProperties">
    
<props>
     
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
      
<prop key="hibernate.show_sql">true</prop>
     
<prop key="hibernate.generate_statistics">true</prop>
                 
<prop key="hibernate.connection.release_mode">auto</prop>                      
                 
<prop key="hibernate.autoReconnect">true</prop>
                 
<prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
    
</props>
   
</property>
</bean>






瑗跨摐 2010-08-09 10:30 鍙戣〃璇勮
]]>
JDBC鐨勪綔鐢ㄥ強閲嶈鎺ュ彛http://m.tkk7.com/ashutc/archive/2009/10/13/298122.html瑗跨摐瑗跨摐Tue, 13 Oct 2009 14:38:00 GMThttp://m.tkk7.com/ashutc/archive/2009/10/13/298122.htmlhttp://m.tkk7.com/ashutc/comments/298122.htmlhttp://m.tkk7.com/ashutc/archive/2009/10/13/298122.html#Feedback0http://m.tkk7.com/ashutc/comments/commentRss/298122.htmlhttp://m.tkk7.com/ashutc/services/trackbacks/298122.html闃呰鍏ㄦ枃

瑗跨摐 2009-10-13 22:38 鍙戣〃璇勮
]]>
JAVA璋冪敤Oracle瀛樺偍榪囩▼ http://m.tkk7.com/ashutc/archive/2009/05/22/277359.html瑗跨摐瑗跨摐Fri, 22 May 2009 08:19:00 GMThttp://m.tkk7.com/ashutc/archive/2009/05/22/277359.htmlhttp://m.tkk7.com/ashutc/comments/277359.htmlhttp://m.tkk7.com/ashutc/archive/2009/05/22/277359.html#Feedback0http://m.tkk7.com/ashutc/comments/commentRss/277359.htmlhttp://m.tkk7.com/ashutc/services/trackbacks/277359.html銆銆JAVA璺烵racle涔嬮棿鏈甯哥敤鐨勬槸JAVA璋冪敤Oracle鐨勫瓨鍌ㄨ繃紼嬶紝浠ヤ笅綆瑕佽鏄庝笅JAVA濡備綍瀵筄racle瀛樺偍榪囩▼榪涜璋冪敤銆?/p>

銆銆鈪犮佷笉甯﹁緭鍑哄弬鏁版儏鍐?/p>

銆銆榪囩▼鍚嶇О涓簆ro1錛屽弬鏁頒釜鏁?涓紝鏁版嵁綾誨瀷涓烘暣褰㈡暟鎹?/p>

import銆java.sql. * ;
public銆 class銆ProcedureNoArgs銆
{
public銆 static銆 void銆main(String args[])銆throws銆Exception
{
// 鍔犺澆Oracle椹卞姩銆
DriverManager.registerDriver( new銆oracle.jdbc.driver.OracleDriver());
// 鑾峰緱Oracle鏁版嵁搴撹繛鎺ャ
Connection conn = DriverManager.getConnection( " jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL", sUsr, sPwd " );
// 鍒涘緩瀛樺偍榪囩▼鐨勫璞°
CallableStatement c = conn.divpareCall( " {call pro1(?)} " );
// 緇橭racle瀛樺偍榪囩▼鐨勫弬鏁拌緗?錛屽皢絎竴涓弬鏁扮殑鍊艱緗垚188銆
c.setInt( 1 , 188 );
// 鎵цOracle瀛樺偍榪囩▼銆
c.execute();
conn.close();
}銆
}銆

銆銆鈪°佸甫杈撳嚭鍙傛暟鐨勬儏鍐?/p>

銆銆榪囩▼鍚嶇О涓簆ro2錛屽弬鏁頒釜鏁?涓紝鏁版嵁綾誨瀷涓烘暣褰㈡暟鎹紝榪斿洖鍊間負鏁村艦綾誨瀷

import java.sql.*;
public class ProcedureWithArgs銆
{
public static void main(String args[]) throws Exception
{
//鍔犺澆Oracle椹卞姩
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//鑾峰緱Oracle鏁版嵁搴撹繛鎺?br /> Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@MyDbComputerNameOrIP:1521:ORCL", sUsr, sPwd ");
//鍒涘緩Oracle瀛樺偍榪囩▼鐨勫璞★紝璋冪敤瀛樺偍榪囩▼
CallableStatement c=conn.divpareCall("{call pro2(?,?)}");
//緇橭racle瀛樺偍榪囩▼鐨勫弬鏁拌緗?錛屽皢絎竴涓弬鏁扮殑鍊艱緗垚188
c.setInt(1,188);
//娉ㄥ唽瀛樺偍榪囩▼鐨勭浜屼釜鍙傛暟銆
c.registerOutParameter(2,java.sql.Types.INTEGER);
//鎵цOracle瀛樺偍榪囩▼
c.execute();
//寰楀埌瀛樺偍榪囩▼鐨勮緭鍑哄弬鏁板煎茍鎵撳嵃鍑烘潵
System.out.println (c.getInt(2));銆
conn.close();
}
}




浜岋紝浣跨敤JAVA鍒涘緩Oracle瀛樺偍榪囩▼

銆銆鍏堢湅涓嬪浣曚嬌鐢↗AVA鏉ョ紪鍐橭racle瀛樺偍榪囩▼錛屾垜浠湪Oracle鐨剆ql plus涓紪鍐欒鍙ャ?/p>

銆銆鈪犮佸惎鍔⊿QL PLUS

銆銆鈪°佺紪鍐橨AVA綾伙紝瀹氫箟JAVA綾誨埆鍚嶏紝鏈瓨鍌ㄨ繃紼嬩負綆鍗曞湴杈撳嚭浼犲叆鍙傛暟鐨勫鉤鏂瑰箋?/p>

銆create or replace and compile java source named銆"PF"銆as
/**
*閫氳繃JAVA綾繪潵 鍒涘緩Oracle瀛樺偍榪囩▼
*
**/
package銆org.oraclejava.pro;
public銆 class銆javaCreatePro
{
public銆 static銆 String銆test( int num)
{
return銆num+ "鐨勫鉤鏂逛負錛?" +num*num;
}
}

銆銆鈪€佸皢JAVA綾諱腑鐨勬柟娉晅est鍒涘緩涓轟竴涓狾racle鍑芥暟鏂規(guī)硶

銆銆create or replace function PF_FUN(name integer) return varchar2 as language java name 'org.oraclejava.pro.javaCreatePro.test(java.lang.Integer) return java.lang.String';

銆銆鈪c佸湪鎺у埗鍙扮洿鎺ヨ皟鐢ㄥ垱寤虹殑Oracle鍑芥暟

銆銆select PF_FUN(10) from dual;

銆銆鈪ゃ佽緭鍑虹粨鏋?/p>

銆銆10鐨勫鉤鏂逛負錛?00

銆銆浠ヤ笂鍗蟲槸鍦∣racle涓殑SQL PLUS涓嬌鐢↗AVA紼嬪簭鏉ヤ駭鐢烵racle瀛樺偍榪囩▼鐨勬紨紺轟緥瀛愶紝婕旂ず浜嗗叾鍩烘湰璇硶鐨勫疄鐜拌窡綆鍗曠殑鍔熻兘瀹炵幇錛屽彲浠ョ湅鍑哄湪JAVA璺烵racle涔嬮棿瀛樺湪寰堝鏈夎叮鐨勭敤娉曪紝鍥犱負oracle涓湁java铏氭嫙鏈猴紝浣垮緱Oracle鍙樺緱鏇村姞鏈夎叮鏇村姞涓板瘜澶氬僵




瑗跨摐 2009-05-22 16:19 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲综合色丁香婷婷六月图片| 亚洲日韩欧洲乱码AV夜夜摸| 亚洲第一福利视频| 中文字幕免费在线看| 亚洲精品国产自在久久| 毛片亚洲AV无码精品国产午夜| 免费观看男人免费桶女人视频| 亚洲国产精品一区二区三区在线观看 | 亚洲成人高清在线观看| 最好看最新的中文字幕免费| 久久久久久亚洲精品| 国产精品视频白浆免费视频| 五月天网站亚洲小说| 2021精品国产品免费观看| 狠狠躁狠狠爱免费视频无码| 成人亚洲性情网站WWW在线观看| 麻豆安全免费网址入口| 亚洲国产婷婷综合在线精品| 一区二区三区免费精品视频| 亚洲人精品午夜射精日韩| 日韩精品内射视频免费观看| 亚洲国产理论片在线播放| 好吊妞在线成人免费| 国产精品国产亚洲区艳妇糸列短篇| 四虎永久在线精品视频免费观看| 一级成人a做片免费| 亚洲av伊人久久综合密臀性色| 国产成人精品免费视频动漫| 亚洲国产精品久久久久秋霞小| 亚洲精品国产日韩无码AV永久免费网 | 亚洲不卡中文字幕无码| 13一14周岁毛片免费| 精品日韩99亚洲的在线发布| 国产小视频在线观看免费| 一个人看的免费观看日本视频www 一个人看的免费视频www在线高清动漫 | 国产免费福利体检区久久| 久久久亚洲精品无码| 日本三级2019在线观看免费| 国产成人亚洲午夜电影| 亚洲av一综合av一区| 日韩免费高清视频网站|