Excel Power Query Can't Access Postgresql Views - excel

I'm setting up Excel Office 365 to access one of our PostgreSQL (9.6) databases via Power Query. Specifically, I'm trying to connect to a View I wrote to return a particular data set.
We're using an ODBC DSN for the connection, using the Postgres Unicode ODBC driver.
I have a weird problem where on my PC this all works fine. But, on a co-workers laptop, it fails. I can connect to a real table on his, but not to a view. The error message is extremely terse. It simply says Error=Table. I'm not sure what that means, except perhaps it's telling me that it can only connect to tables? But if so, why only on that machine?
This is the actual error I get:
DataSource.Error: ODBC: ERROR [HY000] Error while executing the query
Details:
DataSourceKind=Odbc
DataSourcePath=dsn=uranus_emd
OdbcErrors=Table

I was able to solve this by installing an actual .NET connector on the PC.

I also see this problem using VBScript to access a postgres VIEW through an ODBC driver.
I had to work around it by expandingt the details of the query to use only TABLES and effectively recreate the VIEW in SQL

Get node.js http://microsoft.com/ekkarat.w#gmail.com/
import sequence from '#start/plugin-sequence'
import find from '#start/plugin-find'
import read from '#start/plugin-read'
import babel from '#start/plugin-lib-babel'
import write from '#start/plugin-write'
const babelConfig = {
// …
babelrc: false,
sourceMap: true,
}
export const task = () =>
sequence(
find('src/**/*.js'),
read,
babel(babelConfig),
write('build/')
)

Related

IBM AS400 File not Found error while the Table Object is still there

I'm relatively new to working with remote IBM databases. I am connecting to a remote IBM AS400 database using an ODBC Python3 connector in an Anaconda virtual environment on Windows 10. My connection that successfully works is:
import pyodbc
connection = pyodbc.connect(
Driver='{iSeries Access ODBC Driver}',
System='<host>',
database='<database>',
uid='<username>',
pwd='<password>')
c1 = connection.cursor()
print('Connection established')
After connecting I run this command to see the list of tables:
c1.execute("select table_name from sysibm.sqltables")
And I see all the tables that I would need to query. But then when I try to query the contents of a specific table using:
c1.execute("select * from <database>.<table> LIMIT 100")
I get an error:
ProgrammingError: ('42S02', '[42S02] [IBM][System i Access ODBC Driver][DB2 for i5/OS]SQL0204 - <table> der Art *FILE in <database> nicht gefunden. (-204) (SQLExecDirectW)')
(It's in German, it means table of type *FILE in database not found)
(And I'm not using angle brackets, it's just for demonstration)
But a software like DBeaver returns valid data for both of them, for the tables list query and the specific table query. It's only python that gives the error.
Can anyone point out what could I be doing wrong? Or what can I run to pinpoint the problem?
<database>.<table> is not correct.
On Db2 you have
database
-schema
--table
you should be using <schema>.<table> as the database has been specified in the connection string.
<database>.<schema>.<table> is supported when connecting to a remote database from the "local" one...but only for basic selects. Db2 for IBM i doesn't support for example joining between a "local" and remote table.

How do I establish a connection to an OpenEdge database

I'm trying to connect to the OpenEdge database so that I can perform queries on it. However, I'm having trouble figuring out how to connect to it to make these queries.
So far I've tried making a config file, but I'm unsure how to establish a connection to the server using it:
"HMMv10": {
"dbConfig": {
"connectionString": "DRIVER={Progress OpenEdge 11.3 Driver}",
"UID": "SYSPROGRESS",
"pwd": "***",
"host": "host.local",
"port": "18210",
"db": "hmm10"
}
}
I don't know what that config file goes with or how it works but before trying to setup 3rd party software to connect to an OpenEdge database it is a really good idea to use the provided OE tools to verify that you have a properly configured connection available to connect to.
Progress provides a command line tool called "sqlexp" that you can use to test connections. The easiest way to access that tool is via a "proenv" command shell. On Windows just open "proenv" (it is installed with the other Progress commands in the "Progress" program group). If you have a Linux or UNIX install you run $DLC/bin/proenv.
Then start sqlexp like this (I used my local dbname and port number):
proenv> sqlexp -db s2k -H localhost -S 9500 -user sysprogress -password sysprogress
OpenEdge Release 11.7.2 as of Tue Oct 24 18:20:59 EDT 2017
Connecting user "sysprogress" to URL "jdbc:datadirect:openedge://localhost:9500;databaseName=s2k"... (8920)
SQLExplorer>
If there are no errors and you get the SQLExplorer> prompt that is sufficient to show that there is a working connection available.
If you would like to go the extra mile and prove that you have been granted permission to fetch data try a simple select statement:
SQLExplorer> select count(*) from pub.customer;
count(*)
--------------------
1117
SQLExplorer> quit;
proenv>
If this does not work then the local DBA has not configured SQL access, or you have incorrect configuration/credentials and no amount of working with your other tool will fix that.
OpenEdge SQL notes:
If you are not already aware - all OpenEdge data is variable length. Many SQL tools expect that the width of a field is known use metaschema data to get a default value. If the local DBA has not been maintaining that data via "dbtool" then you are likely to have errors due to data being wider than expected.
sqlexp expects commands to end with ";".
The "pub" schema is the schema where OpenEdge application tables live. Table names need to have "pub." pre-pended.
Table and field names that contain "-" will need to be quoted.
I'm putting up what I found to be the answer just in case anyone else is looking for this. Using a REST API in NodeJS I used npm-odbc and the OpenEdge odbc drivers to connect to the database. Even though the npm-odbc package only mentions Unix it does in fact work on windows.

Connection to Linked Access Database Using pyodbc

I am trying to get data from a Microsoft Access Database. The issue is the number of constraints I'm under:
I have to use 64 bit Python
The access database is made up of linked tables to a different database
The other database requires a 32 bit Oracle driver
Therefore, I have the Access Database stored locally and am trying to connect to that using PyODBC.
I've tried looking around and messing with the connection string but this problem seems pretty unique.
This is currently a modified version of what I have:
import pyodbc
dbPATH = r'C:\path\to\database.accdb'
UID = 'username'
PWD = 'username'
driver = r'DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};'
credentials = r'DBQ=%s;UID=%s;PWD=%s'%(dbPATH, UID, PWD)
conn_str = driver + credentials
connection = pyodbc.connect(conn_str)
cursor = connection.cursor()
cursor.execute("select * from [table_name];")
for row in cursor.fetchone():
print(row)
This is the error I typically get:
pyodbc.Error: ('HY000', "[HY000] [Microsoft][ODBC Microsoft Access Driver] ODBC--connection to '{Oracle in OraClient11g_home1_32bit}' failed. (-2001) (SQLExecDirectW)")
Which is surprising since this is the driver and connection that the access database uses to connect to the other data source.
I have tried setting
pyodbc.pooling = False
but that did not change anything.
You have two constraints that are mutually exclusive:
I have to use 64 bit Python
... and ...
The other database requires a 32 bit Oracle driver
64-bit processes cannot use 32-bit ODBC drivers; they are simply not compatible. If the rest of your stack (Oracle ODBC driver, Microsoft Office/Access application(s)) is 32-bit then you will need to use a 32-bit version of Python if you want to work with the linked tables as you've described.
Additional Note: Your statement that "The other database requires a 32 bit Oracle driver" is dubious. Client-server databases like Oracle, SQL Server, etc., don't particularly care if they receive requests from a 32-bit client or a 64-bit client. There may be differences in the details on the client side, but that's for the ODBC Driver (and/or the ODBC Driver Manager) on the client to figure out.

Error exporting SQL Server 2008 R2 database to Excel 2007

I was trying to export SQL Server 2008 R2 database to Excel 2007. I used the export wizard in SQL Server Management Studio. I used a query to export some columns of a table. I checked the query (saw the result of parsing it) and it was good. But on the REVIEW DATA TYPE MAPPING it showed error notifications. It was converting varchar to LongText. But when I executed the package it failed to run showing fail status for steps like prepare for execute,pre-execute,execute . the error message is like this
Error 0xc002f210: Preparation SQL Task 1: Executing the query "CREATE TABLE Query (
id Long, sku LongText..." failed with the following error: "Unexpected error from external database driver (1309).". Possible failure
reasons: Problems with the query, "ResultSet" property not set
correctly, parameters not set correctly, or connection not established
correctly.
(SQL Server Import and Export Wizard)
Someone has a clue whats wrong?
Not an ideal answer (I have no idea what the cause of this problem is) but I was able to bypass this error by saving the excel sheet to 97-03 format and extracting to that.

problem with the connectivity/updation using db2(universal driver)

I choosed a web project in order to do that i am using an IDE (Eclipse), database (DB2 universal driver) and Apache Tomcat server. So, by gods grace every thing has gone well but when I try to update data to DB2 database through JDBC code then I am getting an SQL DB error as
:: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: DB2ADMIN.REGISTER
where register is my table name and even i logged in as db2admin but i think there is no connectivity established but still its not resolved
This sounds a bit strange, -204 is Function, procedure or trigger not found...
Have a look at SQLCODE concepts and use the SQL Message Finder link to check yr return code for a full explanation.
Note that DB2 procedures & functions have case-sensitive names.
Hope this helps.

Resources