Sign in to follow this  
pghTech

Suggestions on building a database?

Recommended Posts

I am looking for suggestions for creating a database, based on the following Criteria: 1) use C++, not a managed language 2) simple database that will be used for one person to save records that will have a number of fields, one field that can hold paragraphs of text. As a newbie to C++, and database programming, what would be anyone's suggestion for a direction on creating this database? I have already started poking around with MFC's database support to MS Access, but I am not sold on using this method. I have also tried to do some searching on the internet for database programming, which seems to always revert to ADO majority of the time which inturn all literature is regarding .NET which I don't want to use. Any suggestions?

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
google: SQLite

while this is purely ANSI C, there are fully OO wrappers freely available, too.

Share this post


Link to post
Share on other sites
I'm not sure I understand what you are really looking for. Do you want to code a database yourself, or are you looking to use a library that will let you connect to an external SQL DB such as SqlServer or Postgresql?

In the case you are going for the second solution (which I would recommend, as it is a great skill to have in your toolbox), you can either use some ODBC library (I don't know much about that, sorry), or use directly the library provided with the DB you want to use. For example, if you decide to go with Postgres, you should use the libpq (or even better, the libpqxx), that will handle the connection and the query sending / receiving for you.

In case you are going for the first solution (make it yourself), I would suggest the use of XML files (Start with a simple library like TinyXML, for example).

Good luck!

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
depending on how minimalistic your requirements really are, you might also get by simply using only XML and a decent parser framework/frontend.

Share this post


Link to post
Share on other sites
Well to give a better representation of what I am wanting to do, which I apologize for not including in the OP:

I haven't chosen a DB to use (i.e access, or something else, or write myself). To behonest, besides Access, I don't know what all my choices are. You guys did mention XML files which I can look into also.

Basically, I am writing a C++ program, with a dialog interface that will allow the user to use any combination, or all the fields available to search for a record in the chosen database. Any found records will display in a list box, and selecting the record (if multiple records are found) will show the a final field of the record in a edit box which could contain a few words or multiple paragraphs of text.

The second part is the user can use the same fields he used to do a search, to load a new record by filling out the fields with the appropriate data, and choosing the "load" button as opposed to the "search" button.

I am up for writing the database if needed.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
anything SQL based seems pretty viable for that purpose, however if you don't intend to extremely extend your application , you might cope with using XML, too

Share this post


Link to post
Share on other sites
There is a reason 99% of data related applications are written in a language other then C++... C++ is a huge pain when working databases. Its about 10x easier in VB or C# or even Java then it is in C++.

That said, XML is a fair bit easier to work with. Google MSXML lib and you will get a starter. Nice thing there is, you get a parser for free. The sqlLite recommended earlier is a good option aswell.

Your best option though, would be to use a managed interface to the data. I know you said you don't want to, but frankly, going the managed route would make your life a hundred times easier. You can even use Managed C++ or C++/CLI as its called now. Put only the data access code in the managed section if you wish. If you decide to go that route, google System.Data. Even better would be to go fully managed C++ on both the client side and data side, so then you can do data binding with almost zero code.

Share this post


Link to post
Share on other sites
Quote:
There is a reason 99% of data related applications are written in a language other then C++... C++ is a huge pain when working databases. Its about 10x easier in VB or C# or even Java then it is in C++.
I happen to be using C++ with databases and I have to say it's just a matter of having the right libraries. dbExpress for instance is an excellent choice.

As to the original question - if you're developing a small application you'd probably want to embed SQLite inside your application (sounds like the right choice given the description). If it's a larger application you could justify the installation of a real SQL server like, say, Firebird.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this