Replace Existing File with Temp File:I/O Error - command-line

I have an Access 2007 database from which I call a Windows batch file to retrieve files from an external server via a ribbon menu. When executing the file manually everything works just fine. When executing the batch file via the Access ribbon menu the following error appears within the command line:
Opening data connection for ...
> Replace Existing File with Temp File:I/O Error
Binary transfer complete.
I've read something about this error in relation to (Admin) rights, but since the batch file actually runs when called by Access it not seems to be the issue.

Related

Copy into running fine but not loading data gzip file

I am using talend bulk execution to load data from s3 to snowflake. Talend tFileArchive converts the file to gzip format , file.csv.gz and upload it to s3 bucket. Copy into which gets executed through talend bulk component looks like below. It does nt throw an error or something but does nt load data either. If I try to load csv file without zip , it works fine.
File: file.csv.gz
Copy into table
from 's3://bucket/'
credentials=(aws_key_id='' aws_secret_key='')
FILE_FORMAT=(type=csv compression=gzip field_delimeter=',' skip_header=1 field_optionally_enclosed_by='\"' empty_field_as_null=true)
force=true
Can someone point wheres the issue ? Even if I execute above command through snowflake UI , it says ran successfully but does not load. File has data.
Thank you
View your table's COPY history to see if an error was thrown or not. Then try and LIST the file in your S3 bucket to make sure your STAGE is working.
SELECT *
FROM TABLE(information_schema.copy_history(table_name=>'YourDatabase.YourSchema.YourTable'
, start_time=> dateadd(days, -1, current_timestamp())));
LIST #YourStage
OR
LIST 's3://bucket/'
Also make sure you are executing your COPY INTO statement under a role that has permission to see the s3 bucket and write to the destination table.

Connecting to DB2 HammerDB

I am using a Windows Machine to connect to a remote DB2 instance. Ran into this issue
SQL1531N The connection failed because the name specified with the DSN connection string keyword could not be found in either the db2dsdriver.cfg configuration file or the db2.cli.ini configuration file. Data source name specified in the connection string: <DSN>
I have configured ODBC Data source using ODBC Data Source Administrator it has connected successfully.
Upon further investigation, I am unable to locate db2dsdriver.cfg on IBM DATA SERVER DRIVER folder. I am able to find db2dsdriver.lvl and dbs2dsdriver.xds. Just not the .cfg file. I am also unsure where HammerDB looks for the config file.
I have looked at the configuration of DB2 from the website but I am unable to get any useful information from there. https://www.hammerdb.com/docs/ch04s02.html
For the tiny footprint ODBC and CLI driver (known as clidriver) from IBM, you are responsible for creating and editing the db2dsdriver.cfg configuration file. It is a small XML file documented here and in related linked pages. The hammerdb documentation also gives a minimal example and you linked to this page in your question.
You can create and edit this file either by command lines to the db2cli tool, or by directly editing with a text editor (or XML editor). It may be easier to use an editor than to learn the command lines, although command lines have the advantage that they lend themselves to scripting this activity for larger installations.
On Microsoft-Windows you can also use Notepad to create and edit the file db2dsdriver.cfg.
An important step is that following editing of the file you must first validate its contents before trying any database connections. Validation checks that the syntax of the XML in the file is correct. To validate, you use the db2cli validate command described here. It must show a successful result before you try to connect to any database. Once validation completes without errors, you can also use db2cli validate -connect -dsn XXX -user YYY -passwd ZZZ to test the connection independently of your application (in this case hammerdb). Once you get a successful connection with the db2cli validate -connect -dsn ... then your application (hammerdb) will connect correctly.
There are many examples of db2dsdriver.cfg contents online , but your first source should be the Db2 Knowledge Centre online, which details the command line options to the db2cli command, along with giving examples of db2dsdriver.cfg.
If you already have a working Db2 configuration with local and remote databases (but no db2dsdriver.cfg file), you can also use a tool db2dsdcfgfill to populate db2dsdriver.cfg from your existing Db2 configuration. See docs here.

Connect Oracle database with SQLcl

I am using sqldeveloper to query database and export results to csv file. I need this file on daily basis so thought of creating bat file which can be scheduled on windows task scheduler. I was researching it and found I can use SQLcl to run my script to export the query data. But somehow I can't connect it and it gives me and error 'ORA-01017: invalid username/password;logon denied. Here is my connection properties from sql developer
Here is my command line:
sql testuser1/mypass#tstwd2.myhost.internal:1521/tst.internal
I have java development kit installed
Do I need anything for java? Or do I need any special rights to run sql command line?
Found the problem, my userid is in double quotes so I have to use escape sequence **\**, its working like a charm.

Import data fails in DB2

I'm using Data Studio to connect to a DB2 server. When I'm trying to use the 'import utility' in the Data Studio, it succeeds with a warning and the result show that no record has been inserted into the database. The Import wizard is generating the following SQL command
CALL SYSPROC.ADMIN_CMD( 'IMPORT FROM "/home/xyz/backup/TRANSACTION" OF DEL MODIFIED BY coldel| delprioritychar INSERT INTO S.TRANSACTION' );
If I copy this command and paste it in a sql script in DB2 and then run it it give another error
An I/O error (reason = "sqlofopn -2029060079") occurred while opening the input file.. SQLCODE=-3030, SQLSTATE=
If I use the db2 shell to execute the IMPORT part of the command (without CALL SYSPROC.ADMIN_CMD) it succeed without any issue. What is wrong here?
When you (or DataStudio) runs SYSPROC.ADMIN_CMD (which is the default method used by DataStudio for import), the action happens on the Db2-server using the account of the Db2-instance-owner (for Db2-LUW).
That account (for example db2inst1) requires read access to the specified filename. In your case, the Db2-instance owner did not have access to the file (and/or the path containing the file), so the exception got thrown.
You may see additional detail in the Db2-server diagnostic file (db2diag.log) for the failed action, depending on the diagnostics level that is active on the Db2-server.
ADMIN_CMD expects the input file to be on the server, because it (as any other stored procedure) runs on the server; it has no access to your local file system.
Commands you run in the Db2 command line processor execute on the client and therefore can access the file locally.

Export Postgres table to csv

I am trying to export my Postgres table to a csv on my desktop and I get this error:
ERROR: could not open file "C:\Users\blah\Desktop\countyreport.csv" for writing: Permission denied
SQL state: 42501
This is my query which I believe is the correct syntax
COPY countyreport TO 'C:\\Users\\blah\\Desktop\\countyreport.csv' DELIMITER ',' CSV HEADER;
According to the user manual:
Files named in a COPY command are read or written directly by the
server, not by the client application.
https://www.postgresql.org/docs/current/static/sql-copy.html
The common mistake is to believe that the filesystem access will be that of the (client) user, but it's not. It's normal to run the postgresql server as its own user. Therefore action carried out by the server will be done as a different OS user to the client. The server is usually run as an OS user postgres.
Assuming that you are running the server on your local machine then the simplest way to fix it would be to give postgres access to your home directory or desktop. This can be done by changing the windows security settings on your home directory.
Before you do this.... Stop and think. Is this what you are looking for? If the server is in development then will it always run on the user's machine. If not then you may need to use COPY to write to the stdout. See the manual for information on this.