-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: OT: Escaping question
PostPosted: Mon May 10, 2004 10:43 am 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
Sorry, this is not really Hibernate Related but I am having problems you guys can probably help me with.

I am building an application that parses, validates and inserts large amounts of data from .csv files using JDBC. Every once in a while the data comes with characters that need to be escaped. For example the single quote. My Sybase database does not like me when I try to insert the data into a varchar() column. The problem is that I can't find a single line of documentation on how to deal with this problem. All the JDBC examples I have seen does not seem to do anything specific to support this. It all just magically work. And I have looked at examples with characters that should need escaping...

When asking coworkers about this the suggestion I get is using different datatypes (binarystream?) or that it may be a driver configuration issue. I.e you can make the driver deal with this automatically in some way. Reading the documentation on the Sybase driver (JConnect) I can't seem to find any information to that effect.

Do I really need to parse ALL the strings that I want to insert and manually escape the characters that need to be escaped? That feels kind of stupid to me... Or is there a utility method in j2se that you can use for this?

Grateful for any input on this.

/Jonas


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 10, 2004 10:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
just use Parameter placeholders and setString, the JDBC driver handles parameter escaping


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 19, 2004 4:01 am 
Beginner
Beginner

Joined: Fri Jan 02, 2004 7:07 pm
Posts: 35
I had a nagging feeling that this is how it works. Strangely I haven't found any text anywhere that confirms this. Of course my colleague (who is the kind of guy who always just does things 'the easy way') has concatenated strings together to form the SQL strings... :(

Sometimes I just want to scream.

Thanks for the information.

/Jonas


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.