Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:47:42+00:00 2026-06-10T03:47:42+00:00

I am trying to convert from MS Access to DerbyDB. However some varchar fields

  • 0

I am trying to convert from MS Access to DerbyDB. However some varchar fields have ‘special’ characters, such as newlines, tabs, percent marks, foreign characters etc.

I created a quick method…

public String charCheck(String s)
{


    errLog.add(1, "converting string from " + s);
    s.replaceAll("'", "''");//an apostrophe is escaped with an apostrophy in Derby...
    s.replaceAll("%", "\\%");//a percent sign
    s.replaceAll("\\s+n", " ");//whitespace characters (newlines and tabs etc)
    s.replaceAll("/", "\\/");//the 'divide' \ character, 
    s.replaceAll("<", "\\<");//mathematical symbol less than
    s.replaceAll(">", "\\>");//mathematical symbol greater than
    errLog.add(1, "to " + s);

    return s;
}//end method

Which I run whenever I determine that I need a varchar (or long varchar) data type. The strange thing is that my error log prints out the messages, but in the output whitespace characters do not appear to change (ie tabs and new lines, do not get converted to a simple space) and any apostrophe in the string is not replaced.

a sample of the output of this method produces the following.

converting string from 2.   FIN DE L’ESSAI
to 2.   FIN DE L’ESSAI

So the string remains obviously unchanged, which upsets derbyDB when I run the insert statement, also I am not finding any obvious documentation on the escape sequence for inserting multiple records into a table, I would like to use a statement then add the escape keyword after it, ie

stmt.execute("{call "+ sqlInsertStatement +"}{escape '" + escapeCharacter +"'" );

I also read from the docs that the escape keyword may not be usefull in the above statement, if so how can I te

I need to know where to go to sort the insert error that I get.

If I copy and past the insert statement directly into ij, then remove the special characters the record will insert fine, I just don’t understand why it isn’t being converted in the first instance.

I have also tried surrounding varchar and longvarchar fields with double quotes, but again derby kicks out an error saying that a double quote was found!

I want to get this sorted as I feel like I am so close…

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:47:44+00:00Added an answer on June 10, 2026 at 3:47 am

    Strings are immutable, all operations you perform on them results new Strings. You need to assign current reference to new String.

    Example:

    s= s.replaceAll("'", "''");

    If it is just replace, then replace() may be best option than using replaceAll()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is some code that I'm trying to convert from IList to IEnumerable :
Trying to convert output from a rest_client GET to the characters that are represented
I am trying to convert some pages from my app to use cfc's, and
I'm trying to convert some code from Richfaces 4 showcase to use CDI instead
I am trying to convert some code from perl to php. Perl code looks
I'm trying to convert some code from C# to C so that it can
I'm trying to convert an animation from cocos2d to cocos2d-x but to no avail.
I am trying to convert a date from yyyy-mm-dd to dd-mm-yyyy (but not in
I'm trying to convert my site from using tables to just using css and
I am new to JAVA, I am trying to convert an input from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.