Re: Doubt related to using JAVA calling it via PL/SQL and recording data in the local machine

  • From: Karth Panchan <keyantech@xxxxxxxxx>
  • To: "ecandrietta@xxxxxxxxx" <ecandrietta@xxxxxxxxx>
  • Date: Tue, 5 Nov 2013 09:35:23 -0500

Did you check asktom.oracle.com?
 
Tom Kyte have answer for this question.
 
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:439619916584

HTH
Karth

Sent from my IPhone 

> On Nov 5, 2013, at 8:01 AM, Eriovaldo Andrietta <ecandrietta@xxxxxxxxx> wrote:
> 
> Hello ,
> 
> I have the code below and would like to know if it is possible record file in 
> my machine and not in the oracle server.
> 
> We are using:
>                        BufferedWriter out = new BufferedWriter(new 
> FileWriter("file_backupparam.conf"));
> to specify the file name 
> 
> We tried putting the path of the file , but without sucess.
> 
>                        BufferedWriter out = new BufferedWriter(new 
> FileWriter("d:\file_backupparam.conf"));
> 
> Best Regards
> Eriovaldo
> 
> 
> Start of the code:
> 
> create or replace and compile java source named selecttables as
> import java.sql.*;
> import java.io.*;
> import oracle.jdbc.*;
> 
> public class SelectTables{
> 
>        public static void exportTables(){
>                try{
>                        Connection connection = 
> DriverManager.getConnection("jdbc:default:connection:");
>                        
>                        Statement statement = connection.createStatement();
>                
>                        BufferedWriter out = new BufferedWriter(new 
> FileWriter("file_backupparam.conf"));
>                        
>                        String query = "select table_name " +
>                                                        " from user_tables " +
>                                                        " where (table_name 
> not like '%_VE' " +
>                                                        " AND table_name NOT 
> LIKE 'MDRT%') " +
>                                                        " AND NOT EXISTS 
> (SELECT 1 " +
>                                                        " FROM CACHE_VWS_CFG " 
> +
>                                                        " WHERE VWS_NAME = 
> table_name)";
>                                                        
>                        ResultSet resultset = statement.executeQuery(query);
>                        
>                        out.write("TABLES=( \n");
>                        
>                        while(resultset.next()){
>                                out.write(resultset.getString("TABLE_NAME") + 
> ",\n");
>                        }
>                        
>                        out.write("DB_INFO_BKP, USER_SDO_GEOM_METADATA_BKP, 
> BKP_INDEX_DDL)");
>                        
>                        out.close();
>                        statement.close();
>                        connection.close();
>                }
>                catch(Exception e){
>                }
>        }
> }
> / 
> 
> 
> 
> create or replace
> FUNCTION FSelectTables RETURN VARCHAR2 AS
> LANGUAGE JAVA NAME 'SelectTables.exportTables () return java.lang.String';
> 
> create or replace
> PROCEDURE PSelectTables
> AS
> my_string varchar2(400 char);
> begin
> my_string:=FSelectTables();
> dbms_output.put_line('The value of the string is ' || my_string);
> end;
> 
> 
> begin 
>   PSelectTables;
> end;
> /
>   
> 

Other related posts: