Home » Developer & Programmer » JDeveloper, Java & XML » JAVA and PL/SQL
JAVA and PL/SQL [message #220417] Tue, 20 February 2007 10:47
sjcp21
Messages: 16
Registered: February 2007
Junior Member
Hi again,
I am trying to use java to see the listing of a specific file in a directory and then inserting the values in the table.
The file does exist with 777 on the directory.
When I use elementINdexOf loop it doesn't work. Here is the code:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED APPS."XXCA_CNOTE_FILE" AS
// Purpose: This procedure is used to load CNOTE filenames into
// a table (xxca_cnote_temp_table) for ACH Project.
//
// MODIFICATION HISTORY
// Person Date Comments
// --------- ------ -------------------------------------------
//
import java.io.*;
import java.sql.*;
public class XXCA_CNOTE_FILE
{
public static void getList(String directory)
throws SQLException
{
File path = new File( directory);
String[] list = path.list();
String element;

for(int i = 0; i < list.length; i++)
{
element = list[i];
/****#sql {insert into xxca_cnote_temp_table(dir_name)
VALUES (:element)};****/
System.out.println("Test");
if (element.indexOf("sj_test1.txt") > 0) // process only CNOTE* files
{
#sql {insert into xxca_cnote_temp_table (dir_name)
VALUES (:element)};
}
}
#sql {commit};
}

}
/
How can I debug it to find the element value.

Thanks again
Previous Topic: Alternatives to using DB Links
Next Topic: Problem in loadjava on unix
Goto Forum:
  


Current Time: Sun Nov 24 13:52:20 CST 2024