比较急,所有可用分都完了!摆平了到以下接分
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
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
解决方案 »
- 求高手解释 boolean
- java静态方法和非静态方法有什么不同?
- int 32位 double 64位 这些位到底是什么概念? 与硬件有哪些关系!
- 非常有意思的问题!!!!
- 字符编码转换问题,在线等.....
- JdbTable里的列头字体改变后,为什么行的序号变成三个点?
- 关于小弟的第一个JAVA程序的问题
- 关于getParameterValues方法和动态数组与集合的问题求教
- 请问有在windows2003server下开发JSP的同志一个问题!
- jsp文件中包含一个applet,如何把applet的运行结果传给jsp文件使用?
- 一个简单的问题,用JTable显示数据库中的记录,帮小弟调整一下这个程序
- 超难问题,高手请进
* 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>
http://expert.csdn.net/Expert/topic/2234/2234104.xml?temp=.8802301