Back

Topic

[KB45]How to export an ODBC Link used in a PcVue project

Tags: Archives

14 years ago
By RM
Options
Print
Applies to:

PcVue all versions.
While the basic content of this article remains valid, details may have changed since it was written.


Summary:

This article describes how to export an ODBC Link used in a PcVue project.


Details:

An ODBC Link is used by a PcVue project located on a particular PC. When you copy the project to another PC, you must declare the ODBC Link on it also. You can embed the ODBC Link with the PcVue project as described below. The ODBC information is held in the Windows Registry.

Solution

Exporting the key

You can export the Registry key to a .REG file as follows:

  • Open the Windows Registry Editor (Start.Run.RegEdit) and navigate to this key:

HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI

  • Right-click on the item to be exported

RegEdit_ODBC_export_key3

  • Select a destination (e.g. a folder on the target computer or on transferable media) and assign a file name.
Note There should be no spaces in the .REG filename.

The file will have a format like this:

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\testb]
“Driver”=”C:\\WINDOWS\\System32\\sqlsrv32.dll”
“Server”=”(local)”
“LastUser”=”gm”
“Trusted_Connection”=”Yes”
“StatsLog_On”=”Yes”
“Database”=”gm_DefaultDB”

Modifying the key

Before you import it on the target PC, the .REG file has to be modified as follows:

  • Open it with a text editor and add following lines at the start of the file:

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI]

[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources]

“TESTB”=”SQL Server”

  • Save and close the .REG file.
  • Copy the .REG file into your PcVue Project (e.g. to the TP folder).

Ways of registering the key

There are two ways to register the key on the target PC:

  •  Manually.
  •  By modifying the project to register it automatically using a SCADA Basic instruction.

In either case you should first back up the Registry file on the target computer.

Note The means of backing up the Registry on the target machine before you update it include System Restore, Microsoft Backup, exporting all or part of the Registry and use of various proprietary tools.

Registering the key manually

You define a DSN (Data Source Name) by applying the settings from the .REG file to the Registry:

  • Open the Windows Registry Editor (Start.Run.RegEdit).
  • Select File.Import, navigate to the .REG file you created and click on Open. A message will confirm that the settings have been applied.
  • Close the Registry Editor.

Registering the key automatically on project start-up

When you copy the PcVue project to the target PC, you register it there:

  • Use a SCADA Basic Instruction as follows (in this example the .REG file name is test_SQL_Server.reg):

SYSTEM(“SYSTEM”,”regedit.exe test_SQL_Server.reg”)

This instruction must be loaded at project start-up. It will automatically create a DSN on the target computer.

Further information

For guidance on using the Windows Registry, refer to the Registry Editor’s Help.
For an overview of how data source names work, refer to Webopedia’s entry on DSN.


Created on: 07 Oct 2010 Last update: 04 Sep 2024