p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Java > Other Java > Java Databases
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 2nd, 2007, 12:04 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 4th, 2007, 06:58 AM
Friend of Wrox
Points: 1,108, Level: 13
Points: 1,108, Level: 13 Points: 1,108, Level: 13 Points: 1,108, Level: 13
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 363
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 5th, 2007, 02:30 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
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!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old June 5th, 2007, 08:25 AM
Friend of Wrox
Points: 1,108, Level: 13
Points: 1,108, Level: 13 Points: 1,108, Level: 13 Points: 1,108, Level: 13
Activity: 2%
Activity: 2% Activity: 2% Activity: 2%
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 363
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 01: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 05:44 AM
Upload a Text file from a Web Client to SQL Server petercyriljones Classic ASP Professional 0 May 20th, 2005 11:26 AM
SQL 2000 database / text file / binary file pallone Javascript How-To 3 January 28th, 2005 01:26 PM



All times are GMT -4. The time now is 12:45 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc