Monday, June 26, 2006

Berkeley DB: Part Three

Message Handler

package db.GettingStarted;
import com.sleepycat.db.Environment;
import com.sleepycat.db.MessageHandler;

public class MyMessageHandler implements MessageHandler
{
// Our constructor does nothing
public MyMessageHandler() {}
public void message(Environment dbenv, String message)
{
// Put your special message handling code here
}
}

Set the databaseconfig to use this messagehandler
package db.GettingStarted;
import com.sleepycat.db.DatabaseConfig;
...
DatabaseConfig myDbConfig = new DatabaseConfig();
MyMessageHandler mmh = new MyMessageHandler();
myDbConfig.setMessageHandler(mmh);

Chimney Bluff State Park

http://www.fotosearch.com/CRT369/15420-01ns/

Visited this on 06/25/06

Friday, June 23, 2006

Berkeley DB:Part Two

1. Code for exception handing

try
{

}
catch (DatabaseException e)
{
}


2. Errno values, if the errno values are greater than zero then a system error occurred. Special error values like the key and the data being searched is not found results in a error withe negative value.

3. Key and Data of records managed by DatabaseEntry class.

DatabaseConfig class allows setting the properties of the database,
package db.GettingStarted;
import com.sleepycat.db.Database;
import com.sleepycat.db.DatabaseConfig;
import com.sleepycat.db.DatabaseException;
import com.sleepycat.db.DatabaseType;
import java.io.FileNotFoundException;
...
Database myDatabase = null;
try {
DatabaseConfig dbConfig = new DatabaseConfig();
dbConfig.setAllowCreate(true);
dbConfig.setSortedDuplicates(true);
dbConfig.setType(DatabaseType.BTREE);
myDatabase = new Database("sampleDatabase.db",
null,
dbConfig);

if (myDatabase != null)
myDatabase.close();

} catch (DatabaseException dbe) {
// Exception handling goes here.
} catch (FileNotFoundException fnfe) {
// Exception handling goes here
}

Berkeley DB: Part one

Berkely DB concepts
----------------------

1.DB databases contains records
2. A record contains a key and value.
3. key/data of a record , the data cen be complex.
4. DB database similar like a table in a relation
5. DB applications could use more than one DB databases ( more than 1 tables)
6. The DB database containing records have an assoicated access methods to them
a) Btree
b) Hash
c) Queue
7. Typical DB applications will using many DB databases.
8. Retrieving the records = get()
Putting the records = put()
9. If the databases does not support duplicate records , the next time you insert the data records with existing key, this key replaces the old key.

10. In addition to handles, cursors could be used to insert/retrieve data. Cursors could be used to seek to the data
11. DB provides secondary database which serves as an index to the primary database. Cursors are iterators over the records on the database.
12. Btree access method the most popular method to retrieve data.
13. RecNo , logical records numbers as keys.

Arbitrary Data (strings) Btree or Hash
logical records number (integer) Queue or Recno.

14. Small working datasets no difference between RecNo.

Thursday, June 22, 2006

My laptop crash

So what I did not want has finally happened. My laptop crashed yesterday and even though I think I managed to backup some data before that, but now I am in a precarious position.

First I have suse 9.2 and windows on my laptop. And i had a spyware problem with my PC and I tried to remove it with tools in the market. And since I have rebooted nothing shows up on my screen, not even the BIOS screen. I tried to boot from my recovery drive disk in the CD-ROM drive but nothing seems to happen on my computer screen.

I am trying to boot through the SUSE bootable CD and see what happens.

Wednesday, June 21, 2006

Talk with Werner Vogels and Jim Gray in ACM queue

http://www.acmqueue.com/modules.php?name=Content&pa=showpage&pid=388