Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Niru
Contributor II

connection string

Hi all,

could some one help me i want to know about connection string

how can we implement in qlikview connection string

please give me some idea about connection string

Thanks IN Advance

Niranjan

3 Replies
MVP
MVP

Re: connection string

I am not sure what you are looking for in detail, and I think you know how to query the Help file, in case you don't:

Connect

A general database can be accessed through the OLE DB/ODBC interface. For ODBC, the data source first needs to be specified using the ODBC administrator (see Windows Control Panel). Which database to use is in QlikView defined through the CONNECT statement. The syntax is:

ODBC CONNECT TO connect-string [ ( access_info ) ]

OLEDB CONNECT TO connect-string [ ( access_info ) ]

CUSTOM CONNECT TO connect-string

where:

connect-string ::= datasourcename { ; conn-spec-item }

The connection string is the data source name and an optional list of one or more connection specification items. If the data source name contains blanks, or if any connection specification items are listed, the connection string must be enclosed by Quotation Marks in Scripting.

datasourcename must be a defined ODBC data source or a string that defines an OLE DB provider.

conn-spec-item ::=DBQ=database_specifier | DriverID=driver_specifier | UID=userid | PWD=password

The possible connection specification items may differ between different databases. For some databases, also other items than the above are possible. For OLE DB, some of the connection specific items are mandatory and not optional.

access_info ::= access_item { , access_item }

access_item ::= ( userid is userid | xuserid isscrambledusername ) | (password is password |xpassword isscrambledpassword) | codepage is codepageID | mode iswrite

codepageID ::= ansi|oem|unicode| codepagenumber

If the connect statement is generated by the provided wizard any user ID and password will be generated with the scrambled xuserid is / xpassword is syntax, provided that Scramble Connect User Credentials is checked in User Preferences. The non-scrambled userid is / password is syntax must be used for providing user Id and password, if typing the connect statement. Full scrambling is currently only available for ODBC connect statements as some parts of the OLEDB connect string cannot be scrambled. Note that the scrambling is not a proper security measure; it is merely an obfuscation of the credentials.

The codepage specifier can be used if problems are encountered with national characters in specific ODBC/OLE DB drivers.

If mode is write is specified in the access_info, the connection will be opened in read-write mode. In all other cases the connection will be opened as read-only.

If the ODBC is placed before CONNECT, the ODBC interface will be used; else, OLE DB will be used.

Example:

ODBC CONNECT TO 'Nwind;

DBQ=C:\Program Files\Access\Samples\Northwind.mdb' (UserID is sa, Password is admin);

The data source defined through this statement is used by subsequent Select (SQL) statements, until a new CONNECT statement is made.

How the connect statement connects to the database, using a 32-bit or 64-bit provider, is determined by what version of QlikView and Windows that are running:

     

Windows

QlikView

Connect statement

Result

64-bit

64-bit

connect

uses a 64-bit ODBC

64-bit

64-bit

connect32

uses a 32-bit ODBC

64-bit

64-bit

connect64

uses a 64-bit ODBC

64-bit

32-bit

connect

uses a 32-bit ODBC

64-bit

32-bit

connect32

uses a 32-bit ODBC

64-bit

32-bit

connect64

uses a 64-bit ODBC

32-bit

32-bit

connect

uses a 32-bit ODBC

32-bit

32-bit

connect32

uses a 32-bit ODBC

32-bit

32-bit

connect64

causes script error

Connect32

This statement is used the same way as the Connect statement, but forces a 64-bit system to use a 32-bit ODBC/OLEDB provider. Not applicable for custom connect.

Connect64

This statement is used the same way as the Connect statement, but forces use of a 64-bit provider. Not applicable for custom connect.

Back to Script Statements and Keywords.

QlikView 11.20 SR3, 12018

salto
Valued Contributor II

Re: connection string

Hello,

the connection string depends on the origin of the data you wish to read.It will be different depending on the source: a SQL server, an MS Access database, an Excel file...

For example, if you need to open a SQL server, go to the script edit (Ctrl + E). At the bottom of the script tab you will find "Data". Select "OLE DB". Click connect.

Select SQL Server as the provider.

Then enter the server name and database. Qlik will the create the connection string in the script.

Hope this helps.

Niru
Contributor II

Re: connection string

Thank you both really its help full answers

Community Browser