Introduction

Tutorials

Reference

Managing databases

What is a database ?

In WellSim, a database is a file or a set of files where your geothermal data is stored on a computer's hard disk. The database can be on your computer, or, if you are on a network, the database can be on a server.

When you start WellSim, it asks you to select a database to use. As you work with WellSim, creating, changing and deleting geothermal data, WellSim automatically changes the data in that database accordingly. This means that you never need to tell WellSim to save data to the database, and you will not lose data if it stops unexpectedly.

You can close the current database and open another one. You only ever work with data in the one open database; you can not see data in any closed database.

WellSim comes with a database of typical geophysical data, called sample, for you to experiment with. You could, in principle, continue to use this database for ever, and store all your geothermal data in it. However, you should not do this, but instead you should create and use a separate database for each geothermal field you have. For example, if you have data from Atlantis and data from Valhalla, then create two databases, called Atlantis and Valhalla and store your data for each in each.

This section covers:

Maintaining your databases:

Creating, adding, deleting, removing databases:

You can also:

Note

If you are unsure about databases, ask your IT manager.

Access or SQL Server databases

A WellSim database can be either Microsoft Access or Microsoft SQL Server:

Access databases SQL Server databases
Easier to set up and manage More secure, better behaved and can be bigger
Grow bigger with use, needs compacting occassionally Does not need compacting
Is one file ending in .mdb Is a server and more than one file
Usually managed by a user Usually managed by an IT department
Ideal for a small user, or for quickly setting up a small, ad hoc database Ideal for a large, long-term user

Note

Opening the Database Manager window

Note:

Selecting an existing database to use

  1. Open the Database Manager window.

  2. Click the database to use, then click . Or double-click the database to use.


Maintaining your databases

This section covers:

Finding the version number of a database

  1. Open the Database Manager window.

  2. Click Version:

You see the versions down the right. For more on version numbers see here.

Finding where a database is stored on your PC

  1. Open the Database Manager window:

  2. Click the database name and then click Edit DB.

  3. Click the field Use Connection String and press Left arrow or Right arrow to scroll along the connection string until you find the path name that follows Data source=. You can select this path name and press Ctrl + C to copy it:

    • For an Access database, the path name is the database, for example Data Source=C:\Users\stan\AppData\Local\Gradient\GDMan\example\atlantis.mdb

    • For an SQL Server database, the path name is the name of the database server.

  4. Click Cancel.

Backing up a database

Access database

  1. Find where the database is on your PC see above.
  2. Use backup software or Windows Explorer to back up the database to an external disk or to the cloud.

SQL Server database

Use SQL Server Management Studio to backup.

Renaming an existing database

Renaming a database only changes WellSim's name for the database, it does not change the database file name.

  1. Open the database window and click the database to rename.

  2. Click Rename DB. Enter a new name for the database and click OK.

Compacting an Access database

An Access database will slowly grow bigger as you use it, filling up with empty gaps. Occasionally make it smaller again:

  1. Run Microsoft Access, the stand-alone database manager program. This is readily available, and you might find you have it on your PC already.

  2. Open the WellSim database in Microsoft Access.

  3. In the File tab, click Compact and repair database.

SQL server databases You don't haver to compact these.


Creating, adding, deleting, removing databases


Overview

You can get a database by creating an empty one, or if a colleague sends you one. To use it in WellSim, you first need to add the database to WellSim.

If you don't want to use a database in WellSim any more, remove it from WellSim. Then, if you don't want it any more, delete it.

This section covers:

Creating a new Access database

This creates a new, empty Access database, then installs it in WellSim.

  1. In WellSim's home window, click File and then click Create New DB:

  2. Navigate to a folder to store the new database; enter a file name for the new database Click Save.

  3. WellSim then:

    • Creates a new WellSim Access database, containing all the appropriate tables but with no data

    • Adds the new database to the Database Manager

    • Opens the new, empty, database in WellSim.

  4. WellSim's name for the new database is the same as the database file name. To change WellSim's name see here.

Creating a new SQL server database

This creates a new, empty SQL Server database, then installs it in WellSim.

Warning. You must have Admin permission plus either be a dbo user or you and other GeoData Manager users must all be members of a db_owner role for this database read more.

Requirements: SQL Server, SQL Server Management Studio

  1. Start SQL Server Management Studio. We recommend you use Windows Authentication:

  2. Click Connect. Right-click Databases and select New Database:

  3. Enter a database name; this should be the name of your geothermal prospect, Akiira in this example.

  4. SQL Server creates an empty SQL Server database. Click OK and exit SQL Server Management Studio. Ensure WellSim can access the new database.

  5. Now start WellSim and at the database manager window, click New DB:

  6. The Create new database window appears. Follow the procedure to install an SQL server database.

Adding an existing database to WellSim

The database must be a WellSim database, created by the current version or an earlier version of WellSim. You might add an existing database to the Database Manager if a colleague gives you a WellSim database or if you earlier removed the database from the Database Manager and now want to use it again.

  1. Ensure the database is on your computer system where WellSim can access it.

  2. Now start WellSim and at the database manager window, click Add DB:

    The Add database window appears.

  3. To add an access database, follow this procedure.

    To add an SQL server database, follow this procedure.

Update the connection to a database in WellSim if you move the database to a different place on your computer, or if you rename a database file.

  1. Open the Database Manager window.

  2. Click Edit DB:

  3. To update to an access database, follow this procedure.

    To update to an SQL server database, follow this procedure.

Removing a database from WellSim

When you remove a database it only removes the database name from the Database Manager. It does not delete the database or any of your data in the database. You can add the database back to the Database Manager later.

  1. Open the Database Manager window.

  2. Click Remove DB.

  3. Click Yes.

Deleting a database

Note:

To delete an Access database

  1. Find the location of the database on your PC.

  2. The database is one file, ending in .mdb. Use Windows Explorer to delete the file.

To delete an SQL Server database

Use SQL Server Management Studio to delete the database.


Installing an Access database

This procedure is common to several database procedures above.

  1. In the Create new database or Add database or Edit database window:

    Click Build.

  2. If you are creating or adding a database, the Provider tab opens:

    Click Microsoft Jet 4.0 OLE DB Provider, and click Next >>.

  3. The Connection tab opens:

    Enter the database name: the full database file path (.mdb file):

    • either type or paste the path if you know it,

    • or click , navigate to the folder with the .mdb file, click the file and click OK.

  4. Click Test Connection to ensure WellSim can find the database:

  5. Click OK to return to the Create new database or Add database or Edit database window again:

  6. Click OK:

  7. Enter a WellSim name for the database; this does not change the underlying name. Click OK:

WellSim will now create all the tables in the database, populate some tables with system values, add the database to the Database Manager and return to the Database Manager. This might take a while.


Installing an SQL Server database

This procedure is common to several database procedures above.

  1. In the Create new database or Add database or Edit database window:

    Click Build.

  2. If you are creating or adding a database, the Provider tab opens:

    Click Microsoft OLE DB Provider for SQL Server, and click Next >>.

  3. The Connection tab opens:

    Click Use Windows NT Integrated security. Select the database (Akiira in this example) from the drop-down list.

  4. Click Test Connection to ensure WellSim can find the database:

  5. Click OK to return to the Create new database or Add database or Edit database window again:

  6. Click OK:

  7. Enter a WellSim name for the database; this does not change the underlying name. Click OK:

  8. WellSim will now ask if you have dbo rights, necessary to create a new database:

    Warning. You must have Admin permission plus either be a dbo user or you and other GeoData Manager users must all be members of a db_owner role for this database read more. If you have these rights and permissions, click OK.

WellSim will now create all the tables in the database, populate some tables with system values, add the database to the Database Manager and return to the Database Manager. This might take a while.