SAP IQ (formerly known as SAP Sybase IQ or Sybase IQ) is a high-performance relational database designed specifically for data warehousing. This cross-platform product runs on several popular UNIX, Linux, and Windows platforms.
SAP IQ can integrate data from diverse sources, not just IQ databases, but other databases in the Adaptive Server family, as well as non-Sybase databases and flat files.
This blog shows how to access SQL Server data from SAP IQ running on the Windows platform.
CREATE DATABASE mydb
USE mydb
CREATE TABLE persons
(
personid INT,
lastname VARCHAR(255),
firstname VARCHAR(255),
address VARCHAR(255),
city VARCHAR(255)
);
INSERT INTO persons
VALUES (1,
'Name',
'My',
'MyAddress',
'MyCity')
For installation instructions, refer to the SQL Server ODBC driver documentation.
An ODBC data source stores the connection details for the target database (in this case, SQL Server) and the ODBC driver that is required to connect to it (in this case, the SQL Server ODBC driver).
You configure ODBC data sources in ODBC Data Source Administrator, which is included with Windows. There are two versions of ODBC Data Source Administrator included with Windows, one is 32-bit and one is 64-bit. As SAP IQ is a 64-bit application, you need to use the 64-bit version of ODBC Data Source Administrator. To start the 64-bit ODBC Data Source Administrator, in the Windows Run dialog box, enter:
odbcad32.exe
For instructions on configuring data sources, refer to the SQL Server ODBC driver documentation.
SAPIQDIR\SYBASE.bat
and SAPIQDIR\SYBASE.ENV
.start_iq
is located to your PATH
, so that the sample database creation script can run this command. For example:
set PATH=C:\SAPIQ\IQ-16_1\Bin64;%PATH%
set IQ16LOGDIR = C:\Temp
mkiqdemo.bat
. You need to set a database user name and password by including the -dba
and -pwd
arguments. For example:
cd C:\ProgramData\SAPIQ\demo mkiqdemo.bat -dba myuser -pwd mypassword
start_iq @iqdemo.cfg iqdemo.db
dbisql
, the SAP IQ interactive SQL utility, to connect to the sample database. For example:
dbisql -nogui -c "UID=myuser;PWD=mypassword;DATABASE=iqdemo"
You need to specify your Windows or SQL Server login in remote server connection string. Otherwise, SAP IQ passes your sample database user name and password to the SQL Server ODBC driver.
For example:
CREATE SERVER easysoft CLASS 'ODBC' USING 'DSN=MYDSN;UID=mydomain\mywindowsuser;PWD=mywindowspassword'
remoteserver.database.schema.object
For the sample SQL Server table we created earlier, the CREATE EXISTING TABLE
statement would be:
CREATE EXISTING TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
) AT 'easysoft.mydb.dbo.Persons'
SELECT * FROM Persons;