In native C++, how does one use a SqlCe .sdf database? - c++

Is there a simple way, without .NET?
I've found some libraries but none for SqlCe 3.5. There is http://sqlcehelper.codeplex.com/ but it's far from done, since a major feature like using a password is not yet implemented. I've looked at the source and it uses OLEdb to handle the database.
The official Microsoft Northwind example (that is shipped with SQL Compact 3.1, but not with 3.5) also doesn't work, I've tried setting it up with no success.
Actually I don't have a sample working code. Was anyone able to set it up paired with a passworded .sdf?
What are the alternatives?
Thanks.

Several months ago, I compared certain database implementations for our desktop application. Using SqlCE with native C++ code is awful. If I remember right, some of native examples contains "goto" type jumps, hard to bind data and so on. If you have a choice then use SQLite.

Related

How can I learn array database Rasdaman easily?

I'm working at VietNam - HaNoi National University and I've a research at BigData satellite raster image by array database.
A solution is using Rasdaman database which has been developed many years. I've installed this server successfully, try to make some query with this by using this guide from rasdaman.org. Everything should be ok but I've known that this has a GUI tool name Rview.
I can't search Rview from any where (may be it's too old), I need some GUI tool because I some time don't really know what is error in my query and I need some tool that can show me the result (2D, 3D) with interractive viewer.
Please tell me how can I get a tool that can have GUI as MS SQL Database management tool, Phpmyadmin,...
Rview (recently renamed to rasdaview actually, to avoid clashing with vim) is a GUI client for rasdaman that allows to send queries and has some cool visualization capabilities for 1D to 3D data.
The problem with rasdaview is that it has been last compiled 10+ years ago against wxWidgets 1.6x and the code is so outdated and incompatible with recent wxWidgets that it's not possible to compile it anymore without significant rewriting.
So rasdaman comes with this rview binary, which amazingly still works on most systems today. However, since it's not possible to compile it, it's a bit tricky to get it running. These guidelines should help you.
Are you looking for a website where you can execute your DDL or DML statements?
If yes then try SQL Fiddle.

C++ qt embedded mysql server

I'm using QT 5 with MingW 4.7 and i'm trying to start a program with an embedded mysql server.
My current program uses a mysql server, but the server has to be manually started (so out of the program). This isn't user friendly of-course.
I did some research and I need to use the libmysqld library . But I don't know how.
Can anyone give me an example how to use this?
You can use an embedded mysql server within Qt. There are no that many difficulties with that at all. If you could point any you faced I can help you with that, indeed you should link your application with libmysqld and then just start a mysql process within your application (there are plenty documentation available about that). But as was pointed in comments - are you sure you want to do that. There are many nicer embedded solutions available like SQLLite (included in Qt)...
Documentation and examples
You probably will need to have a look on mysql driver supplied with Qt and may be fork it for embedded version, but that needs a bit closer look. But again I don't see really issues with that

Using Databases in C++ and Visual Studio 6

I already did some searching on stackoverflow and as far as I can see there are many ways to use databases in C++. Unfortunately at work my tools are pretty limited. I only get to use visual studio C++ 6 and don't even have boost (although I have learned to cope with that) - I assume that I can only use what is the standard distribution being delivered togather with VS C++ 6.
Now my code generates a lot of data and I would like to store some of it in a simple databse (like an MS Access db). What tools might I be able to use?
My alternative approauch would be to create a database-like object via a struct and vectors/arrays.
I also have office 2010 installed - perhaps I could somehow use Access?
Computation-speed also plays a role - the faster the better.
Another important thing: my PC at work isn't an open client. Thus I can not install any new software. Downloading and moving files works. Basically I must be able to install the tool by just moving the files into a desired folder.
Please let me know if the question is confusing or insufficiently detailed I will do what i can to remedy the situation then.
Thnaks in advance for your help :)
Even though you said 'only standard tools', I'd still say, get SQLite. It ss a public domain software, i.e. no license whatsoever . You can download an 'amalgamation' - one .h file and one .c file and include it into your project. It should compile in VC6 no problem. Very easy to use, you will be up and running in 10 minutes.
It does exactly what you need - a DB in a single file, no servers, zero-setup, etc.
Well, Visual C++ 6 did include MFC which had a suite of classes for the creation and manipulation of databases, I'm fairly certain it would be possible to use these to create a database that is accessible from Access. Unfortunately Microsoft's online help doesn't seem to go back that far, but all the reference material you need should come with the VS 6. (In my opinion VS Help system was better back then anyways.)
On a side note, you could download an old version of boost that would work with VS6. I'm not sure what the last version of boost that supports VS6 is, my guess it's somewhere around 1.3x.
VC6 should work.
Can you use MFC's db objects? (DAO I think back then?).
If your app really generates a lot of data, you might want to look at MySql. I've run into size limitations in older Access tables. Unless it's an extraordinarily simple db, you probably don't want to brew your own (though it might be fun if you have a lot of time).
The key will be finding a driver/db combo that will work. I would install the GA (free) MySql, create a tiny db with 1 table and find the driver ("connector" in MySql terms) that will work. Maybe older ODBC driver?
Also, check out ConnectionStrings.com for info on getting connected to a particular database / driver.

What are some open-source applications written in C/C++ using PostgreSQL?

I'm trying to find open source applications using PostgreSQL that are written in C/C++ so I can study them. A few open source projects using PostgreSQL are Evergreen ILS, SpamAssassin, and pgpool. However, Evergreen and SpamAssassin are written in Perl, and pgpool (written in C) is a replication tool, not a typical application. Moreover, I looked at the SQL code in Evergreen, and it is quite voluminous and complicated.
Hence, I'm looking for one or more applications using PostgreSQL, preferably those that are somewhat trivial (but not too trivial).
seen libpqxx? try asking on its mailing list (but scour their wiki first)
http://pqxx.org/development/libpqxx
pgAdmin is written using c++ using wxwidgets.
how about pgAdmin 3 ?
Also, you may find Qt4 a very easy way interact with databases programming in C++.
http://doc.trolltech.com/4.6-snapshot/sql-programming.html
Have you searched through the projects at http://pgfoundry.org ?
Two examples that are open-source:
Kexi (see kexi-project.org)
FOST4 (
http://support.felspar.com/Fost%204 )
It's pretty big, but the KDE Project's Amarok is written in C++ and can use a PgSQL backend (among several others). While it's pretty large, you may be able to find some interesting things in the database code. Since it uses a pre-defined schema (as opposed to the extremely general types of access that something like pgAdmin uses) it may have some good things to teach you. It will definitely be easier to pick apart than Evergreen, which actually has an entire middleware layer that actually does the data access through exposed services (The OpenSRF Project).

Database Access Libraries for C++

Background:
I have an application written in native C++ which uses the wxWidgets toolkit's wxODBC database access library which is being removed from all future versions of wxWidgets . I need to replace this with another database access method that supports the assumptions and contraints outlined below. I don't require that the replacement use native DBMS APIs or ODBC under the hood, but it must meet the contraints outlined below.
Assumptions/Constraints
The library must:
Support Native (i.e. unmanaged) C++
32-bit Windows 2000/XP/2003
Visual Studio 2005
Microsoft SQL Server 2000 and 2005
Oracle 9 and 10
Run-time Performance greater than or equal to wxODBC
Single programmer API supporting multiple DBMS (e.g. don't want to write different code for using different DBMS)
Nice but Optional:
64-bit Windows operating systems
32-bit and/or 64-bit Linux operating systems
Microsoft SQL Server 2008
Oracle 11
MySQL
Any additional DBMS
Visual Studio 2008
Open Source
Runtime Performance near or equal to native DBMS API
Question:
What good libraries are available - either free, open source or pay - that support multiple DBMS from a single API including Oracle and Microsoft SQL Server and can be used from native C++?
Please describe any past experiences you have had - good OR bad - with a given library and why you are making your recommendation for or against a given library, especially in regards to the assumptions and contraints above.
See Also:
https://stackoverflow.com/questions/74141/good-orm-for-c-solutions
I use SQLAPI++. Well worth a look.
http://www.sqlapi.com/
A library is http://otl.sourceforge.net/
An employer of mine used it.
I can't tell you how its performance compares with wxODBC, but it might fit your requirements.
You can use SOCI http://soci.sourceforge.net or also Wt::Dbo, http://www.webtoolkit.eu and look at the Wt::Dbo component.
You can check Debea - SQL Database Access and ORM for C++. It has API for wxWidgets built-in.
Qt is also an option. It supports the connections to the servers you want, and quite simple to use.
http://doc.trolltech.com/4.4/sql-driver.html#supported-databases
When using Qt, you don't need to build against all Qt. You can for example just use the SQL part, and leave the whole GUI part outside.
Since it has been recently LGPL-ed, you can also use it for a proprietary application.