Sqitch Snowflake using key-pair authentication - snowflake-cloud-data-platform

I have installed Sqitch on a Windows 10 PC using Strawberry Perl. My Snowflake environment has key-pair authentication set up.
My sqitch.conf file has a target set up with the uri.
I am following the Sqitch tutorial and am just trying to create a schema in a DB
When I run this command: c:\Projects\Sqitch\flipr>sqitch deploy
It shows this output:
Adding registry tables to db:snowflake://xxx#xxx.eu-west-1.snowflakecomputing.com/flipr?Driver=SnowflakeDSIIDriver;authenticator=SNOWFLAKE_JWT;priv_key_file=/xxx/rsa_key.p8;priv_key_file_pwd=xxx;warehouse=xxx;uid=xxx
(xxx obviously masks any sensitive values)
It then just sits there doing nothing. I've left it for at least 30 mins so it's definitely not going to complete. If I kill it (ctrl+C) then it shows this - which implies that snowsql is running but it is either not executing properly or not shutting down properly and returning control to Sqitch:
Aborted!
"C:\Program Files\Snowflake SnowSQL\snowsql.exe" unexpectedly returned exit value 1
Does anyone have any idea what the problem is?

Fixed by amending the ODBC - server needed the full URL (including .snowflakecomputing.com) and I just had the account/region

Related

SSIS Project Failing When Running As SQL Server Agent Job

I have designed a SSIS project and deployed it to SQL server and also created the job to run on daily basis but its giving me this error when executing this as job (doesnt give any error within VS):
There is this CLSid in this error message but there is no application associated to it in
--> Component Services -> Computers -> My Computer -> DCOM Config
But this CLSid is registered inside registry editor
About this particular task on which this error is occurring: This is a script task which is modifying and deleting the un-wanted rows from the excel file in which I am trying to write SQL table data.
Script task code looks like this:
I have been working for hours now trying to fix this problem but no success. Kindly guide me how can I fix this issue. If any other information is required related to this project, please let me know....
Doing Excel automation in a SQL Server agent job is totally unsupported and probably won't work.
To have even a ghost of a chance of making this work you'll need to run a real desktop session on the server and automate Excel in that. Excel expects a real user to be logged in with a full profile. And Excel has failure conditions where it displays a popup window, which you'll need to be able to access via remote desktop.
You can read and write Excel files on a server with the OpenXML SDK, without actually having to run Excel. There's also a wrapper library called ClosedXML which you may find easier to use than using OpenXML directly.
tl;dr;
You need to install Office (Excel) on the server AND ensure that you install it in a manner that mirrors the SQL Agent's expected bit-edness. Default for Agent is going to be 64bit, default for Office is still 32 :(
Error guessing
You have a script task that uses the Office interop libraries to delete some rows (2 through 11?) out of a spreadsheet.
You have Office installed on your machine and therefore you have the libraries installed. Excel still has COM based "stuff" in it, thus the interop and errors shrieking about the CLSid, registry, etc but that's likely just secondary errors because there is no base "application is not installed" exception to be thrown.
If Office is installed, then ensure your agent execution model matches the version of Office. If 32 bit Excel is already installed, don't potentially break everyone else's stuff by uninstalling and reinstalling as 64 bit, just got the Advanced section of the SQL Agent Job Step and check the 32bit box.
Once all that's done, then if you're still getting errors but new ones, then the existing comments mentioning permissions may come into play - it depends on where the Excel document actually exists (on the computer where SQL agent can access vs on the computer where it cannot vs networked drive)
Good luck in not finding people on the sanctions lists.

SSIS "Execute Process" Exit Code 253

General issue (lots of questions on this already):
I have an SSIS package that works from Visual Studio, but it fails from SQL Agent.
Specific Failure Point
Task: Execute Process
Executable invoked: aws cli
Error message: The process exit code was "253" while the expected was "0".
Things I've tried
Checked permissions on the executable and destination folder. They have execute and read/write permissions (respectively) for the SQL Agent user.
Looked up exit code 253; I haven't found any documentation on it.
Stripped away everything but the "Execute Process" task invoking AWS CLI. Still get error 253.
Multiple AWS CLI Commands (s3api get-object, s3 ls). Still get error 253.
Conclusion
My main question is: what is exit code 253?
Thanks to #Dan Guzman for pointing me to the documentation on exit code 253.
Exit code 253
Essentially, AWS CLI configuration isn't right.
The system environment or configuration was invalid. While the command provided may be syntactically valid, missing configuration or credentials prevented the command from running.
Why this code was returned
Visual Studio executes as User A (my account), while SQL Agent executes as User B (whatever user it's configured with).
I set up the AWS CLI on my account, but that wasn't enough. I need to configure it for Account B as well.
CLI config details are stored in each user's home directory (~/.aws/config, ~/.aws/credentials). I can navigate to User B's home directory and set up config details there.

How to connect to oracle database using VBScript and UFT?

It seems the question on how to connect to oracle database from UFT/VBscript is asked on multiple forums. In most places, there are answers in bits and pieces, without any one detailed answer that helps user get this information.
I spent close to 6 days to get this working and thus I feel its worth to share all the detailed steps here. The main reason I found this for going wrong is a wrong combination of one or more of below:
Using the wrong driver.
Using the wrong connection string.
Using the wrong terminal to test the code (i.e. 64 bit to test working for a 32 bit UFT)
When any one of the above is wrong, we get a range of errors depending on which driver, connection string and terminal we are using. I encountered:
Provider cannot be found. It may not be properly installed (when using Microsoft ODBC for Oracle)
The 'OraOLEDB.Oracle.1' provider is not registered on the local machine (when tried using oraOLEDB driver)
Catastrophic failure. (when running a working script on 64-bit terminal)
Hope below answer will give you a step by step answer with references, and code examnples to try out your code and get this up and running for you.
It took me 5 days to get this correctly working and although there is information available on internet, its all scattered and leads to multiple directions, which can be very time consuming and frustrating. So to save you from this frustration and also since test data is very crucial for setting up any meaningful test framework, this section is dedicated to making this properly set up for you. Hopefully, you will not have to face the same frustration that I went through in dealing with this!
To make oracle database connection work in UFT, download a 32-bit driver for your oracle database. To do this:
Go to this page (if your database is 12c - if another database, go to that page), https://www.oracle.com/database/technologies/oracle12c-windows-downloads.html
Scroll down and look for "Oracle Database 12c Release 2 Client (12.2.0.1.0) for Microsoft Windows (32-bit)" - If you are working on oracle 12C
Download the zip file "win32_12201_client.zip"
Extract the file and run "setup.exe" from the folder : Downloads\win32_12201_client\client32
While selecting "What type of installation do you want",
select -> Administrator (1.5GB)
Use windows built in account (3rd option)
Keep default locations for
oracle base -> C:\app\client\yourUserID (no space in between allowed)
software location -> C:\app\client\yourUserID\product\12.2.0\client_2
Save response file for your future reference
Install the product
To test if everything went okay or not, open the ODBC connection for 32 bit
Check in the driver's section, if a driver with name "Oracle in OraClient12Home1_32bit" is installed or not.
Now you can run the vbscript for testing database connection by running it in 32-bit command line mode. (Running it in a terminal on 64 bit machine would give you all sort of errors). To do this on windows,
Type %windir%\SysWoW64\cmd.exe in Start Search box.
Change directory to your script location (say cd c:\Users\yourUserID\UFT\Rusty\FunctionLibrary) - If the script is in dir FunctionLibrary
Now you can run the script by writing cscript in front of it -> cscript database-functions.vbs
You should see values popped up from test script.
Connection string format:
https://www.connectionstrings.com/oracle-in-oraclient11g_home1/ (use standard format from here)
Dim connString: connString = "DRIVER={Oracle in OraClient12Home1_32bit};DBQ=yourHostURL:portNr/DBname;Trusted_Connection=Yes;UID=MyUser;Password=myPassword"
Ex (with dummy values): connString = "DRIVER={Oracle in OraClient12Home1_32bit};DBQ=ab12.mycompany.com:1521/ORAB;Trusted_Connection=Yes;UID=pramod;Password=myPassword"
A script that you can use to test this connection is here.
https://github.com/PramodKumarYadav/Rusty/blob/master/FunctionLibrary/test-data-functions.vbs
Or here: https://hoopercharles.wordpress.com/2009/12/12/simple-vbs-script-to-retrieve-data-from-oracle/
Change the connection string to as mentioned above.
Hope this helps and you can save a lot of time and energy in using oracle connection itself to build tests, than setting this up itself.

Running different versions of postgresql side by side

I have postgresql 9.3 installed.
I would like to have also postgres 9.6.1 installed.
Each application is using a different DB. Most of the times I don't run both applications, so I don't need them to run concurrently.
I downloaded the installer recommended by postgres, and installed 9.6.1, but then it seems that 9.3 is not able to start anymore. I'm getting an error trying to run sudo service postgres start:
Starting PostgreSQL 9.3 database server
The PostgreSQL server failed to start. Please check the log output.
The log file is empty (not sure that's the interesting one) - /var/log/postgresql/postgresql-9.3-main.log
Any idea how to be able to run both instances?
You need to check the postgresql.conf config file.
If you want to run both instances at the same time then they will need to be run on different ports otherwise they will conflict. The default is 5432, change this for one of the DB's.
Then make sure that the data directory, log file are unique for each instance.

print to PDF using xp_cmdshell

We are trying to use TSQL on SQL 2012 and OS 2012 to print PDF file from a specific directory using variables based on a lookup that populates these variables. The command we have works on SQL 2005 and 2003 datacenter OS. During our upgrade this now does not want to work. I am fairly sure we are just dealing with a syntax issue that is OS related but SQL is not saying what is the issue.
Here is the base query --
EXEC master.sys.xp_cmdshell '"C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe /t" \\jde9appb\d$\JDEdwards\E910\PrintQueue\R5509108_TV0001_4970_PDF.pdf \\VMPS08\INF2808P'
The above runs in the OS 2003 and SQL 2005 but when we try it in OS 2012 and SQL 2012 it just spins. We have turned of UAC and verified that the execute user has all the necessary rights to the command shell and command shell is enabled. This has to be done thru a TSQL script since this is part a stored proc that gets called by the custom application. Also the foixut reader is the default application to read PDF files. The switch you see above is the silient mode to print directly to a queue.
Help help. This has been a real tough one to figure out.
I have actually gotten it to say Failure to initialize the printer by messing with the Syntax, but this is as far as I have gone. I even loaded the printer I am going to to make sure the system is trying to use the proper driver.
For some reason the double backslash is not showing correctly. Here is the fixed query that I need some help with please.
EXEC master.sys.xp_cmdshell '"C:\Program Files (x86)\Foxit Software\Foxit Reader\Foxit Reader.exe /t" \\jde9appb\d$\JDEdwards\E910\PrintQueue\R5509108_TV0001_4970_PDF.pdf \\VMPS08\INF2808P'
We faced the exact same issue. We found it was caused by the network printers, though created for the user, not being available to the background process. Creating the printers locally, thus bypassing the print server solved the issue.

Resources