When run the Connect to Oracle Database using jybot getting the error cx_Oracle is not found - robotframework

I tried to run the Query from Oracle Database using jybot option as i have some java custom code, that need in my test script along with query from oracle database.
I got the error cx_Oracle is not found.
When run the same using pybot (removed the java custom code) then i didn't get any errors.
If i run the java custom code alone using jybot then also no errors.
Steps i followed to install Database Library are as follows:
Install Visual C++ Compiler
Download and Install VCForPython27.msi (If not have the executable file, please check Important URLs section for link to download)
Set Environment Variables ORACLE_HOME, TNS_ADMIN if not setup already.
Install Database Library
Open the command prompt and run the following command
pip install robotframework-databaselibrary
Install cx_Oracle
Open the command prompt and run the following command
pip install cx_Oracle
Connect to Oracle Database Code:
Connect To Database Using Custom Params cx_Oracle '${Username}/${Password}#${Host}:${Port}/${DatabaseName}'
#{Numbers} Query SELECT NUMBER_V from MASTER_DB WHERE STATUS_V='F' and ROWNUM <= 10
Log ${Numbers[0]}
Any one, please help me how to run the query from oracle database using jybot.
Thanks
Sarada

cx_Oracle can't be sucessfully used under the jybot
Here is my solution:
Install DatabaseLibrary module by
pip install robotframework-databaselibrary
Install JayDeBeApi module by
pip install JayDeBeApi
now you can put these libraries anywhere you like - just copy them from Python\Lib\site-packages
And here is going the trick!
The DatabaseLibrary usage have following sample for jaydebeapi connection:
Connect To Database Using Custom Params | JayDeBeApi | 'oracle.jdbc.driver.OracleDriver', 'my_db_test', 'system', 's3cr3t'
However this is wrong! You have to use the brackets over the username-pass pair! Like this:
Connect To Database Using Custom Params | JayDeBeApi | 'oracle.jdbc.driver.OracleDriver', 'my_db_test', ['system', 's3cr3t']
And please do not forget to use URL connection instead of my_db_test! It should be like this:
jdbc:oracle:thin:#//127.0.0.1:1521/my_db_test
Regards

Related

Installing the windows patch using PSWindowsUpdate

I am trying to install windows updates using PSWindowsUpdate module in powershell as:
Get-WindowsUpdate -Install -KBArticle 'KB4560960' and hit enter key but i am not getting any response. Then for confirmation whether the update has been installed or not i used Get-Hotfix command in powershell then it has displayed a list in that list the above update is not their. How to install the specific update using PSWindowsUpdate module in powershell.
After you install the module and then import it you can run the following command:
PS C:\Install-WindowsUpdate -MicrosoftUpdate -KBArticleID KB4560960 -AcceptAll -IgnoreReboot
It will show the progress of the install or you can type at the PS prompt.
Get-WUHistory. Keep in mind, you can't install updates with PSWindowsUpdates on remote boxes directly. Will have to use a Task Scheduler—which, in combination with Windows Admin Center, works beautifully.

Lambda function failing with /lib64/libc.so.6: version `GLIBC_2.18' not found

I am trying to create a layer of simple-salesforce (Python Library) in AWS lambda, and trying to use it (import it) from my python code. I am having windows machine.
Though I read that there might be issues due to compilation windows so I install ubuntu1804 from windows store and then went ahead with creating zip for lambda layers. (zip is created for python folder with structure "python/lib/python3.6/site-packages/......")
I am using Python 3.6. I went through few articles for this issue but could find any resolution. this Video helped me creating a layer for Pandas & requests in AWS successfully with minor tweaks in pip commands I used
sudo python3 -m pip install simple-salesforce -t build/python/lib/python3.6/site-packages
Exactly same process i used for Simple salesforce and I am getting below error is as below:
Unable to import module 'lambda_function': /lib64/libc.so.6: version `GLIBC_2.18' not found (required by /opt/python/lib/python3.6/site-packages/cryptography/hazmat/bindings/_rust.abi3.so)
Edit: --
Another approach I tried using .whl though this was not giving above error but giving error as "request module not found" and when I add request module layer it gives error authlib not found. (request layers work fine if I comment salesforce related things. Even tried uploading as simple layer same authlib issue I got)
Edit :
Lambda code I am using is as below
the code I am using is basic code which doesnt have any logic with empty imports
import json
import pandas as pd
import requests as req
from simple_salesforce.format import format_soql
def lambda_handler(event, context):
#TODO
I also received the same error while installing pysftp on lambda which uses cryptography library(python)
the error was similiar to (required by /opt/python/lib/python3.6/site-packages/cryptography/hazmat/bindings/_rust.abi3.so)
The solution that worked for me is
1] pip uninstall cryptography
2] pip install cryptography==3.4.8
The following github link explains it in detail
https://github.com/pyca/cryptography/issues/6390
AWS lambda functions are like virtual environments, they do not come with the .so files which are kernel level packages. When installing the python packages you have to make sure the system dependent files are installed with it. This can be achieved by passing the argument --platform to pip install.
From AWS post How do I add Python packages with compiled binaries to my deployment package and make the package compatible with Lambda?:
To create a Lambda deployment package or layer that's compatible with Lambda Python runtimes when using pip outside of Linux operating system, run the pip install command with manylinux2014 as the value for the --platform parameter.
pip install \
--platform manylinux2014_x86_64 \
--target=my-lambda-function \
--implementation cp \
--python 3.9 \
--only-binary=:all: --upgrade \
simple-salesforce
I changed my code to not use simple_salesforce library and work out all the logic with Requests ( using Salesforce REST APIs).
This is not really ideal but I could get it working as I had some deliveries to meet.

Installing Python modules

I am trying to install the pyperclip module for Python 3.6 on Windows (32 bit). I have looked at various documentations (Python documentation, pypi.python.org and online courses) and they all said the same thing.
1) Install and update pip
I downloaded get-pip.py from python.org and it ran immediately, so pip should be updated.
2) Use the command python -m pip install SomePackage
Okay here is where I'm having issues. Everywhere says to run this in the command line, or doesn't specify a place to run it.
I ran this in the command prompt: python -m pip install pyperclip. But I got the error message "'python' is not recognized as an internal or external command, operable program or batch file.
If I run it in Python 3.6, it says pip is an invalid syntax. Running it in IDLE gives me the same message.
I have no idea where else to run it. I have the pyperclip module in my python folder. It looks like a really simple problem, but I have been stuck on this for ages!
You need to add the location of the python.exe to your $PATH variable. This depends on your installation location. In my case it is C:\Anaconda3. The default is C:\Python as far as I know.
To edit your path variable you can do the following thing. Go to your Control Panel then search for system. You should see something like: "Edit the system environment variables". Click on this and then click on environment variables in the panel that opened. There you have a list of system variables. You should now look for the Path variable. Now click edit and add the Python path at the end. Make sure that you added a semicolon before adding the path to not mess with your previous configuration.

How to execute OLEload script from cmd

I had builded .amj script from Teradata OLELoad GUI which connects to access and load data
to Teradata ?
I was able to successfully run the script using OLELoad GUI Utility.
Is there a way to run .amj file from command prompt ?
Thanks.
When you launch the script with OLELoad you have to use a TTU as Fastload, Bteq or whatever. You can do the same from the command line. You just have to call the TTU you choose (for example Fastload) with your script in the parameter section.
Example:
Bteq.exe < Your_script.txt
You mention that you are using an amj file. That file must be referred into your script.
You should be able to reference the .AMJ file as part of an INMOD on some of the Teradata Utilities. Refer to the Teradata Tools and Utilities Manual for the Teradata OLE DB Access Module here for examples.

SQL Chiper command line

Can anybody advice me what I need to do in order to open ciphered (http://sqlcipher.net/) database in command line.
When I try to do something with it like watch schema it response with following message
sqlite> .schema
Error: file is encrypted or is not a database
I know password for db, I just want to figure out steps how to correctly open it. My OS is Ubuntu 11.10
Finally I managed to do that, in case if somebody need it, here is my steps:
I've started from http://sqlcipher.net/introduction/ & downloaded sqlcipher.
The first problem was for me that I was unable to configure and build it from source because I have no libcrypto.a which is part of openssl crypto libraries.
I've installed it apt-get install libssl-dev
Then I successfully configured sqlcipher running
$./configure --enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC" LDFLAGS="-lcrypto"
$make
after that executable sqlite3 file was created and I was able to open ciphered database.
To provide a password you should execute following statement.
PRAGMA key='password'

Resources