Home » Infrastructure » Unix » copy image to unix server (merged)
copy image to unix server (merged) [message #286725] Mon, 10 December 2007 00:48 Go to next message
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: copy image to unix server [message #286727 is a reply to message #286725] Mon, 10 December 2007 00:51 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
scp
Re: copy image to unix server [message #286731 is a reply to message #286725] Mon, 10 December 2007 00:55 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
How is this a PL/SQL Experts question?

Regards
Michel
Re: how to load .jpg to unix server? [message #286735 is a reply to message #286725] Mon, 10 December 2007 00:58 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
You said your OS is XP and now you want to ftp "through unix server".
In the end, what is the question?

Regards
Michel
Re: copy image to unix server [message #286736 is a reply to message #286725] Mon, 10 December 2007 00:59 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
And don't multipost!

Regards
Michel
Re: how to load .jpg to unix server? [message #286741 is a reply to message #286735] Mon, 10 December 2007 01:10 Go to previous messageGo to next message
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: copy image to unix server (merged) [message #286742 is a reply to message #286725] Mon, 10 December 2007 01:12 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
OK FTP
Re: copy image to unix server (merged) [message #286746 is a reply to message #286742] Mon, 10 December 2007 01:17 Go to previous messageGo to next message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member

may i know what does it mean "OK FTP"?
Re: how to load .jpg to unix server? [message #286748 is a reply to message #286741] Mon, 10 December 2007 01:19 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
I am clear but you are not.
Why do you use TOAD to FTP some images.
And between what and what? Windows? Unix? Amstrad?
And I still don't how is this an Oracle question.

Regards
Michel
Re: how to load .jpg to unix server? [message #286754 is a reply to message #286748] Mon, 10 December 2007 01:31 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 Go to previous messageGo to next message
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 #286776 is a reply to message #286771] Mon, 10 December 2007 01:57 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
And you are sure you transfer it in binary and text/ascii mode?

Regards
Michel
Re: how to load .jpg to unix server? [message #286778 is a reply to message #286771] Mon, 10 December 2007 01:58 Go to previous messageGo to next message
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 #286779 is a reply to message #286771] Mon, 10 December 2007 01:58 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you, perhaps, choose ASCII mode while transferring images via FTP? What happens if you change it to BINARY mode?
Re: how to load .jpg to unix server? [message #286787 is a reply to message #286779] Mon, 10 December 2007 02:23 Go to previous messageGo to next message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member
ok.thanks to everyone.i just changed the mode to binary.and now it is copying well.yet i have to store it in the database.meet u soon.

regards,
sathish.
Re: how to load .jpg to unix server? [message #286795 is a reply to message #286787] Mon, 10 December 2007 02:38 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
"u" is not a member of this forum.
I don't know where you can meet him/her.

Regards
Michel

[Updated on: Mon, 10 December 2007 04:45]

Report message to a moderator

Re: how to load .jpg to unix server? [message #286843 is a reply to message #286795] Mon, 10 December 2007 04:07 Go to previous messageGo to next message
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 #286858 is a reply to message #286843] Mon, 10 December 2007 04:45 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Please post what you did.
That is copy and paste.

Regards
Michel

Re: how to load .jpg to unix server? [message #286893 is a reply to message #286843] Mon, 10 December 2007 06:39 Go to previous messageGo to next message
trantuananh24hg
Messages: 744
Registered: January 2007
Location: Ha Noi, Viet Nam
Senior Member
Did you create directory by SQL statement?

Post your actions here.
Re: how to load .jpg to unix server? [message #287005 is a reply to message #286893] Mon, 10 December 2007 22:10 Go to previous messageGo to next message
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 #287010 is a reply to message #287005] Mon, 10 December 2007 22:43 Go to previous messageGo to next message
Mohammad Taj
Messages: 2412
Registered: September 2006
Location: Dubai, UAE
Senior Member

1. which user create directory ?
2. did you grant read,write premission on directory to user.
3. you can't see photo through SQL PLUS you have to use third party application. you just store LARGE object in database.


[Updated on: Mon, 10 December 2007 22:44]

Report message to a moderator

Re: how to load .jpg to unix server? [message #287013 is a reply to message #287010] Mon, 10 December 2007 23:02 Go to previous messageGo to next message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member
i created in my default schema SCOTT

.and i tried to grant READ to scott.

it is saying that

"ora-01749 u cant give privillege to/from yourself"
Re: how to load .jpg to unix server? [message #287017 is a reply to message #287013] Mon, 10 December 2007 23:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
Once again COPY AND PASTE what you did and what you have.
Oracle NEVER says "u" in a message.

Put 'DIR' in upper case in BFILENAME.

Regards
Michel
Re: how to load .jpg to unix server? [message #287032 is a reply to message #287017] Mon, 10 December 2007 23:55 Go to previous messageGo to next message
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: how to load .jpg to unix server? [message #287078 is a reply to message #287032] Tue, 11 December 2007 01:08 Go to previous messageGo to next message
Michel Cadot
Messages: 68716
Registered: March 2007
Location: Saint-Maur, France, https...
Senior Member
Account Moderator
There, you have another error.
Now give the permission.

Regards
Michel
Re: copy image to unix server (merged) [message #287095 is a reply to message #286725] Tue, 11 December 2007 01:34 Go to previous messageGo to next message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member
yes.

i gave pemission already as chmod 777 to that file.

and now it is working properly.


thanks for your guidelines Michel,
sathish.

Re: copy image to unix server (merged) [message #287251 is a reply to message #287095] Tue, 11 December 2007 11:46 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Why would you give 777 to a JPG? Please read up on what 777 means and don't grant more permissions on a file that required - it's a terrible practice.
Re: copy image to unix server (merged) [message #287305 is a reply to message #286725] Tue, 11 December 2007 22:08 Go to previous messageGo to next message
sathish.mellow
Messages: 32
Registered: December 2007
Location: Chennai
Member
oh ok.
Re: copy image to unix server (merged) [message #287313 is a reply to message #286725] Tue, 11 December 2007 22:43 Go to previous message
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

Previous Topic: Oracle 9i Alert.log
Next Topic: how to write shell script to transfer the file to the server using SFTP
Goto Forum:
  


Current Time: Wed Nov 27 14:16:57 CST 2024