User:Lindenb/Notebook/UMR915/20100830

From OpenWetWare
Jump to navigationJump to search

20100816        Top        20100831       


Back from Holidays ! Sambaaaaa !

Project

The database must support many projects, not only 'Br' , so...

 CREATE TABLE `project` (
 `id` int(10) unsigned NOT NULL auto_increment,
 `name` varchar(50) NOT NULL,
 `description` mediumtext NOT NULL,
 `creation` datetime default NULL,
 `modified` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
 PRIMARY KEY  (`id`),
 UNIQUE KEY `name` (`name`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 

must think how I will link this stuff... JSP: i should implement a custom iterator tag for CloseableIterator

ok, done: http://code.google.com/p/code915/source/browse/trunk/core/src/java/fr/inserm/umr915/core/j2ee/tag/IteratorTag.java

MongoDB

Starting the server

Default port is 28017

/package/mongodb-linux-i686-1.6.1/bin/mongod --dbpath /home/lindenb/tmp/MONGO/DATA --rest
Mon Aug 30 16:16:54 MongoDB starting : pid=4368 port=27017 dbpath=/home/lindenb/tmp/MONGO/DATA 32-bit 

** NOTE: when using MongoDB 32 bit, you are limited to about 2 gigabytes of data
**       see http://blog.mongodb.org/post/137788967/32-bit-limitations

Mon Aug 30 16:16:54 db version v1.6.1, pdfile version 4.5
Mon Aug 30 16:16:54 git version: c5f5f9a4f3b515dfd5272d373093fd4fd58c95d9
Mon Aug 30 16:16:54 sys info: Linux domU-12-31-39-01-70-B4 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:39:36 EST 2008 i686 BOOST_LIB_VERSION=1_37
Mon Aug 30 16:16:55 [initandlisten] waiting for connections on port 27017
Mon Aug 30 16:16:55 [websvr] web admin interface listening on port 28017

Connecting to DB

./package/mongodb-linux-i686-1.6.1/bin/mongo
MongoDB shell version: 1.6.1
connecting to: test
> show dbs
admin
local
>  show collections
>  show users

creating a DB

>  use umr915
switched to db umr915

#create a new object

> snp1={name:'rs1',observed:'A/T',position:{chrom:'chr3',position:10000}}
{
	"name" : "rs1",
	"observed" : "A/T",
	"position" : {
		"chrom" : "chr3",
		"position" : 10000
	}
}
> snp1
{
	"name" : "rs1",
	"observed" : "A/T",
	"position" : {
		"chrom" : "chr3",
		"position" : 10000
	}

insert it

> db.snps.save(snp1);
> db.snps
umr915.snps
> db.snps.find();
{ "_id" : ObjectId("4c7bc01ae1819a9523024f8e"), "name" : "rs1", "observed" : "A/T", "position" : { "chrom" : "chr3", "position" : 10000 } }
}