File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes insert problem with special characters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "insert problem with special characters" Watch "insert problem with special characters" New topic
Author

insert problem with special characters

visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi,

I am querying a web service and am getting this value from a particular field: File H:\100���������������\�����������\�����������.exe: detected virus ''IM-Worm.Win32.Sohanad.t''. When i try to insert into the database, it gives an error--Invalid Character. I am not sure how to handle this scenario. Could anyone guide me how to handle this?

Thanks,
Visu Nekk
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
Is the database field configured to accept binary data (which is what that looks to me)? Or is the text encoded in Unicode (I can't tell from the post) - then the DB needs to be set up to use Unicode.


Ping & DNS - updated with new look and Ping home screen widget
visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi Ulf,

I tried to insert the same record from sqlplus prompt, and it worked. Maybe it's from Java side.

Thanks,
Visu Nekk
Selva jai
Greenhorn

Joined: Aug 08, 2007
Posts: 6
[ UD: Hijack removed. Please start a new topic for questions unrelated to this one. ]
[ January 25, 2008: Message edited by: Ulf Dittmer ]
visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi,

Any update on the mentioned query? What character set is it exactly and how to handle it? Please guide me.

Thanks,
Visu Nekk
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
If you answered the questions I asked we might be able to help. Otherwise, we don't have enough information to go by.
[ January 25, 2008: Message edited by: Ulf Dittmer ]
visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi Ulf,

Unicode support is enabled on the database. The application is deployed in jboss on a linux box and we are using a data source to obtain a database connection. Does it have anything to do with jboss?

Thanks,
Visu Nekk
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
OK. And is the data actually Unicode? Or is it binary?
visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi Ulf,

From the web, I found the data to be ISO character set.

Thanks,
Visu Nekk
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
So does that mean your problem is solved?
visu Nekk
Ranch Hand

Joined: Sep 06, 2005
Posts: 122
Hi Ulf,

I am unable to figure it out. The insert statement is a batch update that worked fine on test database. Please help me, what could have been the problem.

Thanks,
Visu Nekk
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39535
    
  27
Have you figured out if what you're trying to insert is valid text (however encoded) or if binary characters have slipped in?

Which character is it that triggers the exception (if you don't know, capture the message and try to insert it manually, leaving off character by character until the error no longer occurs).
Sidd Nakade
Greenhorn

Joined: Feb 20, 2006
Posts: 8
Is that \ creating problem. does that need an escape character if used in JAVA.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: insert problem with special characters
 
Similar Threads
Error in executeQuery() on callableStatement
How to handle connection failure
HiberNate with <sql-insert
CachedRowSet
forum regarding insert data