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 6617689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:44:04+00:00 2026-05-25T20:44:04+00:00

I have very small and simple problem but I am not getting solutions on

  • 0

I have very small and simple problem but I am not getting solutions on it.
Actually I am getting a CSV file path using file chooser.
I am entering the data in this csv file in to database using load data local infile query.

Suppose my entered file path is “C:\title.csv”
When I put this string in to query the you will see the \t combination in the path. This \t which is actually part of the file path and not the escape character ‘\t’. But the java and mysql consider it as escape character.

then I tried to replace ‘\’ in the file path string with “\\” using following code line.

String filepath="C:\title.csv";
String filepath2=filepath.replace("\\","\\\\");

Still there is not effect on the file path and it still consider the ‘\t’ as escape character.

So my question is how to solve this problem without changing the name of the file?

If we have path like

String filepath="C:\new folder\title.csv";

It will consider the \n and \t as escape character.
how to solve this problem if the name of the file or folder in path cause for escape character?

  • 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-05-25T20:44:05+00:00Added an answer on May 25, 2026 at 8:44 pm

    Use a double slash in Java string literal to escape a slash :

    String s = "c:\\new folder\\title.csv";
    

    If an end user enters a string in a JFileChooser, the string variable will contain all the characters entered by the user. Escaping is only needed when using String literals in Java source code.

    And use a prepared statement to insert strings into a database table. This will properly escape special characters and avoid SQL injection attacks. Read more about prepared statements in the Java tutorial about JDBC.

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

Sidebar

Related Questions

I have a small (500kb) swing applet that displays very simple/limited set of small
I have found that my HTML is, to be honest, very clunky. Small, simple
have small problem, and would very much appreciate help :) I should convert byte
So I am obviously not a very good programmer. I have written this small
I have a very simple file upload PHP script. I am testing with a
I´m using Kayak server for a small project. It works great, but i have
I'm a newbie with WPF and c# and have a (probably very simple) problem.
very simple problem, but i want to see how experts look at it. This
I guess this is a quite simple (read: very simple) question, but I have
I am new to this portal. I have a very simple problem to be

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.