Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes A small Sql Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "A small Sql Question " Watch "A small Sql Question " New topic
Author

A small Sql Question

Sim Raina
Ranch Hand

Joined: Nov 20, 2003
Posts: 33
i am trying to insert data into sql database and the data comes from a file and gets transferred directly to the database. the problem is that one of my fields is to collect pathnames. now whenever the data reaches the databases the slashes are gone
for ex if the path in the datafile is like \\rhino\users\vol1\sim
then in the database it will be like \rhinousersvol1sim
one way to correct is like adding one more \ after every \ but since it going directly i can't, i was just wondering if there is a way to tell the sql to ignore the slashes


if u can't impress people with ur intelligence , confuse them with ur bullshit
Sim Raina
Ranch Hand

Joined: Nov 20, 2003
Posts: 33
does anybody know anything about it?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
A couple of questions:
What is the database?
How is the data being transfered? You said it is automatically, how is it automated? A DTS package on SQL server, a chron job, a scheduled task?


Dave
Sim Raina
Ranch Hand

Joined: Nov 20, 2003
Posts: 33
it is a mysql datbase , basically i have this log file and it has the data in it so i wrote a java program to parse through the data file and make them into fields and then put into a mysql datatbase now one of the fields in the datat file carry a path for ex \\flag\someting\something
now when this gets transferred to a database it changes to \flagsometingsomething
so i was looking for a way to enforce sql not to ignore "\"
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Sim
Check out the Strings section of the MySQL manual. The \ is an escape character so you'll have to use the \\ to get a single \ into your table. You might want to write a simple method to escape all of the single \ in your String before inserting them.
hope that helps
Sim Raina
Ranch Hand

Joined: Nov 20, 2003
Posts: 33
thanks , yeah i inserted "\" by using indexof method
thanks bud
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A small Sql Question
 
Similar Threads
PL/SQL table values to JDBC
Check Table's Relationships
Is Hibernate a good choice for 'dumping' data from another database?
Including files in a jsp from different machine
Search query is taking too long to search