How to give File access to Tableau server? - tableau-api

I have a .twb file created using the excel data source that is located in some network file path.
On publishing to server I get this error.
How to resolve this?
I need to provide some access for "Run as user" in my server machine,how could I do that ?

Ensure that when the workbook is created, a connection to the Excel file is created using the full UNC path
Ensure that the Tableau Server Run As user is able to access that file using the UNC path specified in the workbook. An easy way to test this would be to open Windows Explorer as the Run As user, then paste in the UNC path. If the Excel file opens, then you're good to go.
If you still have issues, test access to the file while logged into the Tableau server to make sure there is no firewall or port blocking access from that host. Often Excel isn't installed on servers for security reasons, so the test is not whether Excel opens the file, but whether you can view the contents from the server as the Run As User, even just using the type command at the console.
If you can't get your network access fixed, an alternative is to build and publish extracts to the server. There are multiple ways to accomplish that

Related

Export a CSV file from AS400 to my pc through Cl program

I want to export a database file that is created through a query, from the AS400 machine to my pc in the form of a csv file.
Is there a way to create that connection of the AS400 and my pc through a cl program?
An idea of what I want to do can be derived from the following code:
CLRPFM DTABASENAME
RUNQRY QRY(QRYTEST1)
CHGVAR VAR(&PATH) VALUE('C:\TESTS')
CHGVAR VAR(&PATH1) VALUE('C:\TESTS')
CHGVAR VAR(&CMD) VALUE(%TRIM(&PATH) *CAT '/DTABASENAME.CSV' !> &PATH !> &PATH1)
STRPCO PCTA(*YES)
STRPCCMD PCCMD(&CMD) PAUSE(*YES)
where I somehow get my database file, give the path that I want it to be saved in, in my pc , and lastly run the pc command accordingly
Take a look at
Copy From Query File (CPYFRMQRYF)
Which will allow you to create a database physical file from the query.
You may also want to look at
Copy To Import File (CPYTOIMPF)
Which will copy data from a database physical file to an Integrated File System (IFS) stream file (such as .CSV); which are the type of files you'd find on a PC.
ex:
CPYTOIMPF FROMFILE(MYLIB/MYPF) TOSTMF('/home/myuser/DTABASENAME.CSV') RCDDLM(*CRLF) DTAFMT(*DLM) STRDLM(*DBLQUOTE) STRESCCHR(*STRDLM) RMVBLANK(*TRAILING)
FLDDLM(',')
However, there's no single command to transfer data to your PC. Well technically, I suppose that's not true. If you configure a (SMB or NFS) file share on your PC and configure the IBM SMB or NFS client; you could in fact CPYTOIMPF directly to that file share or use the Copy Object (CPY) command to copy from the IFS to the network share.
If your PC has an FTP server available, you could send the data via the IBM i's FTP client. Similarly, if you have a SSH server on your PC, OpenSSL is available via PASE and SFTP or SCP could be used. You could also email the file from the i.
Instead of trying to send the file to your PC from the i. An easier solution would be to kick off a process on the PC that runs the download. My preference would be a Access Client Solution (ACS) data transfer.
You configure and save (as a .dtfx file) the transfer
Then you can kick it off with a
STRPCCMD cmd('java -jar C:\ACS\acsbundle.jar /plugin=download C:\testacs.dtfx')
More detailed information can be found in the Automating ACS Data Transfer document
The ACS download compoent is SQL based, so you could probably remove the need to use Query/400 at all
Assuming that you have your IFS QNTC mapped to your network domain. You could use the command CPYTOIMPF to copy the data directly from an IBMI DB2 file to a network directory.
This sample would result in a CSV file.
CPYTOIMPF FROMFILE(file) TOSTMF('//QNTC/servername or ip/path/filename.csv') STMFCCSID(*PCASCII) RCDDLM(*CRLF) STRDLM(*NONE)
Use the FLDDLM(';') option in addition to make semicolon separated values, omit it to use comma as value separator.

Transfer a file from AS400 to another machine in the same network

I am trying to export the data of a table on AS400 to another machine through iSeries commands but I am stacked in the middle of the process. I have a stored procedure in which I create the CSV file but after completion I need to transfer this file to another machine (which is of course connected to the AS400).
In the stored procedure, I used the CPYTOIMPF command to export table data to CSV and I wrote the file on the AS400 file system. I don't know if there is an option to write the file directly to another machine.
CALL QSYS2.QCMDEXC(
'CPYTOIMPF FROMFILE(LIBRARY/TABLE) TOSTMF('/QIBM/UserData/TestFolder/2.CSV') STMFCODPAG(*PCASCII) RCDDLM(*CRLF)'
);
This step is completed and the file is written on that directory.
Now I need to transfer this file to a web server that is connected to AS400 without after the above command is completed.
How can I do that?
You can use FTP on IBM i. Here is a modified example from the IBM Knowledge Center
This is a CL program
PGM
OVRDBF FILE(INPUT) TOFILE(MYLIB/QCLSRC) MBR(FTPCMDS)
OVRDBF FILE(OUTPUT) TOFILE(MYLIB/QCLSRC) MBR(OUT)
FTP RMTSYS(SYSxxx)
ENDPGM
This program overrides the input of the FTP client to a script in MYLIB/QCLSRC member FTPCMDS, and the output of the FTP client to MYLIB/QCLSRC member OUT. The first line of the script must contain the userid and password for the remote location.
Here is a sample script from the same Knowledge Center reference:
ITSO ITSO <== This is the user id and password
CD ITSOLIB1
SYSCMD CHGCURLIB ITSOLIB2
GET QCLSRC.BATCHFTP QCLSRC.BATCHFTP (REPLACE
QUIT
This should not be used outside your network as the user id an password are sent in plain text. It also can be a security risk as production user id's and passwords must be stored in plain text in the source file.
In addition, Scott Klement has a presentation on how to use ssh, scp, and sftp on IBM i. This is quite a long thing, so you might want to read about it here.
A short summary is that scp might be the easiest way to go. but you will need to:
Make sure that OpenSSH option of the OS is installed.
Make sure your Windows server is set up as an ssh server.
Set up a digital key to use for the transfer. Private key goes on client side, and public key goes on server side.
Use scp fromfile user#host:tofile in Pase to transfer the file.

Copy file - Access denied

I have a batch file where I copy file from a different server. I have no issues running it on the server. But when I try to run it from a web application, the file does not copy. I keep getting access denied error. I have used xcopy, copy and robocopy.
I have provided full access to source and destination folder for all users.
No luck. Keep getting the same error :
copy /y \N01APW280\d$\Oracle\Middleware\user_projects\epmsystem1\diagnostics\logs\essbase\essbase_0\app\PLPLAN\PLPLAN.LOG D:\Hyperion\ERPI_Actuals_Load\Logs\
It is rather awkward to try and use a command-line utility, such as copy, from a web app; you should rather be using the programmatic abilities within your web application instead.
Aside from that, you main issue is that web apps are typically executed with very limited privileges, using local machine accounts that have no way of accessing administrative level shares on remote machines such as \N01APW280\d$. Another possible issue is that the local account that is being used by the web app cannot write to D:\Hyperion\ERPI_Actuals_Load\Logs\ folder. And finally, your app may have enough privileges to instantiate an external process such as copy.exe.

Publishing Reports on tableau via tabcmd

I wanted to publish tableau reports via tab cmd commands and was able to do it successfully, one concern I have is "Connecting the twbx file to a data source' via tabcmd commands.
Following are the commands which I used to :
Login to tableau server :
tabcmd.exe login --server http://serverName --user "userName" --password "password" --site ""
Publishing Tableau reports to the Tableau server :
publish -c "E:\Tableau\ActualReportName.twbx" -n "new Report name.twbx" --project ProjectName --db-user "DBuserName" --db-password "DBpassword"
Although I have given my db credentials while publishing reports, I have nowhere mentioned the DB server Name and DB Name for that matter from which the twbx files would fetch the data.
I have multiple DB's using the same credentials, is there any way in TabCmd to specify the Db server Name and DB name from which reports would fetch data from?
Any help in this would be great!
Unless you have a pressing reason, I'd publish a .twb file instead of a .twbx file
The first thing I'd look into is Tableau servers support for publishing data sources that your published workbook can connect to via the Tableau server. That will allow you to embed your credentials in the shared data source and to update the workbooks and the connections in separate steps. That is especially useful if the data connection and the workbooks change at different tempos.
The unsupported hack is to have your script update the twb file before publishing. It's just an XML file and the info you want to change should be with the data connection details. If you go this route, standard disclaimers apply. Save backups. Don't modify the original, generate a revised version, expect to have to tweak your script when Tableau versions change, etc. still it's not too hard to make sense of their XML. You could probably do it with just a few lines of XSLT, but even a simple string replacement might be good enough.
Still I'd go with a shared data source over hacking the TWB internals in almost all cases.

Windows Service ran by domain account cannot access file while full control

I have created a C# service that:
- Picks up and opens a local text file
- Opens an Excel-file used as template (saved locally)
- Fills in the data from the text file in the excel file
- Saves the Excel file to a network folder.
The service runs using a domain account (I cannot give the local system account rights on the network from our network admin...). When the service tries to open the template, I get an access denied error:
Microsoft Excel cannot access the file 'C:\BloxVacation\Template\BloxTemplate.xlsm'. There are several possible reasons:
• The file name or path does not exist.
• The file is being used by another program.
• The workbook you are trying to save has the same name as a currently open workbook.
The file does exist and the path is correct.
The file is not used by another user or program.
I try to OPEN the workbook (no other workbook is open), not SAVE it.
I have received the same error using the system account. The reason for this is that, when using interopservices, the system account needs a desktop folder (bug in Windows 7: http://forums.asp.net/t/1585488.aspx).
C:\Windows\System32\config\systemprofile\Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop
Create those 2 files and the error disappears for the system account.
I have given the domain user rights to those folders and the error disappears as well however, the service hangs on the code line where I open the excel file. When I execute the exact same code with the system account, the code execute well (Note: I save the file locally).
objXL.Workbooks.Open(BloxVacationService.ExcelTemplateFilePath)
Has anybody an idea how to solve this issue without having to rewrite the entire service in OpenXML? Thank you very much in advance.
If you have done all the things described in the question and it still doesn't work (as it was with me), the answer is pretty simple:
Make the domain user local admin on the machine that runs the service. It solved the problem.