比较急,所有可用分都完了!摆平了到以下接分
http://expert.csdn.net/Expert/topic/2234/2234107.xml?temp=.2883112
http://expert.csdn.net/Expert/topic/2234/2234106.xml?temp=2.215213E-02
http://expert.csdn.net/Expert/topic/2234/2234105.xml?temp=.2531092
http://expert.csdn.net/Expert/topic/2234/2234104.xml?temp=.2728845

解决方案 »

  1.   

    sorry!写错了:收集JAVA应用程序访问 Berkeley DB 的资料!
      

  2.   

    UP有分都没人UP啊?
    郁闷!
      

  3.   

    /*
     *  A sample program to set up an DbEnv, create an Db, and then 
     *  populate the db with 1000 records, using Berkeley DB
     *  
     *  Author: Prof. Li-Yan Yuan, University of Alberta
     * 
     *  A directory named "/tmp/my_db" must be created before testing this program.
     *
     */
    import com.sleepycat.db.*;
    import java.io.FileNotFoundException;
    import java.io.OutputStream;
    import java.util.*;public class Sample{
        private static final String DATABASE_HOME = "tmp/my_db";
        private static final String SAMPLE_TABLE = "sample_table";    /*
         *  the main function
         */
        public static void main(String[] args) {        Db dbp = null; try {
        /* to set up a db enviornment */
        DbEnv dbenv = new DbEnv(0);
        dbenv.set_cachesize(0, 64 * 1024, 0);     dbenv.open(DATABASE_HOME, Db.DB_CREATE  |
                       Db.DB_INIT_MPOOL | Db.DB_INIT_TXN, 0);     /* create a new db handle */
                dbp = new Db(dbenv, 0);     /* create a new database of DB_BTREE type */
                dbp.open(DATABASE_HOME, null, Db.DB_BTREE, Db.DB_CREATE , 0);
        System.out.println(DATABASE_HOME + " has been created");     /* populate the new database with 1000 records */
        populateTable(dbp, 10000);
        System.out.println("1000 records inserted into" + DATABASE_HOME);     /* cloase the database and the db enviornment */
        dbp.close(0);     /* remove the database */
                dbp = new Db( dbenv, 0);
                dbp.remove(SAMPLE_TABLE, null, 0);
           
        /* cloase the db enviornment */
        dbenv.close(0);
            }
            catch (Exception e1) {
                System.err.println("Test failed: " + e1.toString());
            }
        }
        /*
         *   To pouplate the given table with nrecs records
         */
        static void populateTable(Db dbp, int nrecs ) {
    int range;
            Dbt kdbt, ddbt;
    String s; /*  
              *  generate a random string with the length between 64 and 128
              */
    Random random = new Random( 1000000 );        try {
                for (int i = 0; i < nrecs; i++) { /* to generate a key string */
    range = 64 + random.nextInt( 64 );
    s = "";
    for ( int j = 0; j < range; j++ ) 
      s+=(new Character((char)(97+random.nextInt(26)))).toString(); /* to create a DBT for key */
    kdbt = new Dbt(s.getBytes());
    kdbt.set_size(s.length()); 
    /* to generate a key string */
    range = 64 + random.nextInt( 64 );
    s = "";
    for ( int j = 0; j < range; j++ ) 
      s+=(new Character((char)(97+random.nextInt(26)))).toString();

    /* to create a DBT for data */
    ddbt = new Dbt(s.getBytes());
    ddbt.set_size(s.length());  /* to insert the key/data pair into the database */
                    dbp.put(null, kdbt, ddbt, Db.DB_NOOVERWRITE);
                }
            }
            catch (DbException dbe) {
                System.err.println("Populate the table: "+dbe.toString());
                System.exit(1);
            }
        }
    }这是一个自带的例子,程序没有错误,classpath环境变量配好了,但是还有一个 LD_LIBRARY_PATH 的环境变量不知道怎么配置,所以编译有以下错误:
    F:\Program Files\jdk1.4\bin>javac G:\test\sample.java
    G:\test\sample.java:38: open(com.sleepycat.db.DbTxn,java.lang.String,java.lang.S
    tring,int,int,int) in com.sleepycat.db.Db cannot be applied to (java.lang.String
    ,<nulltype>,int,int,int)
                dbp.open(DATABASE_HOME, null, Db.DB_BTREE, Db.DB_CREATE , 0);
                   ^
    1 errorF:\Program Files\jdk1.4\bin>
      

  4.   

    有请 liad() 接分!
    http://expert.csdn.net/Expert/topic/2234/2234104.xml?temp=.8802301