LNDB
LNDB
2. Getting Started 3
2.1 Installing and Starting the LNDB Service 3
2.2 Selecting a LoggerNet Server 5
2.3 Selecting a Database 6
2.3.1 SQL Server Compact 7
2.3.2 SQL Server 8
2.3.3 MySQL 9
2.3.4 Oracle 10
2.3.5 PostgreSQL 10
2.3.6 Remember and Automatically Login 11
2.3.7 Creating a Database for MySQL, Microsoft SQL Server, Oracle, or PostgreSQL 11
4. Options 14
5. Resolving a Conflict 15
5.1 Archive Database Table 17
5.2 Modify Database Table 18
Table of Contents - iv
7. Importing Data 24
7.1 Database Selection 25
7.2 Import From 25
7.3 TDF File 26
7.4 Import Into 26
7.5 Data File Columns vs Database Table Columns 26
7.6 Import Requirements (into existing table) 27
7.7 Import 27
8. Exporting Data 27
8.1 Database Selection 28
8.2 Export From 28
8.3 Export Into 29
8.4 Check for Missing Records 30
8.5 Export 31
8.6 Select Columns 31
8.7 Array Compatible CSV Options 32
8.8 Representation of NULL Values 33
9. QuickReports 34
9.1 Database Selection 35
9.2 QuickReports Setup 40
9.3 Customizing Your Report 42
9.4 Generating Your Report 42
10. Troubleshooting 43
Appendix C. Metatables 50
Table of Contents - v
1. Introduction
LNDB is an application used to move data from one LoggerNet server into a single database.
There are two main components in LNDB: LNDB Manager and LNDB Engine. LNDB Manager is
used to set up a database and select the datalogger data tables that will be stored in the
database. It also provides tools to monitor the LNDB Engine and to review the database data.
LNDB Engine runs as a service and sends the selected data from the LoggerNet data cache to the
database. LNDB also includes a report generator and utilities for importing and exporting data.
NOTE:
LNDB works with only one LoggerNet server and a single database. Only one copy of LNDB
can be running on a computer. If you need to work with multiple LoggerNet servers, you will
need multiple copies of LNDB running on separate computers. Each will also need its own
separate database.
NOTE:
LNDB may work with other versions of these databases.
Relational databases like the ones supported by LNDB enforce an upper limit on the number
of columns you can have in a single database table. Depending on the database, this limit is
usually 1000 or 1024. In order for LNDB to store data successfully to the database, we
recommend that data tables have fewer than 1000 columns.
LNDB 1
A SQL Server Compact database is limited to 4 GB in size. If you anticipate the need for a
larger database, a SQL Server or MySQL database should be used.
Using a server-based database such as SQL Server, MySQL, Oracle, or PostgreSQL will be
more robust and may give better performance. When using SQL Server, MYSQL, Oracle, or
PostgreSQL, you will need to create a database instance to be used by LNDB (see Creating a
Database for MySQL, Microsoft SQL Server, Oracle, or PostgreSQL (p. 11)).
Sub-second data in a MySQL database requires MySQL 5.6.4 (or later) and LNDB 1.2 (or later).
Note that only newly-created tables will include sub-second data. Existing tables will not be
updated to include sub-second data.
If LNDB has been running with a SQL Server 2005 database, the timestamps in the tables will
be of type DateTime. If you then upgrade to SQL Server 2008 the DateTime data type for the
timestamps is carried over to the 2008 database. However, LNDB expects the timestamps to
be of type DateTime2 which has a higher precision than DateTime. This type mismatch
causes queries to fail. In order to fix this issue, you will need to use the SQL Server
management tools to change the data type for the timestamp columns to DateTime2.
NOTE:
When using Windows Server with security policies other than the default policies, you will
need to work with your IT administrator to work out any security issues.
In addition to a supported Windows operating system, LNDB 2.0 requires Microsoft .NET
Framework 4.6.2 or newer to run properly. Microsoft .NET Framework 3.5 must also be installed
to use the reporting functions of LNDB 2.0.
l Support for
o PostgreSQL
o Oracle
l Miscellaneous other changes and bug fixes.
LNDB 2
2. Getting Started
Setting up LNDB involves the following steps:
Once you press OK, the LNDB Engine Service Manager will open. This utility is used to install
LNDB as a service and to enable/disable that service as required.
NOTE:
You must have administrative rights on your computer in order to run the Service Manager. If
you do not have administrative rights, an error message will be displayed when the Service
Manager tries to open.
LNDB 3
Press the Install button to install LNDB as a service. You will then be asked what account to install
the service under.
You can choose to install the service under the Local System account or under a User account.
Note that a User account is most likely necessary if you are using Windows Authentication in SQL
Server. In most other cases, the Local System account can be used. If User account is chosen, you
will be asked to provide a username and password.
Once the application is installed as a service, press the Start button on the LNDB Engine Service
Manager window to start the service.
LNDB 4
You can then press the Close button to close the LNDB Engine Service Manager.
Once LNDB is installed as a service, you can open the LNDB Engine Service Manager from the
File > Configure LNDB Engine Service menu item or by double-clicking on the LNDB Engine
Status Label on the Status Bar (p. 23). The LNDB Engine Service Manager can also be opened
directly from the LoggerNet toolbar under the Database category.
LNDB 5
Server Address - This is the TCP/IP address of the computer running the LoggerNet server to
which you are trying to connect. This must be the valid name of an existing computer or a TCP/IP
address (in the form ###.###.###.### for an IPv4 address or
[####:####:####:####:####:####:####:####] for an IPv6 address). If the software server
resides on the same computer as the client, you can simply type in LocalHost for the server name.
NOTE:
Note that if you have used a command line argument to change LoggerNet’s default port
number, you must specify this alternate port number when entering the Server Address (e.g.,
LocalHost:6700 or 192.168.7.123:6700).
NOTE:
All information must be saved for the LNDB Engine. The Remember username and password
check box and the Automatically login to this server check box apply only to the LNDB
Manager.
If you are connecting to a remote LoggerNet server, the LoggerNet server must have Remote
Connections enabled (Tools > Options > Allow Remote Connections) in order for LNDB to be
able to connect to the server.
LNDB 6
NOTE:
When using SQL Server, MYSQL, Oracle, or PostgreSQL, you will need to first create a
database instance to be used by LNDB. See Creating a Database for MySQL, Microsoft SQL
Server, Oracle, or PostgreSQL (p. 11).
SQL Server Compact is included with the LNDB install. This database should not be
uninstalled. It is required for LNDB to function correctly.
SQL Server Compact is a single-file database that is installed when LNDB is installed. It only
requires the selection of a filename. The default location of the database will be <working
directory>\LNDB.sdf. LNDB does not support any encryption or security options on the SQL
Server Compact database. When selecting the database within the LNDB Manager, the database
will be created when the OK button is pressed.
LNDB 7
2.3.2 SQL Server
To configure a connection to SQL Server you must select a SQL Server instance. The list of
published SQL Server instances is shown in the Data Source combo box. You can also type into
the Data Source combo box, because the desired server might not be published. Windows
Authentication or SQL Server Authentication can be selected. Windows Authentication does not
require a username and password, but rather uses Windows user accounts to authenticate valid
users. SQL Server Authentication requires a login ID and Password and is independent of
Windows user accounts. You can select the <default> database or select a specific database from
the Database combo box.
LNDB 8
2.3.3 MySQL
The MySQL connection is an ODBC connection. You must use the Windows ODBC Data Source
Administrator to configure the database connection. A 32-bit ODBC driver must be used. 64-bit
ODBC drivers are not supported. Press the ODBC Data Source Administrator button in the Select
Database screen of LNDB Manager to open the 32-bit version of the Administrator. If you
choose to open the Administrator outside of LNDB, the 32-bit version can be accessed from
c:\windows\syswow64\odbcad32.exe (on 64-bit Windows) or c:\windows\system32\odbcad32.exe
(on 32-bit Windows).
Currently only system data sources are supported and show in the Data Source combo box.
A Login ID and Password are needed in most cases for LNDB to authenticate and activate its
connection to the mySQL database. The Login ID and Password may be left blank, if their values
have been specified in the configuration of the ODBC driver (performed in a separate screen). If
the ODBC driver configuration does not specify these values, they should be provided using this
screen. Both the Login ID and Password should be specified together, otherwise the values from
the ODBC driver configuration will be used. If values for Login ID and Password are provided in
both this screen and the ODBC driver configuration, the values specified in this screen will be
used during authentication, and those in the ODBC driver configuration will be ignored.
You can select the <default> database (default as configured in the data source) or select a
different database.
LNDB 9
2.3.4 Oracle
To configure a connection to an Oracle database you must enter a Hostname:Port, Login ID,
Password, and Service Name. The default port for Oracle is 1521.
2.3.5 PostgreSQL
LNDB 10
To configure a connection to a PostgreSQL database you must enter a Hostname:Port, Login ID,
Password, and Database. The default port for PostgreSQL is 5432.
LNDB 11
3. Selecting Datalogger Tables
The first tab on the main screen is Setup. From this screen, you select the datalogger tables for
which you would like to move data into the database. The right side of the screen changes
depending upon whether a station or a table is highlighted in the left tree as described below.
If you check a station in the left tree, all final storage tables for the station are selected. This
includes all tables except Public, Status, DataTableInfo, ports_and_flags, and __inlocs__. If a table
has a conflict and is enabled for storage, its icon and its parent station’s icon are overlaid with an
error icon.
The toolbar at the top of the Setup tab can be used to Select All Final Storage Tables for all
stations or to Deselect All Tables for all stations. It can also be used to select whether to view the
entire network or a Subnet. (Note to use subnets, they must first be configured in the LoggerNet
Admin Setup Screen.)
If a change is made to the setup, the Apply and Cancel buttons are enabled. Press Apply to save
the pending edits and restart the engine. Press Cancel to undo the pending edits.
NOTE:
If a station, table or column that is enabled for storage has an invalid name (i.e., contains ', ",
or `), an icon and text indicating such is placed at the top of the screen. The issue can be
resolved by changing the station name in LoggerNet's Setup Screen or by changing the table
or column name in the CRBasic program.
LNDB 12
3.2 Table Setup
When a table is highlighted in the left tree, the right side contains the Table Setup screen.
Clicking the Store in Database check box will enable storage for the table.
The datalogger columns and database columns are listed side by side. If the database table does
not currently exist, the name of the column that will be created is listed next to the datalogger
column. If the database table does exist and you have chosen "Stop Storing Data" or
"Modify/Archive Database Table" when table definitions change, the datalogger columns are
matched up with the database columns. Blank spaces exist where there is not a corresponding
datalogger or database column.
If in "Stop Storing Data" mode, the table is enabled for storage, and a conflict exists, an icon is
placed next to those columns with conflicts. An icon and bold text stating there is a conflict is
also placed at the top of the screen. A Resolve… button is made visible and can be used to
resolve the conflict. See Resolving a Conflict (p. 15).
LNDB 13
4. Options
The Options Dialog can be opened from the Tools > Options menu item. The following options
are available:
When Tables Change
This tab allows you to determine what will happen when a datalogger’s table definitions change.
Choose from the following options:
Stop Storing Data
Storing data to the database for the individual table stops if table definitions change. You
must manually resolve the change.
Archive Database Table (continue storing)
The table is automatically archived when table definitions change. Following the archive, the
database table is automatically recreated and LNDB begins to store data into the newly
created table.
LNDB 14
An archive consists of renaming the existing table. The new name is chosen by attaching "_
arch#" to the original name. # is chosen by starting with 1 and increasing until a table name
is found that does not already exist.
Modify/Archive Database Table (continue storing)
When table definitions change:
New columns are added to the database table. (previous rows are filled with NULL.)
Old columns are orphaned. (Columns are left, new records contain NULL.)
If any column’s process, units, or data type change the table is archived.
Data Review Options
This tab allows you to select the number of records to be shown in the Data Review tab. The
maximum number of records to show is 100,000.
5. Resolving a Conflict
A conflict exists for a table when datalogger columns do not match database columns. If in "Stop
Storing Data" mode (see Options (p. 14)), the conflict must be manually resolved by selecting the
table in the left tree of the Setup tab and then pressing the Resolve… button on the Table Setup
screen. (Alternately, you can select the datalogger in the left tree of the Setup tab, right click on
the table name on the right side of the screen, and select Resolve.)
LNDB 15
Clicking the Resolve… button brings up the Resolve Table dialog. You have two options:
Once a conflict has been resolved, the conflict icons and bold text are removed. Storage begins
(or continues) for the table once the action(s) have completed.
LNDB 16
5.1 Archive Database Table
If Archive Database Table is selected, the database table name is shown with the action stating
that the table will be renamed to a specific new name. Press the Archive Table button to archive
the table.
LNDB 17
5.2 Modify Database Table
If Modify Database Table is selected, each column that has a conflict is shown with the proper
action displayed. Each action is done when you click the Execute Actions button.
LNDB 18
6.1 Status Tab
The Status tab shows the storage status for each datalogger table. The following columns are
shown:
Database Table - The database table name for each station’s table. They are grouped by
station.
Last Write Time - The last time that data was written to the database table.
Last Record Timestamp - The timestamp of the last record in the database table.
Status - There are 3 valid values:
Storing Data: Data for the table is being stored
Stopped – Conflict: The table has a conflict and storage has stopped.
Blank: Not storing data for this table
Last Error - The last database error (insert error, error creating a database table, or error
retrieving the start conditions) for the given table. This value is only reset when you restart the
engine.
LNDB 19
The Status columns can be sorted. When you click a column other than the Database Table
column, the grouping of tables by station is removed and the records are sorted. Click the
Database Table column to again group the tables by station.
When the engine is stopped all engine statistics are cleared.
The Data Review tab shows tables and data from the database. When a table on the left side is
selected, the data for the table is shown on the right side. You can refresh tables or data by
clicking the corresponding refresh button.
NOTE:
The metatables should not be modified by the user.
LNDB 20
When you archive a table, you are asked for an archive name. The default name is
<basename>_arch<number>. Basename is the first part of the name before the first "_arch".
Number is the smallest number that makes the table name unique. The maximum number of
characters allowed for the table name is 64 for MySQL and 128 for SQL Server and SQL Server
Compact.
Upon completion of a Delete or Archive, any conflicts for the table are removed and storage is
restarted for the table (if enabled for storage).
NOTE:
When storage begins for a newly created table, data always backfills and starts at the oldest
available record. It does not start at the last record from the deleted or archived table.
Therefore, a table may be recreated so quickly after deletion, that it may appear as if the table
was not actually deleted.
The format of timestamp columns is based on the precision of the first two records shown. If the
time has second data, it will be shown. If the time has sub-second data, it will show 3 or 7
decimal places based on the precision.
LNDB 21
The Significant Events tab shows significant messages. The messages can be paused by clicking
the Pause Messages button. Up to 400 messages are displayed, after which the oldest is removed
when new messages are added. If you close down LNDB Manager and reopen it, the messages
are not lost. Clicking the Clear Messages button permanently removes the messages. They are
not shown again the next time LNDB Manager is started.
The Significant Events include:
Database Table Created
Database Table Modified
Database Table Archived
Database Table Storage Stopping due to a conflict
Table Conflict Resolved
Insert Record Failure
The Status Messages tab shows events and the state of the LNDB Engine. These include the
Significant Event messages, data events, LoggerNet events, database events, etc. The Pause
LNDB 22
Messages button pauses the displaying of new messages. These messages are not persistent and
ring at 100 messages. When LNDB Manager closes and reopens, or if you click the Clear
Messages button, the messages clear and are not shown again.
The Status Bar at the bottom of the main screen has three status labels:
LNDB Engine Status Label - Shows the state of the LNDB Engine.
LNDB 23
DB Connection Status Label - Shows the selected data source and whether the connection
is not connected, connecting, or connected.
LN Connection Status Label - Shows the LoggerNet host and port (if not the default port
6789) and whether the connection is not connected, connecting, or connected.
You can use the Status Bar as an alternative to LNDB's File menu. Double-click on any of the
Status Bar labels to bring up the corresponding dialog box (i.e., the LNDB Engine Status Label to
bring up the LNDB Engine Service Manager (see Installing and Starting the LNDB Service (p. 3)),
the DB Connection Status Label to bring up Select Database (see Selecting a Database (p. 6)), or
the LN Connection Status Label to bring up Login to LoggerNet Server (see Selecting a
LoggerNet Server (p. 5)).
7. Importing Data
The DBImport utility, launched from LNDB's Tools > Import Data menu item or from the
LoggerNet toolbar under the Database category, is used to import data from a data file into a
database table.
NOTE:
Files from mixed array dataloggers are not supported.
In order to be imported, a file must contain timestamps and record numbers.
LNDB 24
7.1 Database Selection
When launched for the first time, DBImport uses the database selected for LNDB. You can
change this selection using DBImport's File > Select Database menu item. The DBImport
database selection will then be independent of LNDB's database selection. The database
selection dialog (see Selecting a Database (p. 6)) is identical to the one used in LNDB. If you
select Remember and Automatically Login, the login information is only remembered for
DBImport.
NOTE:
Files from mixed array dataloggers are not supported.
In order to be imported, a file must contain timestamps and record numbers.
LNDB 25
7.3 TDF File
This field is only enabled when you are importing a TOA5 or TOACI1 file into a New Table. These
file formats do not store data type information in their headers. Therefore, it is recommended
that you specify a TDF file associated with the data file. This provides DBImport with the
information necessary to more accurately and efficiently map data in the data file into data types
supported by the database.
TDF stands for Table Definitions File. When a program is precompiled for a CR1000, CR3000,
CR800/850, or CR6 Series datalogger, a program_name.TDF file is created along with the
original program file. Both Short Cut and the CRBasic Editor have the option to produce a .TDF
file when a program is created or compiled. This file contains the table definitions (table size,
variable names, data types, etc.) for that program.
NOTE:
When importing a TOA5 or TOACI1 data file into a new database table, a TDF file is
particularly important if you anticipate the need to add data to the table later on via an
LNDB/LoggerNet connection.
NOTE:
It is important to follow the LNDB database table naming convention of stationname_
datatablename, if you anticipate the need to add data to the table later on via an
LNDB/LoggerNet connection.
LNDB 26
If an existing database table is selected, the list of column names from the database table is
placed in the list view under the heading Database Column. The data file fields and database
columns are matched up. Data file fields that do not have a corresponding database column
have an attached note indicating that the "Database column is missing". Columns in the
database table that do not have a corresponding data file field have a note indicating that the
"Column does not exist in file".
7.7 Import
Once the data file and database table are selected, press the Import button to begin importing
data. Data import will begin if the file is compatible with the selected database table as described
above.
NOTE:
The import process will slow down significantly when duplicates are encountered (between
records in the data file and records that already exist in the database) during the import
process. This is expected behavior. Just allow the import process to complete.
8. Exporting Data
The DBExport utility, launched from LNDB's Tools > Export Data menu item or from the
LoggerNet toolbar under the Database category, is used to export data from a database table
into a data file.
LNDB 27
8.1 Database Selection
When launched for the first time, DBExport launches the Selecting a Database (p. 6) dialog which
allows you to select the database from which to export data. The database selection dialog is
identical to the one used in LNDB. If you select Remember and Automatically Login, the login
information is only remembered for DBExport.
You can change the database selection at any time using DBExport's File > Select Database
menu item or by double-clicking on the database connection status panel at the bottom of the
DBExport window.
LNDB 28
Columns
This list box contains a list of all data columns that will be exported. By default, the list contains
all columns in the selected database table. Press the Select Columns (p. 31) button to select a
custom set of columns.
Date – Time Range
TOACI1 - Data is stored in a comma separated format. Header information for each of
the columns is included.
TOA5 (ASCII Table Data) - Data is stored in an ASCII comma separated format.
Header information for each of the data values is included, along with field names
and units of measure if they are available. When this option is selected, the browse
LNDB 29
button to the right of the field is available. Pressing this button opens a window from
which you can specify whether timestamps and record numbers are included with
each record. You can also specify that Midnight is 2400. When this option is selected,
the timestamp will reflect midnight as the current date with 2400 for the
Hour/Minutes. Otherwise, the timestamp will reflect midnight as the next day's date,
with the Hours/Minutes as 0000.
TOB1 (Binary Table Data)- Data is stored in a binary format. Though this format saves
disk storage space, it must be converted before it is usable in other programs. When
this option is selected, the browse button to the right of the field is available.
Pressing this button opens a window from which you can specify whether timestamps
and record numbers are included with each record.
CSIXML - Data is stored in XML format with Campbell Scientific defined elements and
attributes. When this option is selected, the browse button to the right of the field is
available. Pressing this button opens a window from which you can specify whether
timestamps and record numbers are included with each record. You can also specify
that Midnight is 2400. When this option is selected, the timestamp will reflect
midnight as the current date with 2400 for the Hour/Minutes. Otherwise, the
timestamp will reflect midnight as the next day's date, with the Hours/Minutes as
0000.
Custom_CSV - Data is stored in a user-defined comma separated format. This option
can be used to produce output files from table data dataloggers that are similar to
those created by mixed array dataloggers. When this option is chosen, the Array
Compatible CSV Options (p. 32) button becomes available, so that you can
customize the data string for the CSV file.
LNDB 30
NOTE:
DBExport will not check for missing records before the first record or beyond the last record in
the database table. Therefore, if the Start Date/Time is before the first record in the database
table, records before the Start Date/Time will not be reported as missing. Likewise, if the End
Date/Time is beyond the last record in the database table, records after the End Date/Time
will not be reported as missing. DBExport will not report this as an error.
Table Interval
Specify the interval of the database table. This interval is used to check for missing records when
checking based on time.
8.5 Export
Once the database table, data file, and other options are set, press the Export button to begin
the export. While exporting is in process, you can press the Cancel button to abort the export.
While export is in process, a progress percentage will be displayed. Note that the displayed
percentage is based on the Start and End date/times selected and the timestamp of the record
currently being processed. If the Start and End date/times are in the table and there is a fairly
complete set of interval data between these times, the progress will be fairly accurate. If there are
gaps in the data, or if the Start and/or End date/times are not in the data, or if the data is event
driven (not interval based), the progress percentage may not accurately represent progress.
LNDB 31
The Available Columns field will list all of the available data columns in the selected database
table that are not currently included for export. To choose a column to be exported, highlight it
and press the right arrow button or, alternately, double-click the column name. This moves the
column heading into the Selected Columns field. To specify that all columns are to be exported,
press the double right arrow button. When the dialog box is closed, the columns will be added to
the Columns list and will be included in the export.
Columns can be reordered in the Selected Columns field by dragging and dropping them to the
desired location.
Columns can be removed from the export by moving them back into the Available Columns field
using the left arrow button.
LNDB 32
If an array ID is desired, select the Include Array ID check box and enter a value into the field. The
value can range from 1 to 1023. The array ID will be the first value in the array of data.
Select the appropriate timestamp options for the type of timestamp to write to the file. Each time
element will be output as a separate data value in the array and the data values will be separated
by a comma. Selecting Year will output the year represented by four digits, YYYY (e.g., 2006). The
Day will be represented as a Julian Day. The Hour/Minutes will be represented by four digits
(hhmm). When Midnight is 2400 is selected, the timestamp will reflect midnight as the current
date with 2400 for the Hour/Minutes. Otherwise, the timestamp will reflect midnight as the next
day's date, with the Hours/Minutes as 0000.
The Max and Min Timestamp Options is used to determine the type of timestamp that will be
used for Maximum and Minimum outputs that include a timestamp along with the value. You
can choose a TOA5 format timestamp (e.g., 2008-10-27 17:17:33.7), a timestamp that includes
Hours/Minutes and Seconds (produces two values, hhmm and seconds), a timestamp that
includes Hours/Minutes only (hhmm), or a timestamp that includes Seconds only.
LNDB 33
NAN representation of NULL values from a database
SQL
Datalogger SQL
NAN MySQL Server
Data Example Server Oracle PostgreSQL
Value Type Compact
Type Type
Type
Negative
LONG Max -2147483648 INT INT INT Number(10,0) integer
(LONG)
Jan 1
SecNano 0 DATETIME DATETIME DATETIME TIMESTAMP timestamp
1990
SMALLINT
USHORT Zero 0 INT INT Number(5,0) integer
UNSIGNED
9. QuickReports
QuickReports, launched from the LNDB Tools > QuickReports menu item, is used to design
simple reports from an LNDB database. It is very simple and quick and enables you to generate a
new report with just a few mouse clicks. The report can then be printed or exported to an Acrobat
file.
The QuickReports Setup (p. 40) dialog is displayed every time a new report is created and
presents you with a few basic options such as title, time range, database table, and up to 4 data
columns. When you accept the settings in the QuickReports dialog, the report is then bound to
the selected table. You can customize the report further using each component’s property sheet.
The report can then be saved and run as a report in the Report Preview window. The Report
Preview window paginates the report and gives options to print or export to an Acrobat file.
LNDB 34
The saved report can be loaded in RTMC Pro where it can be modified with advanced features
and components. When the report is saved in RTMC Pro, it will be saved as a *.rtmc2 project file.
This file cannot be loaded in QuickReports. However, the QuickReports *.rtmq file will not be
overwritten. This file can still be loaded in QuickReports, but it will contain none of the changes
made in RTMC Pro.
The remaining information changes depending on the database type as described below:
LNDB 35
SQL Server Compact
The only additional information needed for a SQL Server Compact database source is the
database file to be used. Type in the name directly or press the button to the right of the field to
browse to the database file.
LNDB 36
SQL Server
To select a SQL Server database source you must select a SQL Server instance. The list of
published SQL Server instances is shown in the Data Source combo box. You can also type into
the Data Source combo box, because the desired server might not be published. Windows
Authentication or SQL Server Authentication can be selected. Windows Authentication does not
require a username and password, but rather uses Windows user accounts to authenticate valid
users. SQL Server Authentication requires a login ID and Password and is independent of
Windows user accounts. You can select the <default> database or select a specific database from
the Database combo box.
The Remember username and password checkbox can be selected to save the username and
password. If this check box is not selected and you are using SQL Server Authentication, you will
be required to enter the username and password each time a report is opened that uses this
database source.
LNDB 37
MySQL
The MySQL connection is an ODBC connection. You must use the Windows ODBC Data Source
Administrator to configure the database connection. Currently only system data sources are
supported and show in the Data Source combo box. The Username and Password may be
optional. They will be set to blank in the connection string. It has been found that when set to
blank, the login id and password configured in the ODBC Data Source Administrator are used.
You can select the <default> database (default as configured in the data source) or select a
different database.
The Remember username and password checkbox can be selected to save the username and
password. If this check box is not selected and the username and password were not configured
in the ODBC Data Source Administrator, you will be required to enter the username and
password each time a report is opened that uses this database source.
LNDB 38
Oracle
To select an Oracle database source you must enter a Hostname:Port, Username, Password, and
Service Name. The default Oracle port is 1521.
The Remember username and password checkbox can be selected to save the username and
password. If this check box is not selected, you will be required to enter the username and
password each time a report is opened that uses this database source.
LNDB 39
PostgreSQL
To select a PostgreSQl database source you must enter a Hostname:Port, Username, Password,
and Database. The default PostgreSQL port is 5432.
The Remember username and password checkbox can be selected to save the username and
password. If this check box is not selected, you will be required to enter the username and
password each time a report is opened that uses this database source.
LNDB 40
Title
Specify the title to be displayed at the top of the report.
Data Table
Indicates the data table from which to display data values. Use the Browse button to open the
Data Source Browser and select a table.
Data Column 1 – Data Column 4
Use the drop-down lists to select up to 4 data values to be displayed. (Note that you can add
more data values later. See Customizing Your Report (p. 42).)
Begin Date/End Date
Enter the Begin Date/Time and End Date/Time to specify the time period for which data will be
displayed. The Oldest Available Date and Newest Available Date fields indicate the date range
that is in the table and able to be displayed.
NOTE:
By default, the Data Grid can display a maximum of 5000 records. If your selected date range
exceeds 5000 records, you will only see 5000 records in the Data Grid with a note at the
bottom indicating “Max Records Exceeded”. In order to view all of the records in your date
range, you will need to use the Data Grid’s property sheet to increase Max Records. (See
Customizing Your Report (p. 42) for more information on using property sheets to customize
your report.)
LNDB 41
When using the QuickReports Setup window to edit the date range for a report, you will lose
any customization you have done to chart traces. If you wish to maintain the customization,
you should edit the date range using the Report Range property sheet.
NOTE:
You can add traces to the chart using the Add button on the Series tab of the Chart property
sheet. Columns can be added to the Data Grid using the Select Columns button on the Data
Grid property sheet.
A component can be deleted from the report by right-clicking on the component and selecting
Delete <Component Name>. For example, to delete the chart, right-click on the chart and select
Delete Chart. Once a component has been deleted, it can be restored to the report by selecting
Edit > Undo from the QuickReports menu.
NOTE:
Once a report has been closed, you will not be able to restore the component.
The Undo and Redo functions in QuickReports apply only to deleting components.
LNDB 42
10. Troubleshooting
Database already opened by a different user
The "Database already opened by a different user" error can occur if Windows UAC (User
Account Control) is on, an application with standard rights connects to the database first, and
then a second application run as an administrator attempts to connect. With UAC on, the SQL
Server CE database determines that the second application is being run by a different user. This
error can be seen with the LNDB Engine, because it always runs with certain administrative rights.
To fix this problem, all connections to the database should be closed and then the connection
can be attempted again. If the first application that connects is run with administrative rights, all
other applications with or without administrative rights can connect.
LNDB 43
Appendix A. Data Type
Mapping
Datalogger data types are mapped into database data types differently depending on the type of
database as described below.
SQL Server Compact
SQL Server
LNDB 44
Boolean BIT
Bool8 BIT
DATETIME or Record Timestamp is DateTime2 (resolution is 100ns). All
Nsec
DATETIME2 others are DateTime (resolution is 3ms).
MySQL
Oracle
Oracle Notes
Datalogger Data Type
Data Type
IEEE8 BINARY_DOUBLE
IEEE4 BINARY_FLOAT
FP2 BINARY_FLOAT
Long Number(10,0)
UINT2 Number(5,0)
LNDB 45
String NVARCHAR2(2000)
Boolean Number(1,0)
Bool8 Number(1,0)
Nsec TIMESTAMP Resolution is 1 microsecond
PostgreSQL
PostgreSQL Notes
Datalogger Data Type
Data Type
IEEE8 double precision
IEEE4 real
FP2 real
Long integer
UINT2 integer
String text
Boolean boolean
Bool8 boolean
Nsec timestamp Resolution is 1 microsecond
LNDB 46
Appendix B. SQL Rights
LNDB requires you to have rights to the following commands based on the database type:
SQL Server Compact
No security available.
SQL Server
Command Usage
Alter Used to add columns to existing data tables
Create
Creates meta and data tables
Table
Delete tables (only initiated by user in LNDB Manager). Also used when
Drop
creating a temporary meta table during an archive.
Delete Deletes meta table records. (Never deletes data table records.)
Insert Meta table and data table inserts.
sp_rename Stored procedure used to rename a table during an archive.
Select Meta table and data table data requests.
Update Used to update meta table records during an archive.
References Used when creating meta tables.
View
Database Used by DBExport and RTMC Pro to get the number of records in a table.
State
MySQL
Command Usage
Used to add Columns to existing data tables. Also used to rename data
Alter
tables.
Create
Creates meta and data tables
Table
LNDB 47
Delete tables (only initiated by user in LNDB Manager). Also used when
Drop
creating a temporary meta table during an archive.
Delete Deletes meta table records. (Never deletes data table records.)
Insert Meta Table and data table inserts.
Select Meta Table and data table data requests.
Update Used to update meta table records during an archive.
References Used when creating meta tables.
Oracle
Command Usage
Alter Any Used to add columns to existing data tables. Also used to rename data
Table tables.
Create Used to create unique identifiers used as primary keys within the Meta
Sequence tables.
Connect To establish a connection (Granted Role)
Create Table Create mete and data tables
Delete Any
Deletes meta table records. (Never deletes data table records.)
Table
Drop Any Delete tables (only initiated by user in LNDB Manager). Also used when
Table creating a temporary meta table during an archive.
Insert Any
Meta table and data table inserts.
Table
Select Any
Meta table and data table data requests.
Table
Update a
Used to update meta table records during an archive.
Table
Unlimited Lets the LNDB engine service create tables as needed without running
Tablespace into allocation of space issues.
LNDB 48
PostgreSQL
Command Usage
Can Login To allow the SQL user to log in to the SQL server
Connect To establish a connection
Create Creates meta and data tables
Delete Deletes meta table records. (Never deletes data table records.)
Insert Meta table and data table inserts.
Select Meta table and data table data requests.
Temporary Allows temporary files to be created to manipulate meta table records.
Update Used to update meta table records during an archive.
References Used when creating meta tables.
LNDB 49
Appendix C. Metatables
There are three metatables which contain the relationships between LoggerNet and the
database: lndbstationmeta, lndbtablemeta, and lndbcolumnmeta.
NOTE:
The metatables should not be modified by the user.
lndbstationmeta
Information for every station for which data has been or will be stored.
stationID - primary key
lnStationName - LoggerNet station name
lndbtablemeta
Information for every database data table that has been or will be written to.
tableID - primary key
LNDBStationMeta_stationID - foreign key referencing lndbstationmeta.stationId
lnTableName - LoggerNet tablename
dbTableName - database tablename
lndbcolumnmeta
Information for every database "data" column that has been or will be written to.
LNDBStationMeta_stationID - foreign key referencing lndbstationmeta.stationID.
LNDBTableMeta_tableID - foreign key referencing lndbtablemeta
lnColumnName - datalogger column name (from LoggerNet)
dbColumnName - Database column name
process - process as defined in datalogger program
units - units as defined in datalogger program
dataType - datalogger column's data type
columnOrder - actual order in datalogger table definitions
active - true if data for the column should be stored
LNDB 50
Appendix D. Unicode Support
and Upgrade Process
With LNDB versions 1.2 and later, support is provided for storing Unicode (UTF-8) strings into the
LNDB database. DBExport, DBImport, and QuickReports have also been Unicode-enabled.
LoggerNet version 4.2 or later is required to enable the Unicode features of LNDB.
UTF-8 Unicode encoding includes characters from languages such as Russian, Chinese, Japanese,
Greek, Korean, and many other languages of the world. For brevity, the UTF-8 character sets are
not shown here. For non-English UTF-8 character data to be created and stored within an LNDB
database, the CRBasic program running on a datalogger must be modified to explicitly provide
source data in the desired language using UTF-8/Unicode format.
LNDB deployments using Microsoft SQLServer databases require the Unicode-enabled versions
of LoggerNet and LNDB to be installed, and then these will store Unicode strings automatically
as soon as datalogger program modifications that use UTF-8 are implemented.
MySQL databases that are created new in LNDB v1.2 (and later) are automatically encoded using
UTF-8, and therefore will also store any UTF-8 characters that arrive from a datalogger source (as
long as a Unicode-enabled ODBC driver is used - see step 6. of the migration process below).
However, existing MySQL tables that were created using LNDB v1.0 or v1.1 are not encoded with
UTF-8, and are not automatically converted to UTF-8 when LNDB v1.2 (or later) is installed and
executed. These legacy database tables should be considered for migration to UTF-8 format,
although migration is often not necessary.
LNDB 51
NOTE:
To determine exactly which characters are supported in legacy LNDB tables (i.e., without
migrating them to UTF-8), refer to the section below entitled Windows Code Page 1252.
However, if you will begin requiring the storage of non-English (non-Latin-based) characters
from languages such as Russian, Chinese, Japanese, Greek, Korean, and many other languages of
the world into these legacy LNDB tables, they will require migration to the UTF-8 format.
When migrating your tables to UTF-8, you should carefully follow the migration process shown
in the section below entitled Migrating Existing MySQL Tables to UTF-8. The migration process
includes these main actions:
LNDB 52
available on the Campbell Scientific website.
5. Upgrade LNDB to version 1.2 or later. Check the Campbell Scientific website for the latest
version.
6. Install a 32-bit, Unicode version of the MySQL ODBC driver (v5.2.6 or later). The driver
installation software is obtained from a MySQL software provider and not from Campbell
Scientific.
7. Start the LoggerNet Toolbar. Start the LNDB Manager from the Toolbar.
a. Start the LNDB Engine service (if needed) when prompted.
b. Connect to LoggerNet as prompted.
c. In the Select Database screen, make sure the ODBC data source used by LNDB is
configured to use the newly installed 32-bit, Unicode-enabled driver. Use the ODBC
Data Source Administrator button as needed, along with the Select Database screen
itself.
8. Open the Convert MySQL tables dialog box from the Tools menu of the LNDB Manager.
Using this screen, convert the LNDB database and metadata tables to use the UTF-8
character set/encoding (instead of Latin1, for example). Refer to Convert MySQL Tables (p.
54) for further details.
9. Modify the CRBasic program running in the affected dataloggers to use the desired
Unicode (UTF-8) characters. The CRBasic Editor provided with LoggerNet 4.2 and later will
allow the native processing of UTF-8 characters on-screen. Start the Unicode-enabled
programs on the dataloggers.
10. Uncheck the Pause Schedule checkbox in the Status Monitor of LoggerNet to allow data to
be collected and sent to LNDB. Use the Connect Screen and LNDB Manager to confirm
that data is flowing from the dataloggers into LoggerNet, and from LoggerNet into LNDB.
Confirm that Unicode characters are written properly into the data tables of LNDB.
NOTE:
Make sure you do not start a datalogger program that uses Unicode characters until
LoggerNet and LNDB have been updated, the LNDB tables have been converted to UTF-8,
and the proper MySQL Unicode driver has been installed, as described above. Most Unicode
characters cannot be stored in the LNDB database until all of these actions have been
executed properly. MySQL tables that use the Latin1 character set instead of UTF-8 cannot
store Unicode characters. String data written into LNDB databases when any of the above
conditions are not satisfied may result in unrecoverable or corrupt string storage.
LNDB 53
D.3 Convert MySQL Tables
The Convert MySQL Tables dialog box, launched from LNDB's Tools > Convert MySQL Tables
menu item, is used to convert database tables and metatables in a MySQL database that have
been storing Windows code page 1252 characters (extended ASCII/Latin1/ISO 8859-1) to Unicode
(UTF-8) strings in the LNDB database.
After upgrading to LNDB 1.2, any tables that need to be converted in order to start storing
Unicode characters will be shown in the dialog box along with their current character set and
their target character set. Simple select the tables you wish to convert (or Select All to select all of
the tables) and press the Convert button. The selected tables will be converted to Unicode.
LNDB 54
To store characters that are not shown above (not a part of CP1252) with Campbell Scientific
products, it is necessary to use UTF-8 Unicode encoding.
LNDB 1.1 and 1.0 systems that used MySQL usually encoded database tables as Latin1. Latin1 is
100% compatible with the CP1252 characters shown above. If your ongoing use of LNDB 1.2 and
later does not require any more characters than those shown above, you may continue using the
Latin1 table encoding that was created by LNDB 1.0 and/or 1.1. In that case, no migration of the
table encoding and data is necessary. LoggerNet 4.2 or later and LNDB 1.2 or later can be
installed and will work properly with existing Latin1 tables (CP1252) just as they did with earlier
versions of LNDB and LoggerNet. This will not require any migration steps other than standard
upgrade installations.
LNDB 55
Campbell Scientific regional offices
Brazil Germany UK
Location: São Paulo, SP Brazil Location: Bremen, Germany Location: Shepshed, Loughborough, UK
Phone: 11.3732.3399 Phone: 49.0.421.460974.0 Phone: 44.0.1509.601141
Email: [email protected] Email: [email protected] Email: [email protected]
Website: www.campbellsci.com.br Website: www.campbellsci.de Website: www.campbellsci.co.uk