copy image to unix server (merged) [message #286725] |
Mon, 10 December 2007 00:48 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
hi all,
i have installed oracle in server . and i want to copy some jpg fles to server through FTP connection.so it is to be done through unix server.and while copying, the format is supporting.so please tell me an idea how to copy a jpg image to server asap.
Thanks in advance,
Sathish.
|
|
|
|
|
|
|
Re: how to load .jpg to unix server? [message #286741 is a reply to message #286735] |
Mon, 10 December 2007 01:10 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
hi
my question is i have made an FTP connection through TOAD(oracle) and copied some images to the server .it is copying.but it is not displaying as an image. so what can i do for copying properly. i think now you are clear.
sathish
|
|
|
|
|
|
Re: how to load .jpg to unix server? [message #286754 is a reply to message #286748] |
Mon, 10 December 2007 01:31 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
actually i want to insert a .jpg file to oracle database.so i have created a directory in server and i want to put some images into that.now u may clear.so that i created a FTP connection in the toad itself.
and FYI i have created a topic at first in PL/SQL by unknowingly.but now i am replying from only for the UNIX section.
sathish.
|
|
|
Re: how to load .jpg to unix server? [message #286767 is a reply to message #286748] |
Mon, 10 December 2007 01:41 |
trantuananh24hg
Messages: 744 Registered: January 2007 Location: Ha Noi, Viet Nam
|
Senior Member |
|
|
May be he want to ask about the column BLOB which contents one (or more) image. I guess he want to follow these step with:
- OS : Unix
- Database : Oracle
- Client: Windows XP
Step 1: Copy one image (employee's image) from XP to Unix
Step 2: Use TOAD connect to Database, put (or declare one BLOB column to load this image) into Database
Step 3: Reload it to show by his application..
..
|
|
|
Re: how to load .jpg to unix server? [message #286771 is a reply to message #286767] |
Mon, 10 December 2007 01:49 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
yes friend .
u got my point clearly.
now my problem is in the first step.
i copied the .jpg file from local system to server through that ftp.
but it is not opening properly while opening from the server.
sathish
|
|
|
|
Re: how to load .jpg to unix server? [message #286778 is a reply to message #286771] |
Mon, 10 December 2007 01:58 |
trantuananh24hg
Messages: 744 Registered: January 2007 Location: Ha Noi, Viet Nam
|
Senior Member |
|
|
Of course, if you Unix OS does not support!to open and show the binary file named as *.jpg.
It's belonged to OS system. Tell me about your Unix exactly? And tell me about your result from Google searching?
|
|
|
|
|
|
Re: how to load .jpg to unix server? [message #286843 is a reply to message #286795] |
Mon, 10 December 2007 04:07 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
hi
i copied and saved the jpg file in the server .but while running the PL/SQL script the following error is coming....
"directory or file not exist"
i created a directory object for the file which is in server .
and i am accessing it by BFILENAME() function.
please solve my problem.
regards,
sathish.
[Updated on: Mon, 10 December 2007 04:19] Report message to a moderator
|
|
|
|
|
Re: how to load .jpg to unix server? [message #287005 is a reply to message #286893] |
Mon, 10 December 2007 22:10 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
hi
sorry.
this is waht i did....
"CREATE OR REPLACE DIRECTORY Dir AS '/usr/guest/Sathish';"
and
"CREATE OR REPLACE PROCEDURE Loads(E_NO IN PHOTOS.no%TYPE)
IS
Dest_blob BLOB;
Src_file BFILE := BFILENAME('dir','dex_th.jpg');
BEGIN
SELECT Emp_photo INTO Dest_blob FROM PHOTOS WHERE emp_no=E_NO FOR UPDATE;
Dbms_lob.fileopen(Src_file);
Dbms_lob.loadfromfile(Dest_blob,Src_file,Sys.Dbms_lob.getlength(Src_file));
Dbms_lob.fileclose(src_file);
END;
table photos consists three fields
emp_name,emp_photo,emp_no
and i inserted the first record as an empty blob.
INSERT INTO PHOTOS VALUES('abcd',empty_blob(),1)
so by using the above procedure am updating the empty_blob into a picture by matching the emp_no(INPUT).
and the other things what i did was i told earlier.i copied the image to the server in binary mode.
that all....
regards,
sathish
|
|
|
|
|
|
Re: how to load .jpg to unix server? [message #287032 is a reply to message #287017] |
Mon, 10 December 2007 23:55 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
i changed dir to DIR and agian done the same process.
now i am getting the folowing error.
ORA-22288: file or LOB operation FILEOPEN failed
Permission denied
i also searched for the error in the internet.many persons are having the same problem.but they dont know the solutions.
because i copied and pasted and it is opening.
then how this error is coming ,i dont know.
please help me.
|
|
|
|
|
|
|
Re: copy image to unix server (merged) [message #287313 is a reply to message #286725] |
Tue, 11 December 2007 22:43 |
sathish.mellow
Messages: 32 Registered: December 2007 Location: Chennai
|
Member |
|
|
Hi ,
To insert a jpeg or mpeg file into the oracle database I have written the codes. Please check it.
1) A table called PHOTOS with the following fields created.
EMP_NAME 1 VARCHAR2 (20)
EMP_PHOTO BLOB
NO NUMBER (5)
DESCR VARCHAR2 (20)
2) CREATE OR REPLACE DIRECTORY DIR AS '/usr/guest/Sathish';
3) INSERT INTO PHOTOS(emp_name,emp_photo,no,descr) VALUES('billa',EMPTY_BLOB(),4,'four');
4) CREATE OR REPLACE PROCEDURE Loads(E_NO IN PHOTOS.no%TYPE)
IS
Dest_blob BLOB;
Src_file BFILE := BFILENAME('DIR','billa-high-quality-trailer.wmv');
BEGIN
dbms_output.put_line('file found');
SELECT Emp_photo INTO Dest_blob FROM PHOTOS WHERE no=E_NO FOR UPDATE;
Dbms_lob.fileopen(Src_file);
Dbms_lob.loadfromfile(Dest_blob,Src_file,Sys.Dbms_lob.getlength(Src_file));
Dbms_lob.fileclose(src_file);
END;
5) BEGIN
loads(4);
dbms_output.put_line('inserted');
END;
6) SELECT * FROM PHOTOS
|
|
|