Connect PowerBi to As400 - powerbi

I tried to connect to ODBC with PowerBi using this string connection
Driver={Client Access ODBC Driver
(32-bit)};System=xxxxx.xxx.xxxxx;libraries=XXXXXX;naming=system;transaction
isolation=read committed;
Connection is done but i cannot see the right tables, i see 3 folders
EXPLOIT, INSTAL, QGPL
With different tables inside that are not tables when I connect with squirrel client, for example.
I know there are few elements to understand. Someone has any ideas?
UPDATE
I found out this three catalogs (EXPLOIT, INSTAL and QGPL) also in Squirrel, but I cannot see all others catalogs that I see in Squirrel. Could be any limited views? The user is always the same.

Seems that the default library list for your server does not include QSYS2. You can access most of the DB2 for i catalog files in QSYS2. Try this:
Select * from qsys2.systables;
That should show you all the tables your heart desires, as well as the schema (library) that the table resides in.
BTW, I don't think EXPLOIT, INSTAL, and QGPL are catalogs. They are likely libraries, well QGPL is definitely a system library supplied by IBM. The other two seem to be something provided by some 3rd party app.

Related

Power BI Embedded Approach for 100s of SQL Targets

I'm trying to find the best approach to delivering a BI solution to 400+ customers which each have their own database.
I've got PowerBI Embedded working using service principal licensing and I have the PowerBI service connected to my data through the On Premise Data Gateway.
I've build my first report pointing to 1 of the customer databases. Which works lovely.
What I want to do next, when embedding the report, is to tell PowerBI, for this session, to get the database from a different database.
I'm struggling to find somewhere where this is explained, or to understand if this is even possible.
I'm trying to avoid creating 400+ WorkSpaces or 400+ Data Sets.
If someone could point me in the right direction, it would be appreciated.
You can configure the report to use parameters and these parameters can be used to configure the source for your dataset:
https://www.phdata.io/blog/how-to-parameterize-data-sources-power-bi/
These parameters can be set by the app hosting the embedded report:
https://learn.microsoft.com/en-us/rest/api/power-bi/datasets/update-parameters-in-group
Because the app is setting the parameter, each user will only see their own data. Since this will be a live connection, you would need to think about how the underlying server can support the workload.
An alternative solution would be to consolidate the customer databases into a single database (just the relevant tables) and use row level security to restrict access for each customer. The advantage to this design is that you take the burden off of the underlying SQL instance and push it into a PBI dataset that is made to handle huge datasets with sub-second response times.
More on that here: https://learn.microsoft.com/en-us/power-bi/enterprise/service-admin-rls

SAS 9.3 Giving Access to a particular table from one server to the user on the other user

I have 2 SAS 9.3 servers Server-A and Server-B which have seperate libraries, datasets and users.
There are five tables in a library on SERVER A called LIB_A:
A1
A2
A3
A4
A5
I want to share only dataset A3 with another user from Server B.
A3 is a dynamic table so i decided to make a SAS view out of it called V_A3 and store it in a new library called LIB_B.
PROC SQL;
CREATE VIEW LIB_B.V_A3 AS
SELECT * FROM LIB_A.A3;
QUIT;
RUN:
How can i share this V_A3 SAS view which is on Server A in library LIB_A with a user from Server B?
I have tried to create a new library on Server B and assign path as network share of the main folder of LIB_B (\SERVER B\LIB_B).
User sees the library and the view but view produces ERROR and data is not shown. Probably because the code which created the view references to the outher sources like
SELECT * FROM LIB_A.A3
Without creating views, how can i keep the datasource dynamic?
On Server B, if i create a SAS BASE library which uses path of the original folder on Server A as;
\Server A\LIB_A
user sees all the five tables: A1,A2,A3,A4,A5.
But I want him to see only table A3. If i can manage this, there will be no need to create view.
How can i make it work? My servers are on Windows and SAS 9.3 T1M1.
The simple answer is to permission things at the table level, rather than at the folder level. This is true whether you are using SAS Metadata Server to manage the permissions, or Windows.
In SAS Metadata Server, you could create an ACT deny (no read access) for ServerBUsers, and then you could separately create another ACT permit (read access) for ServerBUsers. Then, apply the deny ACT to \ServerA\LibA, and apply the permit ACT to \ServerA\LibA\TableA3.
Windows permissions work roughly the same way, and your Windows permissions would have to be at least as permissive as your SAS permissions, or the user will get annoying messages. If you are comfortable handling the permissions in SAS, then just give read access to the whole folder; but if not, you could create Windows AD groups akin to the ACTs above, and then have SAS use those Windows AD groups to define SAS user groups that then have permissions, or don't have permission, to the various files/folders.

Coldfusion: Move data from one datasource to another

I need to move a series of tables from one datasource to another. Our hosting company doesn't give shared passwords amongst the databases so I can't write a SQL script to handle it.
The best option is just writing a little coldfusion scripty that takes care of it.
Ordinarily I would do something like:
SELECT * INTO database.table FROM database.table
The only problem with this is that cfquery's don't allow you to use two datasources in the same query.
I don't think I could use a QoQ's either because you can't tell it to use the second datasource, but to have a dbType of 'Query'.
Can anyone think of any intelligent ways of getting this done? Or is the only option to just loop over each line in the first query adding them individually to the second?
My problem with that is that it will take much longer. We have a lot of tables to move.
Ok, so you don't have a shared password between the databases, but you do seem to have the passwords for each individual database (since you have datasources set up). So, can you create a linked server definition from database 1 to database 2? User credentials can be saved against the linked server, so they don't have to be the same as the source DB. Once that's set up, you can definitely move data between the two DBs.
We use this all the time to sync data from our live database into our test environment. I can provide more specific SQL if this would work for you.
You CAN access two databases, but not two datasources in the same query.
I wrote something a few years ago called "DataSynch" for just this sort of thing.
http://www.bryantwebconsulting.com/blog/index.cfm/2006/9/20/database_synchronization
Everything you need for this to work is included in my free "com.sebtools" package:
http://sebtools.riaforge.org/
I haven't actually used this in a few years, but I can't think of any reason why it wouldn't still work.
Henry - why do any of this? Why not just use SQL manager to move over the selected tables usign the "import data" function? (right click on your dB and choose "import" - then use the native client and permissions for the "other" database to specify the tables. Your SQL manager will need to have access to both DBs, but the db servers themselves do not need access to each other. Your manager studio will serve as a conduit.

How to query a DB table from C++

I have C++ code, and from it I need to access the DB and make a query in table (with name NECE_TABLE, which has 2 columns - IntID and Status).
Here I need to get "status" column value from DB table (NECE_TABLE) using the IntID from C++ code.
Any help will be greatly helpful. Thanks in advance
Your question is very vague, but in summary you need to:
Use an appropriate client library supported by your database to connect to that database using some user credentials with appropriate permissions for SELECTing from your table
Execute a SQL select to fetch the data you want
There's some confusion as to which database you're using.
If you're using Oracle, you can use the OCCI client library to connect to the database and execute SQL statements. See section 2 of the linked document, where it describes connecting to a database and executing SQL queries.
Take a look at this link - it's a simple tutorial on how to get started with MySQL and C++. You say you are using vanilla SQL in your tags, but the two should be compatible as long as you stick to the more basic queries.

Can I avoid stating the library name in a SQL query to an AS400?

Gurus,
Is there anyway that I can setup my DSN to avoid having the say "LIBRARY.TABLE" in my SQL statements?
Our test and production environments differ in that the test AS400 does not have "TABLE" in the same library as production. I don't want to have to change code in moving from test to production. That defeats the purpose.
Chris
Yes, you can do this by specifying the library that your table is in in your connection string using LibraryList and Default Collection. For example:
DataSource=Server;LibraryList=LIB1, LIB2, LIB3;UserID=something;Password=something;Default Collection=LIB1
If you have a DSN set up as an ODBC connection on your system/server, you can do the same in the Library list and SQL default library textboxes on the Server tab of the System DSN configuration dialog.