<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Ryan's Java world!

    something about Java and opensource!

    BlogJava 首頁 新隨筆 聯系 聚合 管理
      51 Posts :: 25 Stories :: 59 Comments :: 0 Trackbacks

    在前面兩篇 http://blog.matrix.org.cn/comments/icess/Weblog/use_derby_with_clob_and??文章中,我簡單介紹了如何使用Java DB操作數據,今天發現一個關于關閉數據庫的問題, 就是在調用前面例子中的關閉數據庫代碼時候總是拋出異常 ,后來到文檔里面看看 ,原來在關閉數據庫時候, Derby總是拋出異常,我還以為是我那個地方寫錯了呢?

    以前例子中沒有顯示異常信息 是應為 在關閉數據庫的方法中沒有使用 打印異常信息的語句, 如下

    public void disconnect() {
    ??????? if(isConnected) {
    ??????????? String dbUrl = getDatabaseUrl();
    ??????????? dbProperties.put("shutdown", "true");
    ??????????? try {
    ??????????????? DriverManager.getConnection(dbUrl, dbProperties);
    ??????????? } catch (SQLException ex) {
    ??????????? ?//ex.printStackTrace();?? //?前面的例子沒有該句, 如果加上該句,就會看的異常信息
    ??????????? }
    ??????????? isConnected = false;
    ??????? }
    ??? }

    ?

    所以,當大家看到下面的異常時候,不用擔心 不是你的代碼寫錯了,而是程序正確關閉數據庫的提示(有點違背異常的設計初衷哦).

    ERROR 08006: Database 'TestClob' shutdown.
    ?at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
    ?at org.apache.derby.impl.jdbc.TransactionResourceImpl.shutdownDatabaseException(Unknown Source)
    ?at org.apache.derby.impl.jdbc.EmbedConnection.<init>(Unknown Source)

    ...........
    21:10 補充:

    使用Java DB的最佳實踐

    Recommended practices

    When developing Derby applications, create a single directory to hold your database or databases. Give this directory a unique name, to help you remember that:
    • All databases exist within a system.
    • System-wide properties affect the entire system, and persistent system-wide properties live in the system directory.
    • You can boot all the databases in the system, and the boot-up times of all databases affect the performance of the system.
    • You can preboot databases only if they are within the system. (Databases do not necessarily have to live inside the system directory, but keeping your databases there is the recommended practice.)
    • Once you connect to a database, it is part of the current system and thus inherits all system-wide properties.
    • Only one instance of Derby can run in a JVM at a single time, and only one instance of Derby should boot a database at one time. Keeping databases in the system directory makes it less likely that you would use more than one instance of Derby.
    • The error log is located inside the system directory.
    posted on 2006-04-17 20:38 冰雨 閱讀(854) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
    博客園   IT新聞   Chat2DB   C++博客   博問  
     

    JSF中文技術文摘
    主站蜘蛛池模板: 好吊妞在线新免费视频| 国产亚洲精品激情都市| 免费的黄网站男人的天堂| 亚洲日韩国产成网在线观看| 永久免费不卡在线观看黄网站| 亚洲综合久久久久久中文字幕| 国产成人A在线观看视频免费 | 亚洲日韩涩涩成人午夜私人影院| 免费精品久久天干天干| 亚洲一级免费视频| 亚洲国产一区视频| 亚洲黄色免费观看| yellow视频免费看| 亚洲av无码片在线观看| 久久夜色精品国产亚洲av| 国国内清清草原免费视频99| 国产福利电影一区二区三区,免费久久久久久久精 | 免费一级毛片无毒不卡| 亚洲欧洲精品成人久久曰| 亚洲国产AV无码专区亚洲AV | www.亚洲精品.com| 国产福利视精品永久免费| 黄色网页免费观看| 亚洲免费电影网站| 久久精品国产亚洲av麻| 国产色爽免费视频| 亚洲视频在线观看免费视频| 美女视频黄频a免费观看| 亚洲一区在线观看视频| 亚洲AV无码一区二区三区系列 | 中国xxxxx高清免费看视频| 人妻巨大乳hd免费看| 亚洲卡一卡二卡乱码新区| 久久亚洲精品成人777大小说| 亚洲成a人片在线观看久| 我要看WWW免费看插插视频| 一级毛片不卡片免费观看| 国产免费伦精品一区二区三区| 亚洲高清一区二区三区电影| 亚洲国产综合第一精品小说| 亚洲五月综合缴情在线观看|