Jump to content

  • Log In with Google      Sign In   
  • Create Account

Free Small Stand-Alone DataBase?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
22 replies to this topic

#1 Extrarius   Members   -  Reputation: 1412

Like
0Likes
Like

Posted 12 April 2006 - 12:27 AM

For a project I'm working on, I'll need a free, small, stand-alone database that can be used for commercial applications. It's not that I'm selling a program, but the program will possibly be making money so I need something I can use for that without having to pay fees or open-source the project's code. I won't be distributing executables at all, so I *think* the GPL would be OK since (my understanding) is that it only requires that those that are given binaries are also given source. It won't need to support a large number of records, complex relations of any kind, high-volume traffic, or anything like that, but it does need to be reliable and it really needs to support searching by string indexes. Essentially, it will be used to store pairs consisting of a "UserName" (a string) and "Credit"(fixed-point number, though storing it as double precision should be fine). Queries won't be done often at all, maybe once a minute, but it support a decent number of queries just in case. Also, it should support some kind of "lock" operation to ensure that while one application instance is updating a record, no other application instances obtain the original or intermediate values. In general, a lock will last for up to 10 minutes, so it really needs to be a per-record thing. I'd also like to store what amounts to a log of credit going up and down based on various actions, so anything that would help with that would be great too. It's kind of like a virtual store, so this part would be multi-table, with one table storing a userID, transation ID, a timestamp, total amount of credit gained or lost, etc, and another table assocating transaction ID with item # and quantity sold/bought at what price. This will be insert-only, though, so it should be rather simple and should make use of very few (if any) locks, though it can probably be quite slow since the rate of insertion should be at maximum a few items a minute on average. So far, the only stand-alone database I've found at all is SQLite, which fails to meet my needs in many ways, but if it's all there is, I might have to end up hacking what I need out of it. Since I don't really need the full power of SQL, I'm thinking of rolling my own, but put simply I hate to do that because even the basic things I want can be difficult to get right, and I don't want to risk really screwing things up. If there are any good, inexpensive solutions, I might be willing to go with one of those, but I'll hold off at least until the application has passed basic testing before purchasing anything. If you know of any such databases that are small and stand-alone and either free or inexpensive, I'd appreciate pointers to them, comments on how they worked for you and how you used them, and any other feedback you can provide.

Sponsor:

#2 Emmanuel Deloget   Members   -  Reputation: 1381

Like
0Likes
Like

Posted 12 April 2006 - 12:48 AM

What about Berkeley DB ?

#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 12 April 2006 - 12:49 AM

Quote:
Original post by Emmanuel Deloget
What about Berkeley DB ?


Isn't that payware for non-opensource projects?

#4 Emmanuel Deloget   Members   -  Reputation: 1381

Like
0Likes
Like

Posted 12 April 2006 - 01:05 AM

Quote:
Original post by Anonymous Poster
Quote:
Original post by Emmanuel Deloget
What about Berkeley DB ?


Isn't that payware for non-opensource projects?


From their licensing informations

Quote:
The Sleepycat open source license permits you to use Berkeley DB, Berkeley DB Java Edition or Berkeley DB XML at no charge under the condition that if you use the software in an application you redistribute, the complete source code for your application must be available and freely redistributable under reasonable conditions. If you do not want to release the source code for your application, you may purchase a license from Sleepycat Software.


Regards,

#5 paic   Members   -  Reputation: 645

Like
0Likes
Like

Posted 12 April 2006 - 01:24 AM

I didn't read the post, so sorry if the following link doesn't fit your needs exactly. But judging from the subject, it might interest you ^^

http://www.sqlite.org/

#6 acid2   Members   -  Reputation: 451

Like
0Likes
Like

Posted 12 April 2006 - 01:36 AM

Paic beat me too it, but I also recommend SQLite. It's really fast, tried and tested in commercial apps (OSX uses it) and it's API isn't bad. You said it doesn't meet your needs, but how is that?
Ollie
"It is better to ask some of the questions than to know all the answers." ~ James Thurber[ mdxinfo | An iridescent tentacle | Game design patterns ]

#7 hplus0603   Moderators   -  Reputation: 5280

Like
0Likes
Like

Posted 12 April 2006 - 01:39 AM

I third the recommendation for SQLite.


#8 Extrarius   Members   -  Reputation: 1412

Like
0Likes
Like

Posted 12 April 2006 - 01:43 AM

Quote:
Original post by acid2
Paic beat me too it, but I also recommend SQLite. It's really fast, tried and tested in commercial apps (OSX uses it) and it's API isn't bad. You said it doesn't meet your needs, but how is that?
First and foremost is that it only supports database-wide locking, so I can't have one application hold a lock on a record while another one processes something else using the same database. I could do something like have an extra field in the database "InUse" or somesuch, but I'd much prefer to simply get back some kind of "ERROR_LOCKED" so I don't have to add an extra field in each table I want to have per-record locks.

#9 Charon   Members   -  Reputation: 435

Like
0Likes
Like

Posted 12 April 2006 - 02:05 AM

Oracle Database 10g Express Edition
this was the first thing to cross my mind after just reading the thread title...
(well, 4GB of user data IS small for a business database ^^)


since SQLite is not an option for you what speaks agains MySQL or PostgreSQL?
(LAMP and/or WAMP are really easy to setup....)

chaos, panic and disorder - my work here is finished


#10 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 12 April 2006 - 02:06 AM

i think you desire for an automagically locking mechanism it not going really what you want (even though you think it is). now i am not a dba nor a db programming guru, but ...

reading a record from a db is not like opening a file in read mode, because it returns a copy of the record not a "pointer to the record" (forgive my c-style bias). As such you check out the copy (retrieve), modify it, and check it back in (update). I am unaware of a database that is going to give you read/write access to the record, which would imply the need for native support of writer/reader locking on a per-record basis.

Beyond that, I think your idea of creating an extra field that indicates a 'checked out/in status' is the smarter solution. this way you can manage who has the lock. In addition the field would let the check-out persist over multiple sessions and can be used to apply further security measures should this project need to expand later on.

but then again ... who am i?

#11 Emmanuel Deloget   Members   -  Reputation: 1381

Like
0Likes
Like

Posted 12 April 2006 - 02:29 AM

BTW, why do you need a 10 minutes long lock? I smells some kind of strange strangeness here... [smile]

#12 Extrarius   Members   -  Reputation: 1412

Like
0Likes
Like

Posted 12 April 2006 - 02:55 AM

Quote:
Original post by Emmanuel Deloget
BTW, why do you need a 10 minutes long lock? I smells some kind of strange strangeness here... [smile]
To put it simply, this is for a trading agent in a game, where players can go to it and trade stuff, and credit is given when they trade an item for something worth less. The lock is needed to ensure that a player doesn't gain credit then trade with two such agents simultaneously to 'spend' the credit twice. The problem with the 'in trade' flag is that it requires a 'query and update' (CAS, basically) command to be thread-safe (as it needs to be) that AFAIK doesn't exist in SQL.
It is highly unlikely that a person could trade twice before the database is updated (virtually impossible due to server-induced latency), but money is money =-)
A 10-minute lock is the best solution IMO since it'd be handled almost entirely by the DB and I wouldn't have to worry about screwing up the threading aspect (not much experience w/ multithreading much less inter-process interaction). I know better databases support such a thing, but I'm not spending thousands for a full Oracle license and the supercomputer required to run it =-)

#13 BeanDog   Members   -  Reputation: 1063

Like
0Likes
Like

Posted 12 April 2006 - 02:58 AM

[edit] In light of the above post, which was made while I was typing, I think my advice falls flat.

I'm going to "fourth" the recommendation for SQLite. I'm using it in an application right now which has two to three threads accessing the database at a time. The database-wide locking is indeed a bit of a pain, but it really hasn't become a problem. I simply do all the processing of data that I need to outside of a lock, then begin a transaction and quickly shove in all the data I need to. SQLite is fast enough that I can enter ten or fifteen thousand rows into a 6-field table with 3 text-based indices in a fraction of a second, then commit the transaction and let others use the database.

All my threads can simultaneously read data from the database, and they all just have to take a little break when it's INSERT or UPDATE time. As long as you're taking care to do all your SELECT's and business logic before beginning a transaction, then only do database modifications inside a transaction, SQLite will fit the bill.

But then, it sounds like you've already tried it and sacked it. So good luck rolling your own--if it's better than SQLite, I want a copy :-)

~BenDilts( void );

Lucidchart: Online Flow Chart Software; Lucidpress: Digital Publishing Software


#14 yapposai   Members   -  Reputation: 410

Like
0Likes
Like

Posted 12 April 2006 - 03:02 AM

How about using 2 sqlite dbs? Use 1 as a scratch/temporary DB where the locking program can do its work, while other threads read the other DB. When the processing is finished, copy the data from the scratch DB to the actual DB.

#15 Extrarius   Members   -  Reputation: 1412

Like
0Likes
Like

Posted 12 April 2006 - 03:03 AM

Just thought I'd throw in that by "Stand-Alone" I don't mean it has to be source I can compile into the application, but rather that it shouldn't require massive server resources like Oracle and it'd be GREATLY preferrable if it was simply a dll or small program - the main issue is resource usage and freedom from complex installation. If it's light-weight and can be run immediately after extracting it from whatever archive format (and has any settings in a local config file of some sort such as ini), it'll do just fine.

#16 Extrarius   Members   -  Reputation: 1412

Like
0Likes
Like

Posted 12 April 2006 - 03:14 AM

Quote:
Original post by Charon
Oracle Database 10g Express Edition
this was the first thing to cross my mind after just reading the thread title...
(well, 4GB of user data IS small for a business database ^^)[...]
Thanks, but the 165MB installer leads me to believe it's quite a bit more 'heavy-weight' than I'd like.

Quote:
[...]since SQLite is not an option for you what speaks agains MySQL or PostgreSQL?
(LAMP and/or WAMP are really easy to setup....)
For some reason, I thought MySQL was released under a license other than GPL. It looks like it's a possibility. PostgreSQL looks like a good possibility as well, and the BSD license is far more appealing. I'll have to investigate them both. Thanks for making me actually look into the MySQL license and suggesting a great probably alternative =-)

#17 Charon   Members   -  Reputation: 435

Like
0Likes
Like

Posted 12 April 2006 - 03:17 AM

@AP : atleast with "Oracle Forms" you get the possibility to block records.

@Extrarius : an Oracle Database might be too much four your project, but i just have to defend it ^^

The Oracle Database 10g Express Edition can be used witouth paying for a licence even for commercial products. Apart from that its not that of a resource hog...
(i am using an Oracle 9 Database on an old Pentium 300 with 128MB RAM and a few Gigs Tablespace for developement purposes and it works "ok")

chaos, panic and disorder - my work here is finished


#18 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 12 April 2006 - 03:20 AM

Quote:
Original post by Extrarius
Just thought I'd throw in that by "Stand-Alone" I don't mean it has to be source I can compile into the application, but rather that it shouldn't require massive server resources like Oracle and it'd be GREATLY preferrable if it was simply a dll or small program - the main issue is resource usage and freedom from complex installation. If it's light-weight and can be run immediately after extracting it from whatever archive format (and has any settings in a local config file of some sort such as ini), it'll do just fine.


Wouldn't Firebird [1] --- the former Interbase --- suit your requirements? I remember it offering "DB in a file" possibilities, and it is a full-featured RDBMS. It might be overkill for your needs though.

Personally I'd roll my own for something that simple, or I'd use (G)DBM, because storing (key, value) pairs is really what it's meant for. I don't know if (G)DBM is available on non-UNIX systems though, and GDBM is probably GPL.


Hope this helps.

[1] http://www.firebirdsql.org


#19 Antheus   Members   -  Reputation: 2397

Like
0Likes
Like

Posted 12 April 2006 - 03:36 AM

Quote:

Essentially, it will be used to store pairs consisting of a "UserName" (a string) and "Credit"(fixed-point number, though storing it as double precision should be fine)


Unless you skiped a few details, you will not want to use any kind of database for that.

You will write a text file, with two columns. Name might be escaped, or delimited, and the value would be just a text representation of the number (leaving you the flexibility of changing formats).

When application starts, you will read the files, and put everything in a hash table. If you need remote access, add a simple socket protocol, with "get NAME" and "set NAME VALUE" options. And that, is your application.

Anything more for this purpose is a HUGE overkill. Unless of course, you will be having hundreds of tables and millions of records somewhere in the future, but for start, KISS.

#20 Promit   Moderators   -  Reputation: 7167

Like
0Likes
Like

Posted 12 April 2006 - 04:04 AM

Quote:
Original post by Extrarius
To put it simply, this is for a trading agent in a game, where players can go to it and trade stuff, and credit is given when they trade an item for something worth less. The lock is needed to ensure that a player doesn't gain credit then trade with two such agents simultaneously to 'spend' the credit twice.
Banks have to address precisely the same issue in their databases. Simple transactions are all that are necessary. Make sure that the trade and the credit alteration all together form a single transction (SQL BEGIN TRANSACTION and COMMIT) and you're good to go.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS