472,333 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

Store file in database tables

dmjpro
2,476 2GB
Can one explain me in details how to store a text file in a table.For example I have a text file named as aa.txt.I want to store it in a table.Or i can also create a table in order to store it.How can i store it in that table.Please explain it in details.
Jul 16 '07 #1
10 10309
debasisdas
8,127 Expert 4TB
you need to user the datatype BFILE for your purpose.
Jul 16 '07 #2
dmjpro
2,476 2GB
you need to user the datatype BFILE for your purpose.

Thanks for your reply.I understand i have to use BFILE.But can u tell me the entire procedure in details.
Jul 16 '07 #3
debasisdas
8,127 Expert 4TB
try the following steps

Expand|Select|Wrap|Line Numbers
  1. create directory DIR1 as 'd:\data'
  2.  
  3. create table filetable(id number(6),filename bfile)
  4.  
  5. insert into filetable values (1,bfilename('DIR1','filename'));
the file to be stored must be in the specified directory / path
Jul 16 '07 #4
debasisdas
8,127 Expert 4TB
The BFILENAME function does not validate that the user has READ privileges on the specified file or directory alias. It also does not perform a physical check to see if the directory or file actually exist. Instead, these checks are performed when access against the BFILE object is attempted.

There are several issues to keep in mind with directory aliases:

An alias is a database object, an "internal" name for an external, filesystem-based directory location.

You must create a directory alias before you can use it.

To create a directory alias, you will need the CREATE DIRECTORY or CREATE ANY DIRECTORY system privileges.

To access a directory alias, you must be the owner or be granted the READ privilege on that alias.

Directory aliases can be case-sensitive!
Jul 16 '07 #5
dmjpro
2,476 2GB
try the following steps

Expand|Select|Wrap|Line Numbers
  1. create directory DIR1 as 'd:\data'
  2.  
  3. create table filetable(id number(6),filename bfile)
  4.  
  5. insert into filetable values (1,bfilename('DIR1','filename'));
the file to be stored must be in the specified directory / path

Thank you sir.But still I found one problem.It is stored in the database.But when I using 'select * from filetable;' Then It showing value error under filename column.Then how can i see the contents of the file which is stored inside the column filename.
Jul 16 '07 #6
debasisdas
8,127 Expert 4TB
Suppose if u dont have the prvileges then connect to DBA account or ask your DBA to do the same for you and grant the privilege:

SQL> GRANT CREATE DIRECTORY TO user_name;

SQL> CREATE DIRECTORY dd AS 'd:\data';

if u want to grant previleges on the directory then.

SQL> GRANT READ ON DIRECTORY projects TO new_user;

ALL_DIRECTORIES is the data dictionary view for directories.

In the call to BFILENAME, the case used to set that directory alias must match the case originally used to define the directory alias.
Jul 16 '07 #7
debasisdas
8,127 Expert 4TB
may i know please what is the tool u are using.
Jul 16 '07 #8
dmjpro
2,476 2GB
may i know plese what is the tool u are using.

I am using pl/sql developer.
Jul 16 '07 #9
debasisdas
8,127 Expert 4TB
Column or attribute of type BFILE can not be displayed by using plsql developer or by SQL* PLUS.

u need to retrive it programitically.
Jul 16 '07 #10
dmjpro
2,476 2GB
Column or attribute of type BFILE can not be displayed by using plsql developer or by SQL* PLUS.

u need to retrive it programitically.

Please tell me the procedure to retrieve it programitically.
Jul 16 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Christopher Brandsdal | last post by:
Hi! I have a delicatg problem.... I have made a registration form for adding my friends information in a database. The problem is that I want to...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is...
0
by: Mark | last post by:
I'm trying to port the asp.net unleashed sample store from SQLServer to Access. I have it all do, execpt when I try and add something to the cart I...
6
by: Rudy | last post by:
Hello all! I am amazed how many posts I have read to store an image in SQL, and just as many against it. So I learned how to store an image in a...
1
by: rdemyan via AccessMonster.com | last post by:
I'm trying to implement a licensing scheme. There are three types of licenses: Trial - good for 30 to 60 days Interim - good for 1 year Fully...
5
by: tlyczko | last post by:
I am new to SS2005, and I've just started working on a small test/dev database. I recently read that one should store things like tables, views,...
11
by: c676228 | last post by:
Hi everyone, I am just wodering in asp program, if there is anybody writing store procedure for inserting data into database since there are so...
4
prabunewindia
by: prabunewindia | last post by:
Hello everybody, here i am going to explain, how to get mails from Outlook express database and store in our own database(local) Initially you...
0
by: harshad | last post by:
Dear All,Here I am facing problem to store image.I am trying to store byte array(image) in to session variable so at time of update I will got that...
3
by: M.-A. Lemburg | last post by:
On 2008-08-07 20:41, Laszlo Nagy wrote: 1 It also very fast at dumping/loading lists, tuples, dictionaries, floats, etc. -- Marc-Andre...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.