SQLines Data Connection String Formats

Connection to Oracle using OCI

SQLines Data connects to Oracle using Oracle Call Interface (OCI).

To connect to Oracle, you can specify either an alias defined in the local tnsnames.ora file, or you can specify host, port and service name.

Note: When you use Oracle Instant Client you have to use TNS_ADMIN environment variable to specify the location of tnsnames.ora file. It may be more convenient to use Easy Connect connection string that does not require tnsnames.ora. See below how to connect to Oracle using host (IP), port and service name.

Connect to Oracle using TNSNAMES.ORA

tnsnames.ora file is located on the Oracle client (%ORACLE_HOME%\network\ADMIN\tnsnames.ora) and defines aliases to access Oracle databases.

For example, the following tnsnames.ora file entry defines ORCL alias and the connection information for an Oracle instance:

  ORCL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.74)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL11)
    )
  )

Then you can use the following connection string to access this Oracle database:

oracle, scott/tiger@orcl

Connect to Oracle using Host, Port and Service Name

You can connect to Oracle without configuring connection information in tnsnames.ora file. You can specify the server host, port, and service name as follows:

oracle, scott/tiger@192.168.2.74:1521/orcl11

See also Configure and Troubleshoot Connection to Oracle - (Oracle Call Interface - OCI)

Connection to SQL Server using SQL Server ODBC Driver or Native Client

SQLines Data connects to SQL Server using SQL Server ODBC Driver (since SQL Server 2022) or SQL Server Native Client (deprecated since SQL Server 2022).

Connect to SQL Server using SQL Server Authentication

You can connect to SQL Server using SQL Server login and password. You also have to specify the server address, instance and database name:

Use the following syntax to connect to SQL Server:

sql, user/password@server[\instance][:port][,database]

For example, to connect to the SQL Server database hr located at the srv1 (default instance), use:

sql, sa/sa_pwd@srv1,hr

Connect to SQL Server using Windows Authentication

When you use Windows authentication (trusted connection), you only have to specify the server address, instance and database name to connect to SQL Server:

Use the following syntax to connect to SQL Server using trusted connection:

sql, trusted@server[\instance][:port][,database]

For example, to connect to the SQL Server database hr located at the srv1 (default instance), use:

sql, trusted@srv1,hr

See also Configure and Troubleshoot Connection to SQL Server

Connection to IBM DB2 using DB2 CLI

SQLines Data uses the DB2 CLI driver to connect to a DB2 database.

To connect to a DB2 database, you can specify user name, password and database name (alias) in the following syntax:

db2, user/password@database

For example, to connect to the DB2 database hr, use:

db2, db2user/db2user_pwd@hr

To connect to DB2 using your current OS account, you can use the following syntax:

db2, @database

See also Configure and Troubleshoot Connection to IBM DB2

Connection to IBM DB2 using ODBC

SQLines Data can also use the DB2 ODBC driver to connect to a DB2 database. Typically it is required to access IBM iSeries DB2 (AS/400) system.

To connect to a DB2 database, you can specify user name, password and ODBC datasource name in the following syntax:

odbc, user/password@odbc_dsn

For example, to connect to the DB2 ODBC datasource name hr, use:

odbc, db2user/db2user_pwd@hr

See also Configure and Troubleshoot ODBC Connection to IBM DB2

Connection to MariaDB using MariaDB C API

SQLines Data uses the MariaDB C API to connect to a MariaDB database.

To connect to a MariaDB database, you can specify user name, password, server host, port and database name in the following syntax:

mariadb, user/password@server[:port],database

For example, to connect to the MariaDB database hr located at the srv1 (default port), use:

mariadb, myuser/myuser_pwd@srv1,hr

To connect to hr database located on the local host using the default user name and password you can use:

mariadb, @localhost,hr

or

mariadb, @,hr

See also Configure and Troubleshoot Connection to MariaDB - libmariadb (MariaDB Connector C)

Connection to MySQL using MySQL C API

SQLines Data uses the MySQL C API to connect to a MySQL database.

To connect to a MySQL database, you can specify user name, password, server host, port and database name in the following syntax:

mysql, user/password@server[:port],database

For example, to connect to the MySQL database hr located at the srv1 (default port), use:

mysql, myuser/myuser_pwd@srv1,hr

To connect to hr database located on the local host using the default user name and password you can use:

mysql, @localhost,hr

or

mysql, @,hr

See also Configure and Troubleshoot Connection to MySQL - libmysqlclient (C API for MySQL)

Connection to PostgreSQL using libpq C Library

SQLines Data uses the PostgreSQL libpq C Library to connect to a PostgreSQL database.

To connect to a PostgreSQL database, you can specify user name, password, server host, port and database name in the following syntax:

pg, user/password@server[:port],database

For example, to connect to the PostgreSQL database hr located at the srv1 (default port), use:

pg, pguser/pguser_pwd@srv1,hr

See also Configure and Troubleshoot Connection to PostgreSQL - libpq C Library

Connection to Sybase using Client Library/C

SQLines Data uses the Client Library/C (CT-Lib) to connect to a Sybase Adaptive Server Enterprise (ASE) database.

To connect to a Sybase ASE database, you can specify user name, password, server and database name in the following syntax:

sybase, user/password@server[:port],database

For example, to connect to the Sybase ASE database hr located at the srv1, use:

sybase, sybuser/sybpwd@srv1,hr

See also Configure and Troubleshoot Connection to Sybase ASE - Client Library/C (CT-Lib)

Connection to Sybase SQL Anywhere using ODBC

SQLines Data uses ODBC to connect to a Sybase SQL Anywhere or Sybase Adaptive Server Anywhere (ASA) database.

To connect to a Sybase ASA database, you can specify user name, password and ODBC DSN name in the following syntax:

asa, user/password@dsn

For example, to connect to the Sybase ASA database source hr, use:

asa, asa_user/asa_pwd@hr

Connection to Informix using Informix ODBC/CLI Driver

SQLines Data uses the Informix ODBC/CLI driver to connect to a Informix Dynamic Server (IDS) database. SQLData links to the driver directly without using the ODBC Driver Manager.

To connect to a Informix database, you can specify user name, password, server and database name in the following syntax:

informix, user/password@server,database

For example, to connect to the Informix database hr located at the ol_srv1 , use:

informix, ifmxuser/ifmxpwd@ol_srv1,hr

See also Configure and Troubleshoot Connection to Informix