View Single Post
 
Old July 4th, 2006, 09:18 AM
som_dutt som_dutt is offline
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vivek!

I think you want to store the whole file into database, not the textual entries. As Praveen has posted, his approach is good, if you want to store textual entries into database that will do. But, if you want to store whole file into database, you can follow these steps -

Initial Steps :
[1] Create a table in your database. For example -
create table tbl_01 ( id int , txt_file text)
[2] Insert a value into it -
insert into table01 values(1,' ' )

[3] Type the following command in command. (Change Server, Database name)

(1) Insert into database -
In command line, Type the following (in a single line)
(Textcopy.exe located in mssql\binn directory)
------------------------------------------------
TEXTCOPY.exe -Ssrv_name -Usa -Ppassword -Ddb_name -T tbl_01 -C txt_file -F"x:\any_file.txt" -W"where id=1" -I
------------------------------------------------
Switches :
-S : server name
-U : user name
-D : database name
-T : table name
-C : column of the table
-F : file name
-W : a where query that specifies row.

(2) Out the file from database -
--------------------------------------------
TEXTCOPY.exe -Ssrv_name -Usa -Ppassword -D DB_NAME -T tbl_01 -C txt_file -F"x:\any_file.txt" -W"where id=1" -O
------------------------------------------------

In this example -
srv_name : Name of Server
DB_NAME : Name of your Database
Tbl_01 : Name of Table (Created in this demo)
txt_file : Name of column with Text data-type.
x:\any_file.txt : Full path of file to be copied.
================

Rarely we need to copy the whole file into database. Because, it was asked, i am replying you. I think this help is at basic level and you must have got it well.

But, this help is bound to SQL Server only. How these things can be done through JSP, I don't have any idea.

If you can call any application like we do in Visual Basic through - Shell(<Application Name>); you can try out the same with Java.

Reply soon ..
(As a custom, if you don't reply, I don't bother..lol)

- Som Dutt