connect to FileMaker Server with pyodbc - pyodbc

I have a FileMaker db running on FileMaker Server 14 on a Mac Mini and I'm trying to get at it with pyodbc. It's not going well.
First, what works:
telnet 192.169.19.3 2399
ssh Name#192.169.19.3
tsql -H FM-Server -p 2399 -U Name -P pwd
One weird thing about that last one is that it gives me a seconds counter:
1
2
not a prompt, although I can still type commands in. I'm not sure what that means and couldn't find any info about it.
Now, what doesn't work:
tsql -LH 192.169.19.3
tsql -LH FM-Server
isql FM-Server Name pwd
No listed info for the FileMaker Server, isql gives me [ISQL]ERROR: Could not SQLConnect which is just so helpful you know
One issue is that at this point I've sort of forgotten if I should be using FM ODBC or FreeTDS as my driver in pyodbc, luckily neither of them work:
>>> c = pyodbc.connect("DRIVER={FreeTDS};DSN=FM-Server;UID=Name;PWD=pwd")
pyodbc.Error: ('08001', '[08001] [unixODBC][FreeTDS][SQL Server]Unable to connect to data source (0) (SQLDriverConnect)')
>>> c = pyodbc.connect("DRIVER={FileMaker ODBC};DSN=FM-Server;UID=Name;PWD=pwd")
pyodbc.Error: ('08S01', '[08S01] [unixODBC][FileMaker][FileMaker ODBC] Failed to connect to listener (2) (65535) (SQLDriverConnect)')
Giving it just the DSN freezes the window. Here's my configs:
odbc.ini | /usr/local/Cellar/unixodbc/2.3.4/etc/odbc.ini
[FM-Server]
Driver = FreeTDS
Host = 192.169.19.3
ServerName = FM-Server
UID = Name
PWD = pwd
Port = 2399
odbcinst.ini | /usr/local/Cellar/unixodbc/2.3.4/etc/odbcinst.ini
[ODBC Drivers]
FileMaker ODBC = Installed
FreeTDS = Installed
[FileMaker ODBC]
Driver = /Library/ODBC/FileMaker ODBC.bundle/Contents/MacOS/fmodbc.so
Setup =
[FreeTDS]
Description = FreeTDS
Driver = /usr/local/Cellar/freetds/1.00.9/lib/libtdsodbc.0.so
Setup = /usr/local/Cellar/freetds/1.00.9/lib/libtdsodbc.0.so
UsageCount = 1
freetds.conf | /usr/local/Cellar/freetds/1.00.9/etc/freetds.conf
[FM-Server]
host = 192.169.19.3
port = 2399
tds version = 8.0
Any info is much appreciated and shout to the resources here, here, and elsewhere for helping me get even this far.

I was able to solve this with the following, slightly abbreviated
brew uninstall freeDTS
brew uninstall unixODBC
pip uninstall pyodbc
re-installed pyodbc with ActualTech's installer (not sure if necessary): http://www.actualtech.com/python-osx-odbc.php
switched my odbc.ini to read "Driver=FileMaker ODBC" instead of "Driver=freeTDS" but given the code I actually ran I'm not that that's necessary:
python
import pyodbc
c = pyodbc.connect("DRIVER={FileMaker ODBC};SERVER=192.169.19.3;PORT=2399;UID=Name;PWD=pwd")
and magically that worked. idk man

Related

[DataDirect][ODBC lib] Driver Manager Message file not found. Please check for the value of InstallDir in your odbc.ini in Informatica

I am using informatica, I have Singlestore DB which I am trying to connect.
I am able to login to singelstore DB using Singlestore ODBC Driver as below.
Singlestore version:8.0.5
SS ODBC Driver version: 1.1.1
Singlestore is self managed.
[abc#rnd-2 ~]$ isql SingleStore-server
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> ^C
While I am trying to connect informatica with Singlestore using ODBC Connection, I am gettion error:
Message Code: WRT_8001
Message: Error connecting to database...
WRT_8001 [Session s_test Username dev DB Error -1
[DataDirect][ODBC lib] Driver Manager Message file not found. Please check for the value of InstallDir in your odbc.ini.
Database driver error...
Function Name : Connect
Database driver error...
Function Name : Connect
Database Error: Failed to connect to database using user [dev] and connection string [SingleStore-server].]Message Code: WRT_8001
Message: Error connecting to database...
WRT_8001 [Session s_test Username dev DB Error -1
[DataDirect][ODBC lib] Driver Manager Message file not found. Please check for the value of InstallDir in your odbc.ini.
Database driver error...
Function Name : Connect
Database driver error...
Function Name : Connect
Database Error: Failed to connect to database using user [dev] and connection string [SingleStore-server].]
My location of odbc.ini file: /etc/odbc.ini
odbc.ini
[SingleStore_server]
Description=SingleStore server
Driver=/home/abc/singlestore-connector-odbc-1.1.1-centos7-amd64/libssodbca.so
SERVER=<>
USER=<>
PASSWORD=<>
DATABASE=<>
PORT=<>
I added path in .bash_profile, but still getting same error:
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export ODBCINI=/etc/odbc.ini
Pls let me know how to resolve this error.
Ref link: https://knowledge.informatica.com/s/article/577839?language=en_US
https://knowledge.informatica.com/s/article/Error-connecting-to-database-DataDirect-ODBC-lib-Driver-Manager-Message-file-not-found-Please-check-for-the-value-of-InstallDir-in-your-odbc-ini-while?language=en_US
https://docs.singlestore.com/managed-service/en/developer-resources/connect-with-application-development-tools/connect-with-odbc/the-singlestore-odbc-driver.html
Reg export ODBCINI=/etc/odbc.ini, I have seen Informatica always use their ODBC drivers. Can you please check if you have single store drivers available in /<INFA_HOME>/ODBCX.version/odbc.ini​ file? If yes, i highly recommend to use it.
If yes, please see if you can test the ODBC driver with Infa provided tool $INFA_HOME/tools/debugtools/ssgodbc -d dsn -u username -p password [-v] against your DB. This will ensure you have no issues with ODBC setup.
You can find all about this here link.
If no, then, pls make sure you have installed correct version single store ODBC drivers (32 or 64 bit) and Informatica user have RWX permission on them. Then,
Add the driver path to LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$HOME/server_dir:$ODBCHOME/lib;
set ODBCINI=/etc/odbc.ini
grant access - chmod 777 /etc/odbc.ini
see if the tool ssgodbc is able to establish connection.
Please see the following examples of integrating SingleStore data with Informatica:
JDBC - https://www.cdata.com/kb/tech/singlestore-jdbc-informatica-cloud.rst
ODBC - https://www.cdata.com/kb/tech/singlestore-odbc-informatica.rst

MariaDB Restart Error "unknown variable'default-character-set = cp932'"

I am currently installing MariaDB 10.6 in a Windows 10 64bit environment. Restart MariaDB after writing the following in my.ini:
[mariadbd]
datadir = C: / Program Files / MariaDB 10.6 / data
port = 3306
innodb_buffer_pool_size = 2035M
character-set-server = utf8mb4
[client]
port = 3306
[mariadb]
default-character-set = cp932
Then I get the following error:
2021-07-21 5:29:53 0 [ERROR] C: \ Program Files \ MariaDB 10.6 \ bin \ mariadbd.exe: unknown variable'default-character-set = cp932'
2021-07-21 5:29:53 0 [ERROR] Aborting
If anyone knows why the settings described in the [mariadb] group cause an error in mariadbd.exe, it would be helpful.
Because people frequently mistype between the two, the mariadbd.exe reads both mariadb and mariadbd (and others) as a groups.
Clients can use mariadb-client or client-mariadb.
Connector-c based connectors use mariadb-client too.
The --help option on all server and client programs will show the groups read and options used.

Can't connect to PostgreSQL in Rstudio, possible permissions issue?

I've followed the documentation on db.rstudio.com and other sites, and I'm not able to connect to my Postgres database from Rstudio. I'm on macos 10.14. Running:
con <- DBI::dbConnect(odbc::odbc(),
Driver = "PostgreSQL Driver",
Database = "mydatabase",
UID = "myuser",
PWD = "mypassword",
Host = "localhost",
Port = 5432)
Gives the error:
Error: nanodbc/nanodbc.cpp:983: 00000:
At first, I got an empty list when running odbcListDrivers(), however I was able to get it to show the postgres driver location/value by copying odbcinst.ini from the global /etc to my user (cp /etc/odbcinst.ini ~/.odbcinst.ini).
Similarly, odbcListDataSources() returned nothing until I did the same thing (cp /etc/odbc.ini ~/.odbc.ini)
The odbc.ini and odbcinst.ini are locked from editing via Finder, but can be edited via nano/terminal.
I also tried to solve the problem by installing the database drivers via Postgres' stack builder, but it didn't change anything.
Overall I'm suspecting that it's a permissions issue, but I'm not quite sure where to look next.
Thanks for your help!
The permission for the odbc.ini was:
-rw-rw-rw-# 1 root wheel 139B Mar 31 12:57 odbc.ini
Which I changed to:
-rwxr-xr-x# 1 myuser wheel 139B Mar 31 12:57 odbc.ini
But that didn't solve the problem, the error is the same.
The content of odbcinst.ini is:
[PostgreSQL Driver]
Driver = /usr/local/lib/psqlodbcw.so
The content of odbc.ini is:
[PostgreSQL]
Driver = PostgreSQL Driver
Database = mydatabase
Servername = localhost
UserName = myuser
Password = mypassword
Port = 5432
odbc::odbcListDrivers() gives:
name attribute
1 PostgreSQL Driver Driver
2 ODBC Drivers Amazon Redshift
3 Amazon Redshift Driver
value
1 /usr/local/lib/psqlodbcw.so
2 Installed
3 /opt/amazon/redshift/lib/universal/libamazonredshiftodbc.dylib
odbc::odbcListDataSources() gives:
name description
1 PostgreSQL PostgreSQL Driver

"[unixODBC][Driver Manager]Data source name not found, and no default driver specified" despite /etc/odbc.ini having the DSN

Getting the "[unixODBC][Driver Manager]Data source name not found, and no default driver specified" despite /etc/odbc.ini having the DSN referenced in the connection string. Why would this be happening and what can be done?
Trying to set up pyodbc for connecting to MSSQLServer using the docs (centos 7). Yet, when trying to actually connect to the database,
import pyodbc
# setup db connection
server = 'myserver'
database = 'mydb'
username = 'myusername'
password = 'mypassword'
cnxn_str = 'DSN=MyMSSQLServer;DATABASE='+database+'UID='+username+'PWD='+password+'MultipleActiveResultSets=True;'
cnxn = pyodbc.connect(cnxn_str)
getting error "[unixODBC][Driver Manager]Data source name not found, and no default driver specified", even though when running:
[mapr#mnode01 ~]$ cat /etc/odbc.ini
[MyMSSQLServer] Driver=ODBC Driver 13 for SQL Server
Description=My MS SQL Server
Trace=No
Server=<now using my sql server ip>
I can see that the DSN that I referenced in the python code is recorded in the /etc/odbc.ini file. Does anyone know what could be going on here? Thanks.
Note: I initially ran the pyodbc setup exactly as specified in the docs, but later re-did this step to use the ip address of the sql server I wanted to connect to:
vi /home/user/odbcadd.txt
[MyMSSQLServer] Driver = ODBC Driver 13 for SQL Server
Description = My MS SQL Server
Trace = No
Server = <my sql server ip>
and just re-ran the write to odbc.ini:
sudo odbcinst -i -s -f /home/user/odbcadd.txt -l
The solution commented by user Gord Thompson solved my problem. The ~/odbcadd.txt file that I was using to fill the /etc/odbc.ini file needed to have the 'Driver=' line on a separate line from the DSN to look like:
[mapr#mnode01 ~]$ cat /etc/odbc.ini
[MyMSSQLServer]
Driver=ODBC Driver 13 for SQL Server
Description=My MS SQL Server
Trace=No
Server=172.18.4.38

Establishing MS Access connection with UnixODBC and FreeTDS on Mac

I've been trying to establish a connection to an MS Access database I have on my local hard drive using FreeTDS and UnixODBC. My ultimate goal is to open the connection in R via RODBC and implement some SQL scripts developed for this specific database to extract data. I've followed advice from this page (How do I install RODBC on Mac OS X Yosemite with unixodbc and freetds?), but am still having trouble.
When I implement isql in terminal I get the following error message.
[S1000][unixODBC][FreeTDS][SQL Server]Unable to connect to data source
[01000][unixODBC][FreeTDS][SQL Server]Unknown host machine name.
[ISQL]ERROR: Could not SQLConnect
I'm assuming my error is in how I've identified the host in my various setup files, which are as follows.
freetds.conf
[global]
; tds version = 8.0
; dump file = /tmp/freetds.log
; debug flags = 0xffff
; timeout = 10
; connect timeout = 10
text size = 64512
[my_db]
# insert the actual host below
host = My_computer_name.local
port = 1433
tds version = 8.0
odbc.ini
[my_db]
Driver = MSSQL
Servername = My_computer_name.local
Port = 1433
Database = /filepath_to_db/my_db.mdb
TDS_Version = 8.0
odicinst.ini
[MSSQL]
Description = Microsoft SQL Server driver
Driver = /usr/local/Cellar/freetds/1.00.39/lib/libtdsodbc.so
Setup = /usr/local/Cellar/freetds/1.00.39/lib/libtdsodbc.so
FreeTDS is for connecting to Microsoft SQL Server and Sybase databases. It is not designed to work with Microsoft Access databases.

Resources