• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Invalid character encountered

 
Satej Koli
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

There is a scheduled batch job in my application which reads a text file and inserts/updates the processed data into some database tables. The batch job code is first invoked from a shell script which then calls a Jar which then does further job of calling database code to populate some tables.

This job was working fine till yesterday. However, it failed with an error 'Invalid character encountered' today. I observed that there is a special character ú in the text file. I then tried to replicate the issue on my machine. I have the java code setup for the job in Eclipse Helios. So for my local code setup, I just copied the text file to my machine then updated properties file to read the text file from my machine and executed the job. But the job did not throw any exception.

I also executed an update statement on my Toad to update a column with a string containing ú and it worked.

Please help me to find out why it failed as a scheduled batch job. Thanks in Advance
 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which machine are you using, which encoding, and where are you displaying that character?
Some versions of the Windows® terminal display £ as ú.
See if you can get the hex value of the char displayed, and you can check whether it is the same as you expected.
 
Satej Koli
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure where to check the encoding. I am using Windows XP. I am not dispalying that character. It's there in the text file which I got from other team.


I want to replicate the issue on my machine. I just noticed that the shell script contains following lines:

CLASSPATH=$ORACLE_HOME/jdbc/lib/classes12.jar:$ORACLE_HOME/jdbc/lib/nls_charset12.jar:$CLASSPATH

Is this a reason for failure? How can I do this in Eclipse.

Thanks.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49841
70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don’t know.
If the ú was in the original file, there may be an error occurring on the other computer. If the two charsets are different, who knows what will go wrong.
Start by reading this while you are waiting, and ask whoever sent you the file what charset and encoding they were using.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That line adds JDBC drivers from local Oracle installation into the classpath. It is somewhat strange, as it needlessly depends on the local installation of Oracle. It is much more common to ship the JDBC driver with the application.

Also, these files indicate the driver is pretty old. See our Oracle FAQ page to get more information about driver/database compatibility; there are also links to newer Oracle JDBC drivers.

In my opinion there are two possibilities for the difference:
  • Your machine uses different JDBC driver that the original machine: perhaps your drivers are newer and handle the character well.
  • The locale of your machine differs from the locale of the original machine: this could cause the file to be read using different encoding (assuming you don't specify an encoding when reading the file).

  •  
    Satej Koli
    Greenhorn
    Posts: 4
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi, the batch job is on a unix server. while my machine uses Windows xp. i will try to use the same jars used the job and run the code.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic