473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 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 10484
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 connect the persons with companies in the same...
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 the simplest way to do it and what should I be...
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 geet this error: Exception Details:...
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 SQL db and retrieve the image. A little tricky,...
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 Paid - no expiration Everything is working fine...
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, constraints, etc. in the *.ndf file rather than...
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 many parameters need to be passed into store...
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 have to add the refference Outlook library10.0 or...
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 byte array and I do my update. here i am given...
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 Lemburg eGenix.com
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.