我的空間,寫我所寫,禪我所藏

          與我一起遨游吧

           

          Hibernate影響設計思路

               摘要: 總覺得Hibernate影響設計思路 發表: 2006年07月23日 08:09 回復 ...  閱讀全文

          posted @ 2007-04-03 00:02 imcb 閱讀(557) | 評論 (0)編輯 收藏

          出了ORA-27101: shared memory realm does not exist 錯誤的處理

          我試圖連接數據庫時的ORA-01034 和 ORA-27101錯誤信息,它總是顯示這樣的信息,“ORA-01034 - Oracle not available”和“ORA-27101 - shared memory realm does not exist”。
          不能連接到我的Oracle 數據庫上。
          因為碰到防火墻的問題次數比較多,這次也先看看,發現根本就沒什么攔截的。查看了一下監聽,數據庫實例也是運行著的。
          奇怪的事情,剛才還好好的,重啟了機器就不行了。上網找了找,問題就解決了。

          解決的方法倒是不麻煩...
            首先看一下 ORACLE_BASE\ORACLE_HOME\DATABASE 下面的 ORADIM.LOG 文件
            如果里邊有這個錯誤
            ORA-12640: 驗證適配器初始化失敗
            那么問題就是他了.
            到ORACLE_BASE\ORACLE_HOME\NETWORK\ADMIN下面找sqlnet.ora文件
            把sqlnet.authentication_services=(NTS) 改成
            sqlnet.authentication_services=(NONE)
            然后手動重起一下你的哪個數據庫服務..在開始->控制面板->管理工具->服務里然后把這個服務的啟動帳號改成你的帳號吧...其實不改大概也沒有毛病.我就沒改。。

          看了這個方法,出錯的原因大概有兩種情況,修改了帳戶,實例有些變動等。

          posted @ 2007-04-02 23:48 imcb 閱讀(40106) | 評論 (1)編輯 收藏

          使用cmd窗口去執行sql語句

          在cmd窗口中,使用sqlplus,使用用戶名,密碼登陸默認的數據庫。

          posted @ 2007-03-29 15:25 imcb 閱讀(617) | 評論 (0)編輯 收藏

          在Tomcat 5.5.20中配置JNDI的體會

          The Context element represents a web application, which is run within a particular virtual host. Each web application is based on a Web Application Archive (WAR) file, or a corresponding directory containing the corresponding unpacked contents, as described in the Servlet Specification (version 2.2 or later).??

          從上述描述看出,Context元素代表的是一個web application。

          You may define as many Context elements as you wish. Each such Context MUST have a unique context path, which is defined by the path attribute. In addition, you MUST define a Context with a context path equal to a zero-length string. This Context becomes the default web application for this virtual host, and is used to process all requests that do not match any other Context's context path.

          從上面的描述可以看出Context的數量自己定,但是必須定義一個path屬性為空的Context,用來出來匹配不上其它path的用戶請求。

          In addition to nesting Context elements inside a Host element, you can also store them:

          • in the individual $CATALINA_HOME/conf/context.xml file: the Context element information will be loaded by all webapps
          • in the individual $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default file: the Context element information will be loaded by all webapps of that host
          • in individual files (with a ".xml" extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/ directory
          • if the previous file was not found for this application, in individual file at /META-INF/context.xml inside the application files

          以上的文字,是我寫這篇文檔的根源。

          Context element的放置位置:有5個。

          1、conf/server.xml的host元素之下。

          2、conf/context.xml 中,被所有的應用共享。

          3、conf/[enginename]/[hostname]/context.xml中,被所有的應用共享。

          4、conf/[enginename]/[hostname]/ directory.xml中,就是以目錄名作為文件名的配置文件。

          5、/META-INF/context.xml 在應用的目錄中。

          其中:1、2、3都是全局共享的。

          4、5都是針對獨立應用的。

          最后一種5生效的唯一理由是前面的4的文件找不到,如果有4,則5的配置將會完全被屏蔽掉。

          This method allows dynamic reconfiguration of the web application, since the main conf/server.xml file cannot be reloaded without restarting Tomcat. Please note that for tomcat 5, unlike tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above.

          以上的描述可以發現,conf/server.xml file cannot be reloaded without restarting Tomcat。

          反之如果配置到其他地方卻可以自動reload。自動重載意味著什么我就不多說了。

          為了聯系配置JNDI,我安裝了mysql 5.0.18

          在其中建立了一個測試的庫,和一張表,插入了一點兒數據。

          JNDI的使用,分為兩種:全局和局部的。

          全局的:

          conf/server.xml中配置(注意,配置Resource的方法在Tomcat的以前版本中不是這樣的,需要按照這個簡化語法來改,否則就和我一樣折騰半死也不明白為什么了。)

          < GlobalNamingResources >
          ...
          ????
          < Resource
          ??????
          name ="student"
          ??????type
          ="javax.sql.DataSource"
          ??????driverClassName
          ="com.mysql.jdbc.Driver"
          ??????password
          ="1"
          ??????maxIdle
          ="2"
          ??????maxWait
          ="5000"
          ??????username
          ="root"
          ??????url
          ="jdbc:mysql://localhost:3306/schoolproject"
          ??????maxActive
          ="4" />

          ...
          ??
          </ GlobalNamingResources >

          配置完成之后,就是使用它了。

          有兩個地方,根據前文描述,選擇一個。

          建立META-INF/context.xml(使用方法5,在局部配置時掩飾使用方法4)

          <?xml version="1.0" encoding="UTF-8"?>
          ??? < Context? path ="/test_deploy" >
          ????
          < ResourceLink? name ="student" ?type ="javax.sql.DataSource" ?global ="student" />
          </ Context >

          其中的name是程序中引用,其中的global是在全局Resource中定義的name。

          寫個測試的jsp

          index.jsp

          <% @?page?language = " java " ? import = " javax.sql.*,java.sql.*,javax.naming.* " ?contentType = " text/html;charset=UTF-8 " %>
          < html >
          ????
          < head >
          ????????
          < title >
          ????????????test
          ????????
          </ title >
          ????
          < head >
          ????
          < body >
          ????????Hello?olojiang
          !< br />
          ????????
          <%
          ????????????Context?initCtx?
          = ? new ?InitialContext();
          ????????????DataSource?ds?
          = ?(DataSource)initCtx.lookup( " java:comp/env/student " );
          ????????????
          if (ds? != ? null ) {
          ????????????????Connection?conn?
          = ?ds.getConnection();
          ????????????????Statement?st?
          = ?conn.createStatement();
          ????????????????
          ????????????????ResultSet?rs?
          = ?st.executeQuery( " select?*?from?student " );
          ????????????????
          while (rs.next()) {
          ????????????????????out.print(rs.getString(
          1 )? + ? " ? " );
          ????????????????????out.print(rs.getString(
          2 )? + ? " ? " );
          ????????????????????out.print(rs.getString(
          3 )? + ? " ? " );
          ????????????????????out.println(rs.getInt(
          4 )? + ? " <br/> " );
          ????????????????}

          ????????????????st.close();
          ????????????????conn.close();
          ????????????}

          ????????
          %>
          ????
          </ body >
          </ html >

          ?完美輸出結果。

          局部的:

          conf\Catalina\localhost\DBTest.xml(使用方法4,前面演示了使用方法5)

          在其中書寫可以有動態重載的優勢,DBTest時目錄名稱。

          < Context? path ="/DBTest" ?docBase ="DBTest" ?debug ="5" ?reloadable ="true" ?crossContext ="true" >
          ????
          < Resource
          ????????
          name ="jdbc/TestDB"
          ????????type
          ="javax.sql.DataSource"
          ????????driverClassName
          ="com.mysql.jdbc.Driver"
          ????????password
          ="1"
          ????????maxIdle
          ="2"
          ????????maxWait
          ="5000"
          ????????username
          ="root"
          ????????url
          ="jdbc:mysql://localhost:3306/schoolproject"
          ????????maxActive
          ="4" />
          </ Context >

          配置好了之后,比前面多處一步:需要在應用的WEB-INF/web.xml中寫引用。(使用全局的配置不需要作這一部也能成功,這里不作這步我也好像成功了,但是很多地方都寫需要這步,不知為何?

          <? xml?version="1.0"?encoding="UTF-8" ?>
          < web-app? xmlns ="http://java.sun.com/xml/ns/j2ee"
          ????xmlns:xsi
          ="http://www.w3.org/2001/XMLSchema-instance"
          ????xsi:schemaLocation
          ="http://java.sun.com/xml/ns/j2ee
          http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

          ????version
          ="2.4" >
          ??
          < description > MySQL?Test?App </ description >
          ??
          < resource-ref >
          ??????
          < description > DB?Connection </ description >
          ??????
          < res-ref-name > jdbc/TestDB </ res-ref-name >
          ??????
          < res-type > javax.sql.DataSource </ res-type >
          ??????
          < res-auth > Container </ res-auth >
          ??
          </ resource-ref >
          </ web-app >

          ?使用同樣的JSP測試之:

          <% @?page?language = " java " ? import = " javax.sql.*,java.sql.*,javax.naming.* " ?contentType = " text/html;charset=UTF-8 " %>
          < html >
          ????
          < head >
          ????????
          < title >
          ????????????test
          ????????
          </ title >
          ????
          < head >
          ????
          < body >
          ????????Hello?olojiang
          !< br />
          ????????
          <%
          ????????????Context?initCtx?
          = ? new ?InitialContext();
          ????????????DataSource?ds?
          = ?(DataSource)initCtx.lookup( " java:comp/env/jdbc/TestDB " );
          ????????????
          if (ds? != ? null ) {
          ????????????????Connection?conn?
          = ?ds.getConnection();
          ????????????????Statement?st?
          = ?conn.createStatement();
          ????????????????
          ????????????????ResultSet?rs?
          = ?st.executeQuery( " select?*?from?student " );
          ????????????????
          while (rs.next()) {
          ????????????????????out.print(rs.getString(
          1 )? + ? " ? " );
          ????????????????????out.print(rs.getString(
          2 )? + ? " ? " );
          ????????????????????out.print(rs.getString(
          3 )? + ? " ? " );
          ????????????????????out.println(rs.getInt(
          4 )? + ? " <br/> " );
          ????????????????}

          ????????????????st.close();
          ????????????????conn.close();
          ????????????}

          ????????
          %>
          ????
          </ body >
          </ html >

          運行完美。

          兩種方法都說了,自己走了很多彎路,配這么點兒東西折騰了一整天,忘后來者能順利些。

          不足處請多包涵。

          開心ing!~

          posted @ 2007-03-29 11:21 imcb 閱讀(981) | 評論 (1)編輯 收藏

          TNSLISTENER 服務無法啟動

          在機上裝了Oracle 9i,也配好了TNSLISTENER監聽程序。啟動時,其它服務都啟動正常,唯獨TNSLISTENER監聽服務無法啟動。在“控制面板”之“服務”中查看,發現該服務的屬性中“可執行文件的路徑”一欄為空白,無法指定其真實的執行路徑。
          在“開始”-“程序”-“Oralce-OraHome92”-“Net Configuration Assistant”中配置監聽程序后依然如此。
          可在cmd命令下用以下命令來控制監聽
          snrctl stop
          lsnrctl start
          lsnrctl service

          使用lsnrctl start啟動監聽時有下面信息:

          啟動tnslsnr:請稍候...

          TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production
          系統參數文件為D:\oracle\ora92\network\admin\listener.ora
          寫入D:\oracle\ora92\network\log\listener.log的日志信息
          監聽:(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC0ipc)))
          監聽該對象時出錯: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=zhengxibing)(PORT=15
          21)))
          TNS-12545: 因目標主機或對象不存在,連接失敗
          ?TNS-12560: TNS: 協議適配器錯誤
          ? TNS-00515: 因目標主機或對象不存在,連接失敗
          ?? 32-bit Windows Error: 1001: Unknown error

          監聽程序未能啟動。請參閱上面的錯誤消息...

          原因是機器名修改過后,D:\oracle\ora92\network\admin\listener
          .ora文件的機器名沒有修改為新的機器名。

          posted @ 2007-03-28 15:34 imcb 閱讀(1831) | 評論 (0)編輯 收藏

          SQL統計查詢

          select count(*) from wf_flow_instance_info t where t.flow_id = '416'
          /*
          select count(*) from wf_document_statictis_view t
          where t.flow_id='416' and t.writ_form_id = '161'-- t.flow_name like '%増容%'-- and t.writ_form_name like '%不予%'
          */
          --select * from wf_flow_info t where t.flow_visible !='0'

          /*
          select count(*) from wf_flow_writ_ins_info w
          where w.writ_form_id = '89'
          and w.flow_instance_id in (
          select ins.instance_id from wf_flow_instance_info ins where ins.flow_id='390'
          )
          */

          posted @ 2006-11-22 16:15 imcb 閱讀(518) | 評論 (0)編輯 收藏

          朋友,您好!歡迎來到我的BlogJava空間.

          這是我BlogJava的第一篇日志,非常感謝您的到來!
          在這個空間里,我準備將一些主要的Java編程設想和某些技術領域發表一些個人的看法;
          也希望來參觀我空間的人,參與討論;

          這是一個自由的空間,我們要的是idea,
          Please give me some ideas when you have?ideal options.
          We share More development on the Roma Road;
          thank you very much! thanks a lots!

          posted @ 2006-11-22 12:30 imcb 閱讀(121) | 評論 (0)編輯 收藏

          僅列出標題
          共3頁: 上一頁 1 2 3 

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 和顺县| 长葛市| 台安县| 平谷区| 醴陵市| 措美县| 元氏县| 黄骅市| 含山县| 五河县| 建平县| 和平区| 长顺县| 顺昌县| 佳木斯市| 裕民县| 渭南市| 长泰县| 香河县| 东乡县| 密云县| 梨树县| 上高县| 开封县| 定结县| 阜城县| 凉城县| 上杭县| 溆浦县| 蓬溪县| 安康市| 泽普县| 密云县| 灵武市| 南投县| 北碚区| 武宁县| 浦东新区| 大名县| 温泉县| 大关县|