Berkely DB Java Editionѧϰ±Ê¼ÇÒ»
Berkely DB¶ÔÓڸ߲¢·¢¡¢ÒªÇóËٶȿìµÄÓ¦ÓÃÀ´ËµÊǸö²»´íµÄÑ¡Ôñ£¬mysql¾ÍÊÇÓÃBDBʵÏÖµÄ(mysqlµÄºǫ́) £¬mysql¿ì£¬BDB±Èmysql»¹Òª¿ìN±¶¡£BDBÊÇÒ»ÖÖǶÈëʽµÄ¡¢·Ç¹ØϵÊý¾Ý¿â£¬ËüÓëÆäËûµÄ¹ØϵÊý¾Ý¿âRMDBS²»Í¬,ËüûÓÐÌṩSQL,¶øÊÇÌṩÁË×Ô¼ºµÄ·ÃÎʽӿڡ£×÷ΪһÖÖǶÈëʽµÄÊý¾Ý¿â£¬ËüÊǽø³ÌÄÚģʽµÄ£¬Ò²¾ÍÊÇ˵ËüºÍÓ¦ÓóÌÐòÔÚͬһÄÚ´æ¿Õ¼äÔËÐУ¬ËùÒÔËÙ¶ÈÒª¸ßºÜ¶à£¬ÓëǶÈëʽµÄÊý¾Ý¿âÈçDerby¡¢HSQLDB(¶¼ÊÇRMDBSµÄ)Ïà±È£¬ËüЧÂʸü¸ß£¬Ê¹Ó÷½·¨Ò²ÓкܴóµÄ²»Í¬¡£ÏÖÔÚBDBÒÔ±»OracleÊÕ¹º¡£Berkely DBÌṩµÄÎĵµGetting Started with¡¡Berkeley DB Java Edition¿ÉÒÔ˵ÊǶÌС¾«º·£¨£±£±£³Ò³£©£¬ÈëÃÅÏ൱²»´í¡£ÏÂÃæGet Start°É£º
Environment£º
Ê×ÏÈÒª½Ó´¥µÄ¾ÍÊÇEnvironmentÁË£¬Ê¹ÓÃËüÀ´open¡¡databaseÒÔ¼°×öÒ»¹ÜÀí·½ÃæµÄÊÂÇé.
´´½¨Environment£¬»¹ÐèÒªEnvironmentµÄһЩÅäÖÃÐÅÏ¢EnvironmentConfig¡£
ÏÂÃæÊÇ´´½¨µÄ¹ý³Ì£º
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
myDbEnvironment = new Environment(new File("/export/dbEnv"),
envConfig);
ÆäÖÐEnvironmentConfigÌṩÁËÐí¶àÅäÖòÎÊý£¬³£ÓõÄÓУº
envConfig.setAllowCreate()//Èç¹û²»´æÔÚµÄenvµÄ»°£¬ÊÇ·ñÒª´´½¨Ò»¸öеÄ
envConfig.setReadOnly()//ÊÇ·ñΪֻ¶ÁµÄ
envConfig.setTransactional()//ÊÇ·ñʹÓÃÊÂÎñ
²ÎÊý¶¼ÊÇbooleanÀàÐ͵Ä
³ýÁËEnvironmentConfigÍ⣬»¹ÓÐEnvironmentMutableConfig£¬Ëûʵ¼ÊÊÇEnvironmentConfigµÄ¸¸À࣬ʹÓÃËûÀ´ÅäÖÃÔÚ´´½¨ÍêEnvironmentÖ®ºó¿ÉÒԸıä
µÄÊôÐÔ£º
setCachePercent()//ÉèÖÃcacheµÄ´óСռJVM¡¡memoryµÄ°Ù·Ö±È
setCacheSize()//ÉèÖÃcacheµÄ´óС
setTxnNoSync()//ÊÂÎñÌá½»ÊÇ·ñ½«¸Ä±äµÄ¼Ç¼дÈë´ÅÅÌ
setTxnWriteNoSync()//ÊÂÎñÌá½»ÊÇ·ñ½«logдÈë´ÅÅÌ
ÏÂÃæ¿´Ò»ÏÂʹÓÃEnvironmentMutableConfigµÄ·½·¨:
Environment myEnv = new Environment(new File("/export/dbEnv"), null);
EnvironmentMutableConfig envMutableConfig =
new EnvironmentMutableConfig();
envMutableConfig.setTxnNoSync(true);
myEnv.setMutableConfig(envMutableConfig);
Environmentͨ¹ýcloseÀ´¹Ø±Õ£¬ÊÍ·Å×ÊÔ´
ÏÂÃæ¿´¿´EnvironmentÔÚ¹ÜÀí·½ÃæµÄһЩ·½·¨£º
¿ÉÒÔͨ¹ýEnvironment»ñµÃEnvironmentStats£¬ËûÌṩÁËEnvironmentһЩ״̬ÐÅÏ¢£¬
ÀýÈçʹÓÃ
long cacheMisses = myEnv.getStats(null).getNCacheMiss();
ÎÒÃÇ¿ÉÒÔ»ñ
Ïà¹ØÎĵµ£º
Java NIO APIÏê½â
ÔÚJDK
1.4ÒÔÇ°£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
ÀàÐÍת»» Îı¾¿òStringתΪdouble Double·â×°Àà
Òì³£´¦Àí
ÏÔʾ¸ñʽ
ÕûÊý½á¹ûĩβȥ.0
Ê×λ²»ÄÜΪ0
+/- ÎÊÌâ Êý´óÓÐbug
Á¬¼ÓÁ¬¼õÎÊÌâ
»ØÍË
³ý0±¨´í
²»ÄܳöÏÖ¶à¸öµã °´ÁËÒ»¸öµãÔÙ°´Ã»ÓÐ
×Ö·û´®ÊDz ......
Ò»¡¢ ¼ò½é
Berkeley DB Java Edition (JE)ÊÇÒ»¸öÍêÈ«ÓÃJAVAдµÄ£¬ËüÊʺÏÓÚ¹ÜÀíº£Á¿µÄ£¬¼òµ¥µÄÊý¾Ý¡£
Äܹ»¸ßЧÂʵĴ¦Àí1µ½1°ÙÍòÌõ¼Ç¼£¬ÖÆÔ¼JEÊý¾Ý¿âµÄÍùÍùÊÇÓ²¼þϵͳ,¶ø²»ÊÇJE±¾Éí¡£
¶ ......