First of all, one needs to enable Script Execution on the PC. In order to do so, follow these steps:
- Start Windows PowerShell as Administrator
- Run this script and answer 'Y': Set-ExecutionPolicy RemoteSigned
- Ready to go.
Steps to test Connection String:
- Open "Test_Connection_String.ps1" and edit following items:
- $ConnectionString: the Connection String to be tested.
- Password needs to be provided as clear text. Also the entire string needs to be inside a pair of double quotes("").
- For generating Connection String externally, please refer to article How to generate Connection String without using QlikView.
- Example: $ConnectionString = "Provider=OraOLEDB.Oracle.1;Persist Security Info=False;User ID=hr;password=hr;Data Source=oraclexe"
- $SQLquery: the SQL query to be tested.
- The entire SQL query needs to be inside a pair of double quotes("").
- Example: $SQLquery = "select * from employees"
- Save the file.
- In Windows PowerShell, navigate to the folder that contains Test_Connection_String.ps1, and run it using command: .\Test_Connection_String.ps1
- Verify there is no error generated.
- Open "out.csv" in the same folder and verify the result.