Search Results

Search found 47 results on 2 pages for 'db4o'.

Page 1/2 | 1 2  | Next Page >

  • First toe in the water with Object Databases : DB4O

    - by REA_ANDREW
    I have been wanting to have a play with Object Databases for a while now, and today I have done just that.  One of the obvious choices I had to make was which one to use.  My criteria for choosing one today was simple, I wanted one which I could literally wack in and start using, which means I wanted one which either had a .NET API or was designed/ported to .NET.  My decision was between two being: db4o MongoDb I went for db4o for the single reason that it looked like I could get it running and integrated the quickest.  I am making a Blogging application and front end as a project with which I can test and learn with these object databases.  Another requirement which I thought I would mention is that I also want to be able to use the said database in a shared hosting environment where I cannot install, run and maintain a server instance of said object database.  I can do exactly this with db4o. I have not tried to do this with MongoDb at time of writing.  There are quite a few in the industry now and you read an interesting post about different ones and how they are used with some of the heavy weights in the industry here : http://blog.marcua.net/post/442594842/notes-from-nosql-live-boston-2010 In the example which I am building I am using StructureMap as my IOC.  To inject the object for db4o I went with a Singleton instance scope as I am using a single file and I need this to be available to any thread on in the process as opposed to using the server implementation where I could open and close client connections with the server handling each one respectively.  Again I want to point out that I have chosen to stick with the non server implementation of db4o as I wanted to use this in a shared hosting environment where I cannot have such servers installed and run.     public static class Bootstrapper    {        public static void ConfigureStructureMap()        {            ObjectFactory.Initialize(x => x.AddRegistry(new MyApplicationRegistry()));        }    }    public class MyApplicationRegistry : Registry    {        public const string DB4O_FILENAME = "blog123";        public string DbPath        {            get            {                return Path.Combine(Path.GetDirectoryName(Assembly.GetAssembly(typeof(IBlogRepository)).Location), DB4O_FILENAME);            }        }        public MyApplicationRegistry()        {            For<IObjectContainer>().Singleton().Use(                () => Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), DbPath));            Scan(assemblyScanner =>            {                assemblyScanner.TheCallingAssembly();                assemblyScanner.WithDefaultConventions();            });        }    } So my code above is the structure map plumbing which I use for the application.  I am doing this simply as a quick scratch pad to play around with different things so I am simply segregating logical layers with folder structure as opposed to different assemblies.  It will be easy if I want to do this with any segment but for the purposes of example I have literally just wacked everything in the one assembly.  You can see an example file structure I have on the right.  I am planning on testing out a few implementations of the object databases out there so I can program to an interface of IBlogRepository One of the things which I was unsure about was how it performed under a multi threaded environment which it will undoubtedly be used 9 times out of 10, and for the reason that I am using the db context as a singleton, I assumed that the library was of course thread safe but I did not know as I have not read any where in the documentation, again this is probably me not reading things correctly.  In short though I threw together a simple test where I simply iterate to a limit each time kicking a common task off with a thread from a thread pool.  This task simply created and added an random Post and added it to the storage. The execution of the threads I put inside the Setup of the Test and then simply ensure the number of posts committed to the database is equal to the number of iterations I made; here is the code I used to do the multi thread jobs: [TestInitialize] public void Setup() { var sw = new System.Diagnostics.Stopwatch(); sw.Start(); var resetEvent = new ManualResetEvent(false); ThreadPool.SetMaxThreads(20, 20); for (var i = 0; i < MAX_ITERATIONS; i++) { ThreadPool.QueueUserWorkItem(delegate(object state) { var eventToReset = (ManualResetEvent)state; var post = new Post { Author = MockUser, Content = "Mock Content", Title = "Title" }; Repository.Put(post); var counter = Interlocked.Decrement(ref _threadCounter); if (counter == 0) eventToReset.Set(); }, resetEvent); } WaitHandle.WaitAll(new[] { resetEvent }); sw.Stop(); Console.WriteLine("{0:00}.{1:00} seconds", sw.Elapsed.Seconds, sw.Elapsed.Milliseconds); }   I was not doing this to test out the speed performance of db4o but while I was doing this I could not help but put in a StopWatch and see out of sheer interest how fast it would take to insert a number of Posts.  I tested it out in this case with 10000 inserts of a small, simple POCO and it resulted in an average of:  899.36 object inserts / second.  Again this is just  simple crude test which came out of my curiosity at how it performed under many threads when using the non server implementation of db4o. The spec summary of the computer I used is as follows: With regards to the actual Repository implementation itself, it really is quite straight forward and I have to say I am very surprised at how easy it was to integrate and get up and running.  One thing I have noticed in the exposure I have had so far is that the Query returns IList<T> as opposed to IQueryable<T> but again I have not looked into this in depth and this could be there already and if not they have provided everything one needs to make there own repository.  An example of a couple of methods from by db4o implementation of the BlogRepository is below: public class BlogRepository : IBlogRepository { private readonly IObjectContainer _db; public BlogRepository(IObjectContainer db) { _db = db; } public void Put(DomainObject obj) { _db.Store(obj); } public void Delete(DomainObject obj) { _db.Delete(obj); } public Post GetByKey(object key) { return _db.Query<Post>(post => post.Key == key).FirstOrDefault(); } … Anyways I hope to get a few more implementations going of the object databases and literally just get familiarized with them and the concept of no sql databases. Cheers for now, Andrew

    Read the article

  • Maven and db4o dependency

    - by Jens Jansson
    I'm intrigued to test new frameworks in the Java world, and decided to create a new project that takes advantage of Maven and db4o. I'm starting to get a hang of Maven, but I have a hard time adding db4o as a dependency to the project. First problem is that db4o doesn't exist in the official Maven repositories. Next up comes the problem that db4o seem to have recently restructured their whole site's URI:s, so I'm getting 'site not found' messages all the time when I try to navigate their site. I found somewhere a potential Maven repository that should be at https://source.db4o.com/maven but I get all the time "Error reading archetype catalog https://source.db4o.com/maven Unable to locate resource in repository" when I try to access it. So, any suggestions on how I'll get db4o up through Maven? I've managing Maven through Eclipse with the M2Eclipse plugin.

    Read the article

  • Recommend a good db4o viewer

    - by mgroves
    I'm playing around with db4o, and I have the Object Manager viewer thingy for Visual Studio. It seems okay, but not exactly on par with tools like HeidiSQL/SQL Studio/etc., not to mention that it locks the db4o file--I can't use my db4o app and Object Manager at the same time. Maybe I'm using it wrong, but regardless, I'd like to know what else is out there. What tools would you recommend for looking at and manipulating db4o files?

    Read the article

  • How to install and use db4o for Android?

    - by Viet
    I have to admit that I'm new to Java and Android. db4o seems to be an excellent DB framework to replace SQLite http://developer.db4o.com/Platforms/Java/Android.aspx. I want to use it for my Android application. I don't know how to: Import/Install/Attach/Upload db4o to Android phone. Where should I put the JAR file db4o-7.12.132.14217-all-java5.jar so that it was uploaded to Android phone and it could be called from the application? Please kindly advise! Many thanks!!!

    Read the article

  • db4o problem with graph of objects

    - by Staszek28
    I am a new to db4o. I have a big problem with persistance of a graph of objects. I am trying to migrate from old persistance component to new, using db4o. Before I peristed all objects its graph looked like below (Take a look at Zrodlo.Metadane.abstrakt string field with focused value) [its view from eclipse debuger] with a code: ObjectContainer db=Db4o.openFile(DB_FILE); try { db.store(encja); db.commit(); } finally{ db.close(); } After that, I tried to read it with a code: ObjectContainer db=Db4o.openFile((DB_FILE)); try{ Query q = db.query(); q.constrain(EncjaDanych.class); ObjectSet<Object> objectSet = q.execute(); logger.debug("objectSet.size" + objectSet.size()); EncjaDanych encja = (EncjaDanych) objectSet.get(0); logger.debug("ENCJA" + encja.toString()); return encja; }finally{ db.close(); } and I got it (picture below) - string field "abstrakt" is null now !!! I take a look at it using ObjectManager (picture below) and abstrakt field has not-null value there!!! The same value, that on the 1st picture. Please help me :) It is my second day with db4o. Thanks in advance! I am attaching some code with structure of persisted class: public class EncjaDanych{ Map mapaIdRepo = new HashMap(); public Map mapaNazwaRepo = new HashMap(); }

    Read the article

  • Using db4o with multiple application instances under medium trust

    - by Anders Fjeldstad
    I recently stumbled over the object database engine db4o which I think looks really interesting. I would like to use it in an ASP.NET MVC application that will be deployed to a shared hosting environment under medium trust. Because of the trust level, I'm restricted to using db4o in embedded/in-process mode. That in itself should be no problem, but the hosting provider also transparently runs each web application in multiple (load-balanced) server instances with shared storage, which I would say is normally a very nice feature for a $10/month hoster. However, since an instance of a db4o server with write access (whether in-process or networked) locks the underlying database file, having multiple instances of the application using the same file won't work (or at least I can't see how it would). So the question is: is it possible to use db4o in this specific environment? I have considered letting each application have its own database which is synchronized with a master database using replication (dRS), but that approach will most likely end up with very frequent bi-directional replication (read master changes at beginning of each request, write to master after each change) which I don't think will be very efficient. Summary of the web application/environment characteristics: Read-intensive (but not entirely read-only) Some delay (a few seconds) is acceptible between the time that a change is made and the time when the change shows up in all the application instances' data Must run in medium trust No guarantee that the load-balancer uses "sticky sessions" All suggestions are much appreciated!

    Read the article

  • Managing Unique IDs in stateless (web) DB4O applications

    - by Phil.Wheeler
    I'm playing around with building a new web application using DB4O - piles of fun and some really interesting stuff learned. The one thing I'm struggling with is DB4O's current lack of support for stateless applications (i.e. web apps, mostly) and the need for automatically-generated IDs. There are a number of creative and interesting approaches that I've been able to find that hook into DB4O's events, use GUIDs rather than numeric IDs or for whatever reason avoid using any system of ID at all. While each approach has its merits, I'm wondering if the less-elegant approach might equally be the best fit. Consider the following pseudo-code: If ID == 0 or null Set ID = (typeof(myObject)).Count myObject.Save It seems like such a blindingly simple approach, it's usually about here that I start thinking, "I've missed something really obvious". Have I?

    Read the article

  • Real World Experience of db4o and/or Eloquera Database

    - by user341127
    I am evaluating two object databases, db4o (http://www.db4o.com) and Eloquera Database (http://eloquera.com) for a coming project. I have to choose one. My basic requirement is scalability, multi user support and easy type evolution for RAD. Please share your real world experience. If you have both, can you compare these two? Which do you prefer?

    Read the article

  • Db4o Mvc Application Architecture

    - by Mac
    I am currently testing out Db4o for an asp.net MVC 2 application idea but there are a few things I'm not quite sure on the best way to proceed. I want my application to use guessable routes rather than Id's for referencing my entities but I also think I need Id's of some sort for update scenarios. so for example I want /country/usa instead of /country/1 I may want to change the key name though (not perhaps on a country but on other entities) so am thinking I need an Id to use as the reference to retrieve the object prior to updating it's fields. From other comments it seems like the UUID is a bit long to be using and would prefer to use my own id's anyway for clean separation of concerns. Looking at both the KandaAlpha project I wasn't too keen on some aspects of the design and prefer something more along the lines of S#arp architecture where they use things like the [domainsignature] and EntityWithTypedId, IEntityDuplicateChecker, IHasAssignedId, BaseObject and IValidatable in their entities to control insert/update behaviour which seems cleaner and more extensible, covers validation and is encapsulated well within the core and base repository classes. So would a port of S#arp architecture to Db4o make sense of am I still thinking rmdbs in an oodb world? Also is there a best practice for managing indexes (including Unique ones as above) in Db4o? Should they be model metadata based and loaded using DI in a bootstrapper for example or should they be more loaded more like Automapper.CreateMap? Its a bit of a rambling question I know but any thoughts, ideas or suggested reading material is greatly appreciated. Thanks Mac

    Read the article

  • DB4o Linq query - How to check for null strings

    - by Dave
    Hey there - simple query: var q = (from SomeObject o in container where o.SomeInt > 8 && o.SomeString != null //Null Ref here select o; I always get a null reference exception. If I use String.IsNullOrEmpty(o.SomeString) the query takes about 100 times as long, as if I use && o.SomeString != "" (which is way faster, but obviously not correct). I'm guessing because DB4o needs to activate the objects, in order to pass them in to the IsNullOrEmpty call, and can't use the indexes. My question is, what's a better way to check for nulls in this situation? Is there something like: mystring != Db4o.DBNull.Value, or something? Cheers, Dave

    Read the article

  • Handling ID's with db4o and ASP.NET MVC2

    - by Craig McGuff
    So, i'm looking at the TekPub sample for ASP.NET MVC2 (http://mvcstarter.codeplex.com/) using DB4o and there are a bunch of templates to create controllers etc, the generated code looks like: public ActionResult Details(int id) { var item = _session.Single<Account>(x=>x.ID == id); return View(item); } Now, my understanding is that using DB4o or a simliar object database that ID's are not required, so how/what exactly do I pass to enable this kind of templated code to function? UPDATE: Both answers were useful, I have modifed the templates to use GUID as the ID. I will add any relevant code/notes here once I see how it works out.

    Read the article

  • db4o Replication System: NullReferenceException?

    - by virtualmic
    Hi, I am trying to do standard bi-directional replication as follows. However, I get a NullReferenceException. This is a separate replication project. I did import the classes involved in the original project (such as Item, Category etc.) in this replication project. What am I doing wrong? (If I debug using VS, I can see that changedObjects does have all the changed objects; there seems to be some problem inside Replicate function) IObjectContainer local = Db4oFactory.OpenFile(@"G:\Work\School\MIS\VINMIS\Inventory\bin\Debug\vin.db4o"); IObjectContainer far = Db4oFactory.OpenFile(@"\\crs-lap\c$\vinmis\vin.db4o"); ; IReplicationSession replication = Replication.Begin(local, far); IObjectSet changedObjects = replication.ProviderA().ObjectsChangedSinceLastReplication(); while(changedObjects.HasNext()) replication.Replicate(changedObjects.Next()); // Exception!!! replication.Commit(); changedObjects = replication.ProviderB().ObjectsChangedSinceLastReplication(); while (changedObjects.HasNext()) replication.Replicate(changedObjects.Next()); replication.Commit(); Regards, Saurabh.

    Read the article

  • Any competitors to db4o on compact framework?

    - by MrJeepster
    We've been trying db4o for persisting objects on the compact framework. It works very well from our tests so far. However, it appears they are on the expensive side for small startups with minimal units needed. Does anyone know of any similar object databases for the compact framework? How about a open source one that is free for commercial use? :) Thank you. EDIT: We're really looking for an object database. We don't want to create our own persistence framework at this point and would prefer being able to just save/retrieve the actual object trees.

    Read the article

  • Poor DB4O performance - What am I doing wrong?

    - by Jon
    I read Rob Conery's post about Object databases and thought I'd give it a go. I have a class lets say Book with 15 properties mostly string, some int, one Datetime and 2 decimals. I used Rob's code to open the database file etc to test on a Winforms project not a Web project. So I did the following: for(int i = 0; i < 1000000; i++) { var Book = new Book(); //Assign variables s.Save(Book); } s.CommitChanges(); This took at least a couple of minutes. I then tried to retrieve all data to test speed: var spp = s.All<Passports>(); This one line was quick, however, then doing: sppp.Count() as well as a seperate test doing a foreach loop and incrementing a counter took a couple of minutes. This seems quite slow to me. Am I doing something wrong or am I expecting too much?

    Read the article

  • db4o getting history of container

    - by jacklondon
    var config = Db4oEmbedded.NewConfiguration (); using (var container = Db4oEmbedded.OpenFile (config, FILE)) { var foo = new Foo ("Test"); container.Store (foo); foo.Name = "NewName"; container.Store (foo); } Any way to resolve the history of container for foo in the format below? Foo created with values "Test" Foo Foo's property "Test" changed to "NewName"

    Read the article

  • Is it OK to open a DB4o file for query, insert, update multiple times?

    - by Khnle
    This is the way I am thinking of using DB4o. When I need to query, I would open the file, read and close: using (IObjectContainer db = Db4oFactory.OpenFile(Db4oFactory.NewConfiguration(), YapFileName)) { try { List<Pilot> pilots = db.Query<Pilot>().ToList<Pilot>(); } finally { try { db.Close(); } catch (Exception) { }; } } At some later time, when I need to insert, then using (IObjectContainer db = Db4oFactory.OpenFile(Db4oFactory.NewConfiguration(), YapFileName)) { try { Pilot pilot1 = new Pilot("Michael Schumacher", 100); db.Store(pilot1); } finally { try { db.Close(); } catch (Exception) { }; } } In this way, I thought I will keep the file more tidy by only having it open when needed, and have it closed most of the time. But I keep getting InvalidCastException Unable to cast object of type 'Db4objects.Db4o.Reflect.Generic.GenericObject' to type 'Pilot' What's the correct way to use DB4o?

    Read the article

  • How do you transfer data from SQL Server to db4o?

    - by dde
    I came across this question after searching for a ODBC or JDBC. To my surprise, since I am new to db4o I found there are tools to browse db4o, including a Netbeans and Eclipse plug in. However, when it comes to the question at hand, I only found one company, and the product is not being sold nor demoed (makes me think is not ready yet). So, how do you transfer data? Is there a tool or script I have not found yet?

    Read the article

  • How to use db4o IObjectContainer in a web application ? (Container lifetime ?)

    - by driis
    I am evaluating db4o for persistence for a ASP .NET MVC project. I am wondering how I should use the IObjectContainer in a web context with regards to object lifetime. As I see it, I can do one of the following: Create the IObjectContainer at application startup and keep the same instance for the entire application lifetime. Create one IObjectContainer per request. Start a server, and get a client IObjectContainer for each database interaction. What are the implications of these options, in terms of performance and concurrency ? Since the database is locked when an IObjectContainer is opened, I am pretty sure that option 2) would get me some problems with concurrency - would this also be the case for option 1 ? As I understand it, if I retrieve an object from an IObjectContainer, it must be saved by the same IObjectContainer instance - in order for db4o to identify it as being the same object. Therefore, If I choose option 3), I would have to retrieve the original object, make the necessary changes (copy data from a modified object), and then store it using the same IObjectContainer. Is this true ?

    Read the article

  • UniqueConstraint in EmbeddedConfiguration

    - by LantisGaius
    I just started using db4o on C#, and I'm having trouble setting the UniqueConstraint on the DB.. here's the db4o configuration static IObjectContainer db = Db4oEmbedded.OpenFile(dbase.Configuration(), "data.db4o"); static IEmbeddedConfiguration Configuration() { IEmbeddedConfiguration dbConfig = Db4oEmbedded.NewConfiguration(); // Initialize Replication dbConfig.File.GenerateUUIDs = ConfigScope.Globally; dbConfig.File.GenerateVersionNumbers = ConfigScope.Globally; // Initialize Indexes dbConfig.Common.ObjectClass(typeof(DAObs.Environment)).ObjectField("Key").Indexed(true); dbConfig.Common.Add(new Db4objects.Db4o.Constraints.UniqueFieldValueConstraint(typeof(DAObs.Environment), "Key")); return dbConfig; } and the object to serialize: class Environment { public string Key { get; set; } public string Value { get; set; } } everytime I get to commiting some values, an "Object reference not set to an instance of an object." Exception pops up, with a stack trace pointing to the UniqueFieldValueConstraint. Also, when I comment out the two lines after the "Initialize Indexes" comment, everything runs fine (Except you can save non-unique keys, which is a problem)~ Commit code (In case I'm doing something wrong in this part too:) public static void Create(string key, string value) { try { db.Store(new DAObs.Environment() { Key = key, Value = value }); db.Commit(); } catch (Db4objects.Db4o.Events.EventException ex) { System.Console.WriteLine (DateTime.Now + " :: Environment.Create\n" + ex.InnerException.Message +"\n" + ex.InnerException.StackTrace); db.Rollback(); } } Help please? Thanks in advance~

    Read the article

  • WPF DataGrid issue with db40

    - by Rich Blumer
    I am using the following code to populate a wpf datagrid with items in my db4o OODB: IObjectContainer db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), "C:\Dev\ContractKeeper\Database\ContractKeeper.yap"); var contractTypes = db.Query(typeof(ContractType)); this.dataGrid1.ItemsSource = contractTypes.ToList(); Here is the XAML: <Window x:Class="ContractKeeper.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit" Title="Window1" Height="300" Width="300"> <Grid> <dg:DataGrid AutoGenerateColumns="True" Margin="12,102,12,24" Name="dataGrid1" /> </Grid> </Window> When the items get bound to the datagrid, the gridlines appear like there are records but no data is displayed. Has anyone had this issue with db4o and the wpf datagrid?

    Read the article

  • Setting unique key constraint for Db4oEmbedded EmbeddedConfiguration

    - by Viet
    Hi, I want to set unique key constraint for Db4oEmbedded EmbeddedConfiguration. Here goes my code: EmbeddedConfiguration myConf = Db4oEmbedded.newConfiguration(); myConf.common().objectClass(NotyUser.class).objectField("username").indexed(true); myConf.common().add(new com.db4o.constraints.UniqueFieldValueConstraint(NotyUser.class, "username")); The last line throws exception. I don't know why. I'm running Android SDK 1.5 and db4o 7.12 for Java. Please kindly advise. Thanks!

    Read the article

1 2  | Next Page >