Thursday, November 15, 2007

What is embedded database


from dbazine.com

Embedded Database Primer

by James F. Koopmann

Introduction

If you’re anything like me, staying on top of current trends within the field of database administration is highly challenging at times. We are continually bombarded with new trends and technology that we cannot normally afford to try. For quite awhile, I have wondered what embedded databases were all about. I think of embedded databases as something small and contained in my cellular phone or as maintaining some information within my automobile. But what is the embedded database world really like?

I decided to reduce my learning curve and develop a primer about embedded databases by interviewing a vendor with this expertise. I posed a few high-level questions to Steve Wampler, Director of Database Marketing, Birdstep Technology who has worked successfully with embedded databases for some time:

Q. What exactly defines an embedded database?

We define an embedded database as a software component that is part of the application, not a separate running application. Its operations are invoked by the application. Another way to look at it is that embedded databases are embedded within an application.

Q. Can you explain to the layman how a database is embedded within an application?

It is embedded either as in-line code or linked libraries. In either case, it's code that is executed only when invoked by the application.

Q. How long has the embedded database industry been around?

More than 20 years — one could argue that since the beginning of software, embedded databases have been in existence.

Q. What drives the new features introduced in the embedded industry?

This is vendor-dependent. What you are seeing today is an application view for development — meaning features are being developed to do certain application tasks.

Q. What is the fastest growing business use for embedded databases?

One of the hottest is automotive.

Q. Does the embedded database community compete with the larger RDBMS vendors and in what regards?

In some cases, yes. One needs to look at the database market as a continuum with the embedded on one end and the enterprise on the other. There is a point in the continuum where the embedded databases are competing with the enterprise databases. Typically, this is a case where the plethora of features in enterprise databases is more important than the cost, size, and performance. These last three factors are the key advantage of embedded database over enterprise database.

Q. How do embedded databases differ from the typical relational databases such as Oracle, DB2, and SQL Server?

These databases are big, expensive, and slow. They are general purpose because they must serve a wide range of applications and users. They tend to be separate running applications that are independent of the system application.

Q. What are the top three features or business solutions for embedded databases?

Performance, small size, and price.

Q. Are embedded databases relational?

Yes. There are databases that are hierarchical (network model, XML model) as well.

Q. What is the Network Data Model?

The relational database model establishes and maintains inter-record relationships through common data fields. The Network Database Model establishes inter-record relationships directly, through physical links between the related records, rather than through common data fields.

Q. What applications are better suited for embedded databases?

Application-specific systems that have no or limited human administration or interruption.

Q. What type of applications are not meant for embedded databases?

Large enterprise systems.

Q. Are there any instances where you have seen successful conversions from major RDBMS vendors to an embedded database system?

Usually in business automation systems where the database needs to handle large data, multiple users, but can't be too expensive and must be allowed to be redistributed by the developer.

Q. What are the administration duties for maintaining an embedded database environment?

These are minimal because the application is usually the administrator.

Q. What are the tuning opportunities of an embedded database? Is there much a DBA can do for such a small footprint?

It depends on the functionality of the database. In our case, tuning can come through cache management (performance), using SQL or Native API (performance), user-defined procedures and functions.

Q. How exactly do embedded databases speed time to delivery of applications and cut development costs?

Every software application manages data. In most cases, the data is managed in a flat file — and this is fine for these applications as long as they have a short life cycle and their data is stagnant. If the application is going to have a long life cycle and/or going to grow in its use, having a database management system is 100 times cheaper to buy than to build and in many years quicker to develop.

Q. How robust is the availability, reliability, and recoverability of embedded databases?

Very robust — because of their applications, this is a must.

Q. When I hear high performance for embedded databases I immediately think they surely cannot keep up with the “big boys” in relational databases. What can we expect as far as performance from an embedded database?

This is highly dependent on if the application is mostly reading, writing, updating, etc. Typically you can find order-of-magnitude better performance in embedded database.

Q. Are there any typical limits to the size of an embedded database such as data size, footprint, or instruction set?

No.

Conclusion

Embedded databases differ from typical databases such as DB2, Oracle, and SQL Server in that it is completely integrated into the application or hardware device in such a way that the end-user has very little knowledge, if any, of its existence. Users and administrators are not burdened with time-consuming installations or maintenance as the database is literally packaged with the application and should be self maintaining.

Embedded databases are meant to run on many different platforms with various programming interfaces. The nature of embedding databases’ instruction sets being linked specifically within and for a specific application gives them a small footprint. A reduced instruction set allows them to achieve performance that is hard to beat. Surely, you wouldn’t want to put an Oracle instance within your cellular phone, but I might in my automobile.

--

James F. Koopmann is dedicated to providing technical advantage and guidance to companies within information technology. Over the years, James has worked with a variety of database-centric software and tools vendors as strategist, architect, DBA, and performance expert. He is an accomplished author appearing regularly within printed publications across the Web, and speaking at local area User Groups as well as industry conferences. He may be reached at jkoopmann@pinehorse.com or www.pinehorse.com.

Thursday, November 08, 2007

Interesting People

I wish I could meet these fabulous people one day :)

http://en.wikipedia.org/wiki/Eliot_Spitzer
http://en.wikipedia.org/wiki/Shirley_Ann_Jackson
http://en.wikipedia.org/wiki/Padmasree_Warrior

Thursday, November 01, 2007

Good Investment Books

1. Intelligent Investor (Benjamin Graham)
http://www.amazon.com/Intelligent-Investor-Book-Practical-Counsel/dp/B0002X1JKU/ref=pd_bbs_sr_1/104-2886434-5656728?ie=UTF8&s=books&qid=1193986477&sr=8-1

Thursday, June 21, 2007

Prompt for linux

Hit upon the basics of linux shell, (will add more)

1. export PS1="[${LOGNAME}@$(hostname)] # "

Wednesday, May 16, 2007

Diff between only specified lines in unix

diff < (sed ' line1,line2!d' file1) < (sed 'line1,line2 !d' file2)

Monday, May 14, 2007

Converting Numbers to Strings and Strings to Numbers in C++

http://www.parashift.com/c++-faq-lite/misc-technical-issues.html

Saturday, March 24, 2007

Managing C++ Objects

http://billharlan.com/pub/papers/Managing_Cpp_Objects.html

Managing C++ Objects

Here are some guidelines I have found useful for writing C++ classes. There are many good books on the subject, but they have not been sufficient to keep me out of trouble. The first time I returned to writing C++ after a year of writing Java, I was appalled at how much my design was constrained by managing the lifetime of objects. When C++ classes share objects, then they must negotiate who owns the object. Garbage collection is not available, and smart pointers often fall short.
§ Simple constructors

If your preferred constructor takes arguments, then define a default constructor (no arguments) and make it protected. Derived classes will require this method.

Define protected initialization methods void init(...) with arguments, and call them from your preferred constructors. Each initialization method should set all member variables to a valid state, without relying on constructor initialization blocks. Use these initialization methods from your public copy constructor and assignment operator, if required.

Remove everything from constructor initialization blocks except the simplest constructor of a superclass (preferably a default constructor). Call protected superclass initialization methods from the subclass initialization methods. Make initialization methods non-virtual to avoid hiding by derived classes (since the name will always be init(...).)

All init(...) methods should first call the init() equivalent of a default constructor, to initialize all member pointers, perhaps to nulls. If your constructor fails and throws an exception, then the destructor can be called safely.

Your constructors will now be much more flexible and robust. Derived class constructors can manipulate their arguments before initializing the superclass. (Superclass constructors can only be called in initialization blocks.) Within a single class, you can share more initialization between alternative constructors. You need not worry about the order of initialization blocks.
§ Implement "The Big Three"

Always define a copy constructor and an assignment operator. Don't let anyone use the default implementations. If your class contains pointers to objects which your class does not plan to delete, then just make these two methods private, without an implementation. Do not implement versions that make shallow copies. You do not want a user to accidentally make copies on the stack if required to call a non-copy constructor or clone method instead. Making copies of objects should be a very deliberate step Conversion operators (single-argument constructors) can be dangerous for the same reason.

Define a virtual destructor unless you never want anyone to derive from your class. Define a protected non-virtual void dispose() method that deletes the object's resources, then call this method from your destructor. (This is the destructor equivalent of an init() method.) You can use this method in assignment operators, initialization, and derived classes.
§ No references as members

A class member should never be a reference, whether const or non-const. A member's object reference can only be set in the initialization block of a constructor. You will not be able to set a reference member in an initialization method. A reference permanently prevents your class from replacing the object dynamically.
§ Optional ownership

If a constructor or initialization method takes a non-const object as an argument, then you must decide whether this wrapper class will assume ownership of this object. The destructor of a Bridge or Decorator class might need to delete the contained object. Or maybe not. If you have any doubt, then the constructor should allow the user to choose.
§ No pointers as arguments

Pass all objects to class methods and constructors as references. There is absolutely no advantage to passing objects as pointers. This rule is equally valid whether the objects are const or not.

I've already recommended that all class members be saved as pointers. You can easily take the address of an argument reference (with an ampersand) and assign it to your member pointer. Some C++ programmers do not seem to realize that the address of a reference is the same as the address of the original object. So they pass pointers when they want to save the argument, and references when they do not. This is a poor form of documentation, based on a misunderstanding.

If an object is passed to a constructor or initialization method, the user can expect the class to hang onto it. If a method saves an object from an argument, choose an appropriate name, like setColor(Color&) or addInterpolator(Interpolator&).

The worst excuse for using a pointer as an argument is that you want to give it a default value of null (0). You still have to document what a null object is supposed to mean. Worse, the user may overlook that the argument exists or is optional. Declare a separate method that lacks the extra argument. The effort is negligible.
§ Returning objects

One can always return objects from class methods by reference, either const or non-const. A user can take the address of the reference, if necessary, to save the object. But there are no drawbacks to returning objects always as pointers. Consistency is preferable, and most API's return pointers.

If you return an object allocated on the heap (with a new), then be clear who has ownership of the object--your class, the recipient, or a third party.

Think about whether you are breaking encapsulation of member data in a way that will prevent modification later.

Never return a reference to a class member allocated on the stack in the header file. If your class replaces the value, then the user may be left with an invalid reference, even though your object still exists. (Other reasons: Your class will never be able to remove the object as a member. A user may manipulate the logic of your class in unexpected ways.)

A method should modify an object constructed by the user by accepting it as a non-const reference. Returning the same object would be redundant and confusing.
§ Clean header files

A header file ideally includes only the header file of super-classes or of standard C++ libraries. All other classes can be forward declared, like class ClassName; or template class ClassName;. Forward declarations will greatly simplify your "make" dependencies and speed your builds. Repairs will be easier.

Member variables that are saved by value require your header to include another header file. Consider allocating such members on the heap, even if you must delete them in the destructor. Save member objects by value only when the default constructor creates a lightweight object with a useful state.

If you have reasons to put your entire implementation in the header file, then of course you cannot take advantage of forward declarations.
§ Write more Java

When you get a chance, write more Java to free your mind of such distractions. Your C++ will improve.
§ Examples

See an illustration of some of these patterns in [ ../code/cpp_prototype ] .

Bill Harlan

1998

Revision: 1.21 2004/09/14 18:01:26 harlan Exp $

Return to parent directory.

Thursday, January 11, 2007

Process start time in Unix

To find the start time of a process in unix use

ps -fu

zgrep "tosearch" *.gx | tr ',' '\12' | grep "tosearch"

Wednesday, January 10, 2007

Thread Safe and Thread Aware

From codeproject.com(http://www.codeproject.com/csharp/syncroot.asp)

Thread aware:

At any given time, at most one thread can be active on the object. The object is aware of the threads around it and protects itself from the threads by putting all the threads in a queue. Since there can be only a single thread active on the object at any given time, the object will always preserve its state. There will not be any synchronization problems.
Thread safe:

At a given time, multiple threads can be active on the object. The object knows how to deal with them. It has properly synchronized access to its shared resources. It can preserve its state data in this multi-threaded environment (i.e. it will not fall into intermediate and/or indeterminate states). It is safe to use this object in a multi-threaded environment.

Using an object that is neither thread-aware nor thread-safe may result in getting incorrect and random data and mysterious exceptions (due to trying to access the object when it is being used by a thread and is in an unstable, in-between state at the instant of access of the second thread).

Tuesday, January 09, 2007

Efficient VIM editing

http://jmcpherson.org/editing.html

Monday, December 04, 2006

Good Hash Discussion

http://burtleburtle.net/bob/hash/doobs.html

Friday, December 01, 2006

Timers in C#

From msdn2.microsoft.com
private void CreateTimer()
{
System.Timers.Timer Timer1 = new System.Timers.Timer();
Timer1.Enabled = true;
Timer1.Interval = 5000;
Timer1.Elapsed +=
new System.Timers.ElapsedEventHandler(Timer1_Elapsed);
}

private void Timer1_Elapsed(object sender,
System.Timers.ElapsedEventArgs e)
{
System.Windows.Forms.MessageBox.Show("Elapsed!",
"Timer Event Raised!");
}

Tuesday, November 28, 2006

Berkeley DB

From : http://pybsddb.sourceforge.net/ref/intro/terrain.html
1. Berkeley DB is an embedded database that supports fairly simple data access with a rich set of data management services

Data access in this context means
a) insert b)update c)search d)delete
Data management in this context means that
a)Concurrency b)Transactions c)Recovery

Thursday, November 02, 2006

Unix Ports

From Google groups

netstat -lp

It will tell you which task is listening on the port.

fuser -v -n tcp 32768

Will tell you which task is listening on the specified port and under
which account it's running.

Monday, October 30, 2006

IE6 duh?

urns out, IE doesn't like the script tags if they are using element minimization. I got the page rendering just as I intended by changing the tag to look like this:



Doing some research, I came across this post in theList by Eric Vitiello which clarifies this more. Apparently the DTD declaration for the script tag says , and the XHTML specs says (under Appendix C. 3):

Given an empty instance of an element whose content model is not EMPTY (for example, an empty title or paragraph) do not use the minimized form (e.g. use

and not

).

So, I guess this isn't really a bug in IE. I'd think instead, that this is a bug in the DTD itself. The script tag doesn't have to contain #PCDATA (in fact, I consider it graceful if it doesn't), and forcing it is, well, stupid.

For now, I am explicitly closing the script tag with a seperate closing tag, and everything seems to be working well. Does anyone have any idea about handling this better, preferably with minimized element closures

stolen from piecesofrakesh.blogspot.com

Monday, October 23, 2006

When do you need a pointer to a reference?

From C++ groups
> Why/when would someone need a pointer to a reference?

Never. A reference is another name for a real thing. A pointer can only
point to a real thing - it can't point to a name for a real thing.

References are often implemented as secret pointers, but it breaks the
language if you try to get a handle on this secret pointer - it is an
implementation detail.

If you meant a reference to a pointer, use this when you need something to
grab your pointer, point it to something else, and give the result back to
you. Consider a parser that reads statements written by the user:

WORD_TYPE getWord (char *&statement);

Each time you call this function it finds a word, returns its type, and
points the pointer off the end of the word.

Friday, October 20, 2006

VIM split

Vim viewport keybinding quick reference

:sp will split the Vim window horizontally. Can be written out entirely as :split .

:vsp will split the Vim window vertically. Can be written out as :vsplit .

Ctrl-w Ctrl-w moves between Vim viewports.

Ctrl-w j moves one viewport down.

Ctrl-w k moves one viewport up.

Ctrl-w h moves one viewport to the left.

Ctrl-w l moves one viewport to the right.

Ctrl-w = tells Vim to resize viewports to be of equal size.

Ctrl-w - reduce active viewport by one line.

Ctrl-w + increase active viewport by one line.

Ctrl-w q will close the active window.

Ctrl-w r will rotate windows to the right.

Ctrl-w R will rotate windows to the left.

From Linux.com

Thursday, October 19, 2006

Javascript :quirkmodes.org

http://www.quirkmodes.org

Monday, September 25, 2006

CRON

minute hour dom month dow user cmd

minute This controls what minute of the hour the command will run on,
and is between '0' and '59'
hour This controls what hour the command will run on, and is specified in
the 24 hour clock, values must be between 0 and 23 (0 is midnight)
dom This is the Day of Month, that you want the command run on, e.g. to
run a command on the 19th of each month, the dom would be 19.
month This is the month a specified command will run on, it may be specified
numerically (0-12), or as the name of the month (e.g. May)
dow This is the Day of Week that you want a command to be run on, it can
also be numeric (0-7) or as the name of the day (e.g. sun).
user This is the user who runs the command.
cmd This is the command that you want run. This field may contain
multiple words or spaces.

Thursday, September 21, 2006

AJAX the Diagram

http://www.adaptivepath.com/images/publications/essays/ajax-fig1.png