How to set in java program that is registered on oracle db- character set for Polish sings

Viewed 95

Im running a program in java, registered in oracleDB. I have a 11.0.2.4 version of oracle DB. What im trying to achieve is to import files from some folder with polish sings. So far program is importing data, but it changes the polish sings. Im not into java very much, but i read that i have to set:

Locale.setDefault(new Locale("Polish", "Poland", "pl_PL"));

Which i already did, and it is not working. Entire program looks like (from PLSQL) :

CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED SCHEMA."DirListClass" AS
import java.io.*;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class DirListClass
{
public static void getList(String directory)
                   throws SQLException
{
    Locale.setDefault(new Locale("Polish", "Poland", "pl_PL"));
    File path = new File( directory );
    String[] list = path.list();
    String element;

    File fileObject;
    long length;
    String dateStr, type;
    Date now = new Date();
    SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy H:m:s");

    for(int i = 0; i < list.length; i++)
    {
        element = list[i];
        fileObject = new File(directory + File.separatorChar + list[i]);
        length = fileObject.length();
        if (fileObject.isDirectory()) {
          type = "d";
        } else if (fileObject.isFile()) {
          type = "f";
        } else {
          type = "?";
        }

        java.util.Date d = new java.util.Date(fileObject.lastModified());
        dateStr = format.format(d);

        #sql { INSERT INTO dir_list(filename,length, mod_date, type)
               VALUES (:element, :length, to_date(:dateStr,'dd-mm-yyyy hh24:mi:ss'), :type) };
    }
}
}

For example: Instead of import: "ż" It imports: "Ĺş" Any ideas?

0 Answers
Related