Pyodbc Azure sql database - azure-sql-database

I am using a macOs BigSur, and I would like to use python to connect to azure sql database.
I followed Microsoft documentation:
https://learn.microsoft.com/en-us/python/api/overview/azure/sql?view=azure-python
to set all the configuration and installed all the requirement for the Mac OS following this documentation.
https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver15
but when I run my python script I get this error:
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password)
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 17 for SQL Server' : file not found (0) (SQLDriverConnect)")
I install mssql-tools and unixodbc
and if I run the command odbcinst -j
I get back this output:
unixODBC 2.3.9
DRIVERS............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /Users/<my-user>/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size........: 8
SQLSETPOSIROW Size.: 8
Anyone has a clue about this error? and please if you need more infos just ask me. Thank you so much
EDIT:
Following the documentation, Microsoft suggests to make a sim link out of the odic.ini and odbcinst.ini.
I run the code to create those symlinks but I realised that if I try to open those files, they are empty, and if I try to go to the folder and open them manually rather than with terminal, I get the error that it can't be done because the source doesn't exist.
Did anyone ever occurred in this error?
LATEST UPDATE:
I installed FreeTDS and updated my .odbc.ini with the following configuration:
[my_server]
Description = my_server
TDS_Version = 7.4
Driver = /usr/local/lib/libtdsodbc.so
Server = YOUR.SERVERNAME.HERE.com
Port = 1433
When I run my python script to connect to the database, I get the following Traceback:
Traceback (most recent call last):
File "database.py", line 11, in <module>
cnxn = pyodbc.connect('dsn=my_server;'
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/usr/local/lib/libtdsodbc.so' : file not found (0) (SQLDriverConnect)")
And in fact there is no libtdsodbc.so in that location.
In another topic they suggest to install freeTDS with the flag --with-unixodbc but when I try to do so, I get the error that the command doesn't exist

UPDATE
If your macos is on the x64 architecture, you can use below method to solve issues.
If you use M1, it's not support now.
Solution for x64 architecture.
Run below code, it should useful to you.
brew update
brew install unixodbc
brew install FreeTDS
Then update the .odbc.ini file.
For more details, please refer below blogs.
How to set up ODBC in Mac OS to connect to MS SQL Server for use with Python and R

Starting ODBC version 17.8, Apple M1 is supported.
You can install ODBC 18 on macOS with the following commands:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew tap microsoft/mssql-release https://github.com/Microsoft/homebrew-mssql-release
brew update
HOMEBREW_NO_ENV_FILTERING=1 ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18

Related

How can I solve this problem of installation xampp on fedora?

When I run xampp on fedora this error is showing up on application log
Starting Apache Web Server...
Exit code: 8
Stdout:
apache config test fails, aborting
Stderr:
httpd: Syntax error on line 522 of /opt/lampp/etc/httpd.conf: Syntax error on line 10 of /opt/lampp/etc/extra/httpd-xampp.conf: Cannot load modules/libphp7.so into server: libnsl.so.1: cannot open shared object file: No such file or directory
can anyone tell me how can I solve this?
it seems you're missing libnsl. install it through this command:
sudo dnf install libnsl
In case this doesn't work you can then download it manually:
Visit https://pkgs.org/
In the search box (pkgs.org of course) type libnsl.so.1 and choose the appropriate OS. The version shown might be higher e.g libnsl-2.28-9.fc29.x86_64.rpm, but it doesn't matter, the file needed is also included in this very package.
In the terminal, navigate to the directory where the .rpm was downloaded.
Type the following command to install it:
sudo rpm libnsl-2.XX-X.fc29.x86_64.rpm
Upon completion everything should be working fine.
A quick Google search returns this: https://www.reddit.com/r/Fedora/comments/8hlhlv/xampp_with_fedora_28/
The suggested fix is installing libnsl from this source:
https://www.rpmfind.net/linux/rpm2html/search.php?query=libnsl.so.1%28%29%2864bit%29&submit=Search+...&system=fedora&arch=

QXcbConnection: XCB error: 145 (Unknown) Error message starting Spyder with MobaXTerm Qt5

I'm seeing the following error message when starting Spyder over a remote connection through MobaXTerm:
$ spyder
QXcbConnection: XCB error: 145 (Unknown), sequence: 171, resource id: 0, major code: 139 (Unknown), minor code: 20
Spyder still appears to work normally, but the error message pops up every time. A search on this error blames Qt5 and says there's no fix for X11 connections. I'm using Python 3.5.4, Spyder 3.2.3, and MobaXTerm Personal Edition v10.7 Build 3650 connecting to a system running RHEL 6.6.
How can I avoid the error message?
After trying the methods I could find on various websites:
conda install pyopengl on the base python installation
Adding both from OpenGL import GL and import ctypes; ctypes.CDLL("libGL.so.1", mode=ctypes.RTLD_GLOBAL) to site-packages/spyder/app/start.py
various Qt environment variable settings
EDIT:
I was finally able to stop the error messages by disabling only the "RANDR" MobaXTerm X11 extension:
Interestingly, the MobaXTerm documentation also has this extension disabled in the settings screenshots.
I ran into a similar issue when running rviz for ros2 from the Windows 10 WSL2 Ubuntu 20.10 Terminal with the command:
ros2 launch turtlebot3_bringup rviz2.launch.py
I tried unchecking the RANDR extension in MobaXterm to no effect. I was finally able to resolve the issue and launch rviz after issuing the following command:
export LIBGL_ALWAYS_INDIRECT=0
and then re-issuing the ros2 launch command above.

Installing Tensorflow GPU/CUDA dependencies on a machine with no internet access

I have 2 machines -
dccten1a with no internet access where I need to install Tensorflow with GPU support
dccten1b with internet access so that I can download packages and transfer to dccten1a
In the final step of installing Tensorflow, when running the bazel build command to produce a whl file, I get an error which says that it can't find a file in a folder it is looking in, and also cannot download, obviously, as 1a doesn't have internet access.
bazel build --config=opt --config=cuda /home/tensorflow/Documents/tf_dependencies/tensorflow-master/tensorflow/tools/pip_package:build_pip_package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0"
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '#io_bazel_rules_closure//closure': Error downloading [http://bazel-mirror.storage.googleapis.com/github.com/bazelbuild/rules_closure/archive/5ca1dab6df9ad02050f7ba4e816407f88690cf7d.tar.gz, https://github.com/bazelbuild/rules_closure/archive/5ca1dab6df9ad02050f7ba4e816407f88690cf7d.tar.gz] to /home/xyzuser/.cache/bazel/_bazel_xyzuser/cb1e63cb5e61cab49a9fd2f5ba92d003/external/io_bazel_rules_closure/5ca1dab6df9ad02050f7ba4e816407f88690cf7d.tar.gz: All mirrors are down: [Unknown host: github.com, Unknown host: mirror.bazel.build]
I checked in the system, and there is no such directory as shown in the error message (i.e., /home/xyzuser/.cache/bazel/_bazel_xyzuser/cb1e63cb5e61cab49a9fd2f5ba92d003/external/io_bazel_rules_closure/). So, I created it, searched and found the requisite (?) file online, downloaded the file in the machine with internet, transferred it to the target machine, moved the file to the just created directory, and tried running the command again:
(tensorflow#dccten1a):
mkdir -p /home/tensorflow/.cache/bazel/_bazel_tensorflow/cb1e63cb5e61cab49a9fd2f5ba92d003/external/io_bazel_rules_closure
(tensorflow#dccten1b):
http://bazel-mirror.storage.googleapis.com/github.com/bazelbuild/rules_closure/archive/5ca1dab6df9ad02050f7ba4e816407f88690cf7d.tar.gz
sudo scp -r /home/tensorflow/Downloads/5ca1dab6df9ad02050f7ba4e816407f88690cf7d.tar.gz tensorflow#160.88.114.17:/home/tensorflow/Documents/tf_dependencies
(tensorflow#dccten1a):
mv /home/tensorflow/Documents/tf_dependencies/5ca1dab6df9ad02050f7ba4e816407f88690cf7d.tar.gz /home/tensorflow/.cache/bazel/_bazel_tensorflow/cb1e63cb5e61cab49a9fd2f5ba92d003/external/io_bazel_rules_closure
Then I run the bazel build command again, but the same error persists.
Use --experimental_repository_cache to download the dependencies on the machine with internet access, transfer the cache to the machine without internet access, and use --experimental_repository_cache to refer to the same cache.
e.g.
1) On the machine with internet access, run
tensorflow#dccten1b $ bazel build --experimental_repository_cache=/path/to/some/folder --config=opt --config=cuda /home/tensorflow/Documents/tf_dependencies/tensorflow-master/tensorflow/tools/pip_package:build_pip_package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0""
2) Copy the cache at /path/to/some/folder to the machine without internet access using a SD card or flash drive.
3) On the machine without internet access, run the same command again and setting the flag to the cache's location.
tensorflow#dccten1a $ bazel build --experimental_repository_cache=/path/to/some/folder --config=opt --config=cuda /home/tensorflow/Documents/tf_dependencies/tensorflow-master/tensorflow/tools/pip_package:build_pip_package --cxxopt="-D_GLIBCXX_USE_CXX11_ABI=0""

Trafodion installation ERROR: Error while running traf_start

I am trying to install trafodion on Hortonworks 2.2 virtual machine.The following are the machine configurations.
Hotonwork 2.2 virual machine
HBase version 0.98.
Centos version.
I have tried following steps to install trafodion.
1) I have downloaded
log4c++ RPM
Trafodion Installer
Trafodion Server
2)mkdir $HOME/trafodion
mkdir $HOME/trafodion/downloads
cd $HOME/trafodion/downloads
3) yum install to install the log4c++ RPM
4)cd $HOME/trafodion/downloads
tar -zxf apache-trafodion-installer-1.3.0-incubating-bin.tar.gz -C $HOME/trafodion
5)cd $HOME/trafodion/installer
cp trafodion_config_default my_config and Edit Configuration File.
6)cd $HOME/trafodion/installer
./trafodion_install --accept_license --config_file my_config
When running installation I obtain following message.
home/trafodion/traf
****INFO: Copying over sqenvcom.sh
***INFO: untarring build file /usr/lib/trafodion/apache-trafodion-1.3.0-incubating-bin/trafodion_server-1.3.0.tgz to home/trafodion/traf
***ERROR: SQ config file cannot be found (home/trafodion/traf/sql/scripts/sqconfig).
***ERROR: Error while running traf_start.
***ERROR: Setup not complete, review logs.
***ERROR: Exiting....
I don't understand why is it saying that. I have defined all configurations in myconfig file.
Any help is appreciated.
See also the discussion on the Trafodion dev mailing list on Apr. 21. Here is the answer Amanda gave on that list:
Amanda Moran via trafodion.incubator.apache.org Apr 22 (4 days ago)
to dev Hi there Devidas-
If you are on a single node instance SQCONFIG should equal "". This
will signal the installer to go grab our standard file located in
$SQ_ROOT/sql/scripts.
Thanks!
Amanda

Running test with "usbtest" on Ubuntu

i am newbie to these modules and device drivers and all.I would like run some sample tests on ubuntu main tree USB driver. I have seen this document and was trying to do the same.I do inserted the "usbtest" module and while trying to run
usbtest
command, terminal says the command not found
I have tried to insert g_zero module by running
modprobe g_zero
,but it says
modprobe: ERROR: could not insert 'g_zero': No such device
and
modprobe --force g_zero says
modprobe: ERROR: could not insert 'g_zero': Exec format error
Anyone Please post better simple explanation..
I'm using Ubuntu 14.04.3 LTS and my kernel is 3.13.0-24-generic
Also please suggest any method to test linux main tree drivers through command line.