To compile the ODBC tutorials from the command line, follow the steps below.
This section is oriented toward a command-line running on Microsoft Windows. The principles are similar for other environments that provide .NET support, such as Linux/Unix.
Where 2017 is your version of Visual Studio and X64 is for a 64-bit version of c-tree (note “64” in the name of the default installation directory) or X86 for a 32-bit version of c-tree.
Warning - the Developer Command Prompt Start menu entries which do not specify a bit depth actually open the 32-bit version of the Developer Command Prompt, which is always the wrong one for c-treeEDGE.
For more details, see the Microsoft Developer Command Prompt web page.
This batch file will determine the version of the Microsoft C compiler you are using and will set the internal paths accordingly. It will then compile the tutorials included for this driver.
After the tutorials have been built, the batch file will run them one-at-a-time. A prompt will ask you to press <Enter> before running each tutorial.
If you see a c-tree error, you can look it up in the Error Code Reference. See the "Troubleshooting" section below for solutions to common problems.
Note: If you are using FairCom RTG or FairCom Edge, adjust the path to match your product.
The output of the first tutorial project should appear similar to the following:
INIT
Logon to server...
DEFINE
Open table...
Add fields...
Create table...
MANAGE
Delete records...
Add records...
Display records...
1000 Bryan Williams
1001 Michael Jordan
1002 Joshua Brown
1003 Keyon Dooling
DONE
Close table...
Logout...
Press <ENTER> key to exit . . .
Executing the Tutorials by Hand
You can run the tutorials individually using the executables located in drivers\sql.odbc\tutorials\cmdline
ODBCTutorial1.exe
ODBCTutorial2.exe
ODBCTutorial3.exe
ODBCTutorial4.exe
Running in Debug Mode
To fully observe FairCom DB ODBC in action, you can single step through the code with the Visual Studio integrated debugger. You can call this as follows:
devenv ODBCTutorial1.exe
devenv ODBCTutorial2.exe
devenv ODBCTutorial3.exe
devenv ODBCTutorial4.exe
Hint: A better way to single-step and debug is to open the Visual Studio solution that we provide. See Compile Using Microsoft Visual Studio IDE.
Troubleshooting
This section lists some of the errors that can occur when compiling and running these tutorials:
cl.exe not found! Please set environment for Visual C/C++ compiler.
The most common cause of this error is running the BuildTutorials.bat file from a DOS shell or normal Windows command shell rather than from the Visual Studio Developer Command Prompt window.
error in tcp bind 10060
SQLConnect() - SQL ERROR: [-20212] - [FairCom][ODBC FairCom Driver 11.8.0.419(Build-200402)][ctreeSQL] -20212 Error in Network Daemon
The most common cause of this error is that the FairCom Database Engine is not running on your machine. Remember that the c-tree evaluation license times out after 3 hours, so the server might have exited and needs to be re-started. See Starting the FairCom Database Engine.
SQLConnect() - SQL ERROR: [0] - [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
This error is caused by the FairCom ODBC Driver not being installed. See Configuring the ODBC Data Source for how to install this driver.
SQLConnect() - SQL ERROR: [0] - [Microsoft][ODBC Driver Manager] The specified DSN contains an architecture mismatch between the Driver and Application
This error is caused by launching the Visual Studio Developer Command Prompt with the wrong bit depth (32 vs 64 bits). Please refer to the top of this section for instructions on launching the correct Developer Command Prompt window.