Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2007, 11:04 PM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to insert text file in sql server database

Dear Members,
I want to know how to insert text file in sql server database field (having text data type) using java and jdbc technology. i want to store it by java program. As i want to do full text indexing on that field.
plz help me. Waiting for reply!!!!!!!!!!



Regards
sharvari

 
Old June 4th, 2007, 05:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
You can use PreparedStatement for this and let the database driver handle the conversion. For example you've two columns in your table like

table name is myTable and two columns are
 myId integer
 myText text datatype

[code]
String sql = "INSERT INTO MYTABLE VALUES(?,?)";
String text = "some text";
PreparedStatement st = connection.prepareStatement(sql);
st.setInt(1, 12345);
st.setObject(2,text);
st.executeUpdate();
[code]

Hope it solves your problem.

Regards,
Rakesh
 
Old June 5th, 2007, 01:30 AM
Registered User
 
Join Date: Jun 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,
thanks for reply. But i need to read .doc file & insert it into database. I m trying with BLOB & CLOB. Yet not completed.
bye!

 
Old June 5th, 2007, 07:25 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

hi,

Quote:
quote:Originally posted by sharvari_mothe
 Hi,
thanks for reply. But i need to read .doc file & insert it into database. I m trying with BLOB & CLOB. Yet not completed.
bye!
Have a look at the following links, might be helpful to you

http://www.samspublishing.com/articl...p?p=26251&rl=1
http://publib.boulder.ibm.com/infoce...c/rjvjdata.htm
http://www.datadirect.com/developer/...sics/index.ssp

Regards,
Rakesh





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert Data from Excel file to SQL server yes_no ASP.NET 1.0 and 1.1 Professional 5 August 27th, 2008 12:46 AM
Save a text file on SQL Server petercyriljones SQL Server DTS 2 January 3rd, 2007 07:35 AM
Bulk Insert to Sql Server from .txt file avats BOOK: Beginning VB.NET Databases 1 June 3rd, 2005 04:44 AM
Upload a Text file from a Web Client to SQL Server petercyriljones Classic ASP Professional 0 May 20th, 2005 10:26 AM
SQL 2000 database / text file / binary file pallone Javascript How-To 3 January 28th, 2005 01:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.