Create a Sparksee database

Now that we have the set up complete and we have started coding, let’s create our first database. In this chapter we are going to create a simple database containing information about certain movies, their actors and directors.

The first thing you should do is to create a SparkseeConfig object to establish the Sparksee main settings. That object will be created using the global SparkseeProperties settings (initially loaded from a sparksee.cfg file). You do not have to change any setting directly here, but its creation is a must before creating the Sparksee object.

If you have not set your client and license ids in the configuration file, you must set them in the SparkseeConfig class using the setClientId and setLicenseId methods.

The newly created SparkseeConfig object will be used to create a Sparksee object. Once you have created this object, you can create your databases.

A new database needs a file path (HelloSparksee.gdb) and a name (HelloSparksee). This database file is where all the persistent information will be stored.

[Java]
// Providing a config file to SparkseeConfig will allow it to store the
// downloaded key avoiding having to download it again until it expires.
SparkseeConfig cfg = new SparkseeConfig("sparksee.cfg");
// The setClientId and setLicenseId method calls are only required if your
// license has not been setup in the configuration file (sparksee.cfg by default)
cfg.setClientId("Your client identifier");
cfg.setLicenseId("Your license identifier");
Sparksee sparksee = new Sparksee(cfg);
Database db = sparksee.create("HelloSparksee.gdb", "HelloSparksee");
[C#]
// Providing a config file to SparkseeConfig will allow it to store the
// downloaded key avoiding having to download it again until it expires.
SparkseeConfig cfg = new SparkseeConfig("sparksee.cfg");
// The setClientId and setLicenseId method calls are only required if your
// license has not been setup in the configuration file (sparksee.cfg by default)
cfg.SetClientId("Your client identifier");
cfg.SetLicenseId("Your license identifier");
Sparksee sparksee = new Sparksee(cfg);
Database db = sparksee.Create("HelloSparksee.gdb", "HelloSparksee");
[C++]
// Providing a config file to SparkseeConfig will allow it to store the
// downloaded key avoiding having to download it again until it expires.
SparkseeConfig cfg(L"sparksee.cfg");
// The setClientId and setLicenseId method calls are only required if your
// license has not been setup in the configuration file (sparksee.cfg by default)
cfg.SetClientId(L"Your client identifier");
cfg.SetLicenseId(L"Your license identifier");
Sparksee *sparksee = new Sparksee(cfg);
Database *db = sparksee->Create(L"HelloSparksee.gdb", L"HelloSparksee");
[Python]
# Providing a config file to SparkseeConfig will allow it to store the
# downloaded key avoiding having to download it again until it expires.
cfg = sparksee.SparkseeConfig("sparksee.cfg")
# The setClientId and setLicenseId method calls are only required if your
# license has not been setup in the configuration file (sparksee.cfg by default)
cfg.set_client_id("Your client identifier")
cfg.set_license_id("Your license identifier")
sparks = sparksee.Sparksee(cfg)
db = sparks.create("Hellosparksee.gdb", "HelloSparksee")
[Objective-C]
// Providing a config file to SparkseeConfig will allow it to store the
// downloaded key avoiding having to download it again until it expires.
STSSparkseeConfig *cfg = [[STSSparkseeConfig alloc] initWithPath: @"sparksee.cfg"];
// The setClientId and setLicenseId method calls are only required if your
// license has not been setup in the configuration file (sparksee.cfg by default)
[cfg setClientId: @"Your client identifier"];
[cfg setLicenseId: @"Your license identifier"];
STSSparksee *sparksee = [[STSSparksee alloc] initWithConfig: cfg];
// If you are not using Objective-C Automatic Reference Counting, you
// may want to release the configuration here.
//[cfg release];
STSDatabase *db = [sparksee create: @"HelloSparksee.gdb" alias: @"HelloSparksee"];
Back to Index