TSTool / Command / OpenHydroBase
This command will be phased out in the future. Instead, define HydroBase datastores (see the HydroBase Datastore appendix), where the datastore name is equivalent to the InputName parameter.
OpenHydroBase command opens a connection to a HydroBase database,
allowing data to be read from the database (e.g., with
ReadHydroBase commands and time series identifiers that have
~HydroBase input types).
This command is not typically used for interactive sessions but may be
inserted to run in batch only mode to allow a specific database and commands files to be distributed.
It may also be used in cases where time series are read from different HydroBase databases,
perhaps to compare the contents of the databases – in this case two
OpenHydroBase commands can be used.
When connecting to a SQL Server database, a connection will be tried for SQL Server (Express) and older MSDE databases.
If both fail, a warning will be shown.
The following dialog is used to edit this command and illustrates the command syntax.
OpenHydroBase Command Editor (see also the full-size image)
The command syntax is as follows:
||Used with a SQL Server HydroBase. Specify the SQL Server database machine name. A list of choices will be shown, corresponding to properties in the
||Required if a SQL Server database is used.|
||Used with a SQL Server HydroBase. The name of the database typically follows a pattern similar to:
||The ODBC DSN to use for the connection, used only when working with a Microsoft Access database.||Required if a Microsoft Access database is used.|
||The input name corresponding to the
||Blank (no input name).|
||Used with SQL Server, indicating whether stored procedures are used. Stored procedures are the default and should be used except when testing software. True (used stored procedures).|
||Indicates when the command should be run, one of:
See the automated tests.
The following example command file illustrates how to connect to a SQL Server database running on a machine named “sopris”:
StartLog(LogFile="Results/Example_OpenHydroBase_DatabaseName.TSTool.log") OpenHydroBase(DatabaseServer="sopris",DatabaseName="HydroBase_CO_20060816") ReadHydroBase(TSID="BOXHUDCO.DWR.Streamflow.Month",Alias="ts")
The following example command file illustrates how to make two HydroBase database connections,
in this case to test whether the stored procedure and SQL queries return the same results
InputName parameter is used to tell TSTool which connection to use when reading data based on time series identifiers):
OpenHydroBase(DatabaseServer="hbserver",RunMode=GUIAndBatch,UseStoredProcedures=True,InputName="SP") OpenHydroBase(DatabaseServer="hbserver",RunMode=GUIAndBatch,UseStoredProcedures=False,InputName="NoSP") ReadHydroBase(TSID="BOXHUDCO.DWR.Streamflow.Month~HydroBase~SP",Alias="ts_sp") ReadHydroBase(TSID="BOXHUDCO.DWR.Streamflow.Month~HydroBase~NoSP",Alias="ts_nosp")
The following example commands file illustrates how to connect to a Microsoft Access database (although Microsoft Access databases are no longer supported):