How do I insert a file that resides in windows in c:\temp\sample.txt
I have tried
insert into lob_file VALUES (5, pg_read_file('c://temp//sample.txt')::BYTEA);
and got
ERROR: could not start file c://temp//sample.txt. No such file or
directory.
Is data base running locally or on a Windows server and you have moved the file to the server. See Docs
The functions shown in Table 9.94 provide native access to files on
the machine hosting the server. Only files within the database cluster
directory and the log_directory can be accessed unless the user is
granted the role pg_read_server_files. Use a relative path for files
in the cluster directory, and a path matching the log_directory
configuration setting for log files.
Related
I have two machines named: ubuntu1 and ubuntu2.
In ubuntu1, I started the master node in Spark Standalone Cluster and ubuntu2 I started with a worker (slave).
I am trying to execute the example workCount available on github.
When I submit the application, the worker send an error message
java.io.FileNotFoundException: File file:/home/ubuntu1/demo/test.txt does not exist.
My command line is
./spark-submit --master spark://ubuntu1-VirtualBox:7077 --deploy-mode cluster --clas br.com.wordCount.App -v --name"Word Count" /home/ubuntu1/demo/wordCount.jar /home/ubuntu1/demo/test.txt
The file test.txt has only to stay in one machine ?
Note: The master and the worker are in different machine.
Thank you
I got the same problem while loading the JSON file. I recognized by default windows storing file format as Textfile regardless of the name. identify the file format then you can load easily.
example: think you saved the file as test.JSON. but by default windows adding .txt to it.
check that and try to run again.
I hope your problem will get resolved with this idea.
Thank you.
You should put your file on hdfs by going to the folder and typing :
hdfs dfs -put <file>
Otherwise each node has to have access to it by having the same path folder existing on each machine.
Don't forget to change file:/ to hdfs:/ after you do that
I'm trying to insert records from local directory path in SSH but it shows "file not found" because it does not recognize the path. But if I give sft directory then it recognise the path.
This is the code:
Local directory path:
./putmsgE1E2.ksh LPDWA123 ABC.GD.SENDCORRESPONDENCE.BATCH.INPUT XPRESSION.TEST /Users/admin/Desktop/important.txt;
and I tried using c:/Users/admin/Desktop/important.txt
SFT Directory:
./putmsgE1E2.ksh LPDWA123 ABC.GD.SENDCORRESPONDENCE.BATCH.INPUT XPRESSION.TEST /abchome/abc123/1.txt;
I have inputs in the txt file in my local directory; I want to poll that files to the server. Hope someone finds a solution. Thanks.
Use the below command on Linux systems:
scp /path/to/your/local/file remoteUser#some_address:/home/remoteUser/Documents
I have created logs for my project in a log file. I have provided the location of log file as 'logs/LogFile.log' in the java code. When run on a local server(Tomcat or Websphere), a new folder named 'logs' is created in the classpath of the server and i can find the 'LogFile.log' with logs in it.
Now my project is converted to EAR and it is up in the Dev Server. Where will my log file be created? How can i see those logs?
For a local server, the logs will be appended in the destined log file, which will be in the server installed directory or a remote user created directory.
In case of a remote server, say Unix server, the logs will be generated in the specified location inside the server. We need to login to the unix server via putty or Techtia and can view the logs in the specified locations.
I have a windows7 machine in which i am creating a file through java code in following path
C:\Users\123\Application Data\XYZ
but physically it is getting created here
C:\Users\123\AppData\Roaming\XYZ
please tell me why?
Because one is a legacy path, and the other is the current preferred folder path. Both lead to the same location.
See e.g. Application Compatibility: Junction Points and Backup Applications:
In Windows Vista® and Windows Server® 2008, the default location of user data has changed. An example of this change is the Documents and Settings directory, which has been moved from %systemdrive%\Documents and Settings to %systemdrive%\Users.
and:
..\Documents and Settings\\Application Data\ [is mapped to] ..\Users\\AppData\Roaming
We try to access file under some folder, in WinXP, that folder can be local disk or mapped network drive. But when we change our program to run on Windows 2008 R2, it can access local disk, but no mapped network drive. The mapped network drive had checked for login with proper user.
We try in explorer, the mapped drive can Read/Write as we wished, but Java just show "Folder doesn't exist"
Here is our code, any suggestion will be appreciated.
#import java.io.File;
...
File folder = new File(folderPath);
if(!folder.exists()){
// do something
log.debug("Folder doesn't exist");
} else {
// do something else
}
...
Mapped drive may be not found for current user. For example, if you start some jar executable as administrator it may not find network drive which was mapped under user credentials. In a word, it can be a user identification problem.
I've had this problem with Windows Server 2008 64bit and had no luck using a path with network letter (e.g. X:\EXAMPLE\PATH). Using full network paths (\\SERVER\EXAMPLE\PATH) was ok. The path should be accesible to the user who will run the program.