Connection strings are required to specify the connection information for the source and target databases in SQLines Data tool.
Connection strings can be specified using the -sd and -td command line options. For more information, see SQLines Data Command Line Reference.
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.
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 |
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 |
If you need to connect to Oracle with the user SYS, just specify SYS in the user name field. SQLines Data will automatically assign role (mode) SYSDBA for the user.
oracle, sys/system@192.168.2.74:1521/orcl11 |
See also Configure and Troubleshoot Connection to Oracle - (Oracle Call Interface - OCI)
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).
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 |
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
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 |
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
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)
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)
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
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)
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 |
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 |
SQLines Data allows you to connect to any ODBC data source.
To connect to a ODBC data source, you can specify user name, password and ODBC DSN name in the following syntax:
odbc, user/password@dsn |
SQLines allows you to write output data to standard output:
./sqldata -sd=oraclescott/tiger@orcl -td=stdout > export.txt |
You can use this option to generate plain text files for extracts from tables or query results, and then use various COPY or IMPORT commands supported by databases to import the data.