How to call Oracle sqlldr in Java
Hi All:
I am using windows 2000 server with Eclipse.
In the dost prompt, I ran the file run_sqlldrTest2.cmd and it loaded record into the Oracle database.
I tried to do the same thing in java calling the run_sqlldrTest2.cmd. In java it states the "The command line job - -executed successfully."
However, I donot see the record being loaded into the database.
What am I doing wrong?
If I comment out the "cmd[2]=set PATH=C:\\OraHome_1\\bin;" line and ran RunCmd.java, on the line for P.waitFor() it would freeze there forever:
Any help for suggestions would be greatly appreciated!!
Yours,
Frustrated.
RunCmd.java:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class RunCmd
public static void main(String[] args)
Process P;
Runtime r;
r = Runtime.getRuntime();
try {
String[] cmd = new String[4];
cmd[0] = "cmd.exe";
cmd[1] = "/C";
cmd[2]="set PATH=C:\\OraHome_1\\bin;";
cmd[3]="C:\\test2009\\scripts\\run_sqlldrTest2.cmd";
try {
P = r.exec(cmd);
int Exitcode = P.waitFor();
if (Exitcode != 0)
System.out.println("The command line job did not execute successfully");
else
System.out.println("The command line job - " +
" - executed successfully."); //break
catch (Exception e)
System.out.println(" 1 e.getMessage():"+e.getMessage());
} catch (Exception e)
System.out.println("2 e.getMessage():"+e.getMessage());
run_sqlldrTest2.cmd:
set PATH=C:\\OraHome_1\\bin;
C:\test2009\scripts\run_sqlldr.cmd test2009/test2009@orcl control=C:\test\scripts\ctl\amcare.ctl log=C:\test\scripts\log\NAC20090150005112.txt.log data=C:\test\scripts\data\NAC20090150005112.txt bad=C:\test\scripts\bad_files\NAC20090150005112.txt.bad discard=C:\test\scripts\dis_files\NAC20090150005112.txt.dis;
run_sqlldr.cmd:
echo %* > C:\test2009\scripts\log\sqlldr.log
sqlldr %* >> C:\test2009\scripts\log\sqlldr.log
cmd does not support multiple commands on the same line. Your program is trying to set the path as in cmd[2] and ignoring the rest of the line. Try commenting/removing this line.
Similar Messages
-
How to call Oracle Reports via Java Web Application ?
Dear All,
I have developed a web reports using Oracle Reports 11g and would like to display these reports via Java Web App that will call them.
Kindly help me in this matter.
Regards,
Irfani will go as John suggested.........Construct a URL with required parameters and call it using goLink component
make a configuration in Report server and
http://myServer:myport/reports/rwservlet?config=myconfig&destype=cache&desformat=PDF&report=myreport.jsp&myparameter=myvalue -
How to call external files from java?
How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?Jayarathina_Madharasan wrote:
no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
From JavaRanch :
And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
Edited by: Encephalopathic on Apr 14, 2008 10:01 AM -
How to convert oracle timestamp to java timestamp
Hi,
I need to convert oracle timestamp that i got from oracle database to java timestamp.I tried to use getTimestamp() to get timestamp value from oracle, but am getting NumberFormatException.
Could any of suggest how to convert oracle timestamp to java timestamp.Thanks jverd ,
then my code will be like:
String oracleTS="11-MAR-05 11.19.20.625 AM";
// am looking for yyyy-MM-dd HH:mm:ss format
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd
HH:mm:ss");
Timestamp javaTimestamp=Timestamp.valueOf(oracleTS);
System.out.println("javaTimestamp----->>
"+javaTimestamp);
ving java.lang.NumberFormatException: For input
string: "MAR"Well, the SimpleDateFormat has to actually match the format you're trying to parse, for one thing. Then you have to actually USE the SDF, which you didn't.
You really haven't made it clear what you're trying to do, and it doesn't appear that you bothered to study the links I provided.
DateFormat df = new SimpleDateFormat("dd-MMM-yy HH.mm.ss.SSS aa");
Date date = df.parse(oracleTS);
Timestamp ts = new Timestamp(date.getTime()); -
How to Call Oracle Form From Oracle ADF
Hi All,
Version - Oracle Jdeveloper 11.1.1.5
In Oracle Adf - when i click on Button how to call oracle form?
Please help....
Thanks..
SkAnd there is a tool called oraFormFaces that has some advanced linking api to access forms etc. Do a google search to find info on this.
-
How To Call HTML Page Through Java Swing Page ???....
Hi All ;
Please Can You Tell Me How To Call HTML Page Through Java Swing Page ....
Regards ;Hi,
you can use HTML fragments on a panel.
http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
However, to integrate a browser you need 3rd party software like IceBrowser
If you Google for: HTML Swing
then you find many more hints
Frank -
How to connect oracle database with JAVA
how to connect oracle database with JAVA....
using j2sdk and Jcreator . which connector to use .. what are the code for that ..PLEASE .... Ask in an Oracle Java forum.
And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems. -
How to call gnuplot command from java
Hi there,
In our course, we are required to develop an GUI for gnuplot. In case you don't know about gnuplot, it's a plotting program and has lots of command. We want to use java and swing, but now we don't know how to call gnuplot command from java, or how to execute a shell command(script) from java.
By the way, since we need read in files with several columns of data and allow user to select a column, we want to use JTable. Is that reasonable?
Thanks a lot for any suggestions!
JackHi, there:
Will using JTable add much overhead? I may have to use several JTables and switch among them. I can add scroll bar to or edit JTables, right?
BTW, do you have experience about gnuplot? Can I find the command tree of gnuplot somewhere? Or do you know a better place to post question about gnuplot? unix/linux group, maybe.
Thanks,
Jack
P.S. Would you guys answer my question after I use up my duke dollars? :- ) -
How to call Jakarta Ant via JAVA?
Hi.
My application has a new menu. This menu creates a build.xml Ant file.
Now, when this menu is invoked , its action should call
Jakarta Ant, after creating the xml file, so that the build.xml will
do what is necessary.
How can I do it? That is, how to call the Ant via java?
Is there any way to use an Ant object?
Thanks?
Rodrigo Pimenta Carvalho.There is a slight problem in that
PorjectHelper.configureProject is deprecated, but
that is what Main calls...maybe someone else will
complete this thread with an alternative call.The javadoc recommends using the non static method parse() instead. This is available by implementing class ProjectHelperImpl. An alternative to the code above might look like this:
Project ant = new Project();
ProjectHelper helper = new ProjectHelperImpl();
ant.init();
helper.parse(ant, new File("build.xml"));
ant.executeTarget("clean");you might also want to add a logger so you can see the output of events generated by ant. The DefaultLogger class would be used like this. Simply add the code before you call the ant.init().
DefaultLogger log = new DefaultLogger();
log.setErrorPrintStream(System.err);
log.setOutputPrintStream(System.out);
log.setMessageOutputLevel(Project.MSG_INFO);
ant.addBuildListener(log); -
How to call oracle stored procedure
how to call oracle stored procedure using
jdevloper.can any one help?
thanks
pullareddyConnection conn =
DriverManager.getConnection("your connect string");
CallableStatement stm=conn.prepareCall( "{?=call getDeptName(?)}");
stm.registerOutParameter(1,OracleTypes.VARCHAR);
int deptno=10;
stm.setInt(2,deptno);
stm.execute();
String dname=stm.getString(1);
stm.close();
conn.close();
getDeptName is a function:
FUNCTION
getDeptName(id IN NUMBER) RETURN VARCHAR2... -
How to call Oracle Report 6i from a java swing/ejb codes (client server)
Hi to all.
We now have to do reports using Oracle Reports that have to call from Java Swing (interface) / EJB (Backend).
How can we call the Oracle Reports 6i from Java Swing?
Do anybody done that?...Any ideas? Where should we find the resourse, if any?
Thanks in advance and best wishes to all,
Rushdan.Hi,
6i
1) One way
Runtime.getRuntime().exec("rwcli60 report=test.rdf .... server=server_name ...<cmd line params>...");
2) From swing, open a browser and submit request programmatically
Re: Calling reports6i reports from java swing client serve application
Thanks
Ratheesh -
Call Oracle Help for Java in Oracle forms running in the web
Hi, everyone,
We are developing a web-enabled Oracle database application
system. Oracle suggested us to use Oracle Help for Java(OHJ) to
create an online help system for the web environment. We
successfully created a OHJ program which can be independently.
But we still have no idea how to call this OHJ program from the
forms running in the web environment.
Could anyone help us out?
Thanks.
nullI would like to know if anyone has been able to do this too. Could someone respond if they have successfully gotten this to work?
Thanks!! -
How to call oracle function from ejb3
i'm trying to call an oracle query-function from ejb3.
The oracle function:
create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
m_sql VARCHAR2(250);
BEGIN
m_sql:='select count(thrId) from thread where secId='|| secid||'
and thrAvai='|| avai;
open cur for m_sql;
return cur;
END;
I'v tried several ways to call it,but all failed:
1. the calling code:
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");
query.setParameter(1, secId);
query.setParameter(2, avai);
return query.getSingleResult();
but i got the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
ORA-06550: row 1, col 7:
PL/SQL: Statement ignored
2. the calling code:
@SqlResultSetMapping(name = "getSecThreadCount_Mapping")
@NamedNativeQuery(name = "getSecThreadCount",
query = "{?=call getSecThreadCount(:secId,:avai)}",
resultSetMapping = "getSecThreadCount_Mapping",
hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
@QueryHint(name = "org.hibernate.readOnly", value = "true")})
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNamedQuery("getSecThreadCount");
query.setParameter("secId", secId);
query.setParameter("avai", avai);
return query.getSingleResult();
but i run into the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
Could anyone tell me how to call the function from EJB3?
Thanks.Here's a working model:
package.procedure: (created in example schema scott)
CREATE OR REPLACE package body data_pkg as
type c_refcursor is ref cursor;
-- function that return all emps of a certain dept
function getEmployees ( p_deptId in number
return c_refcursor
is
l_refcursor c_refcursor;
begin
open l_refcursor
for
select e.empno as emp_id
, e.ename as emp_name
, e.job as emp_job
, e.hiredate as emp_hiredate
from emp e
where e.DEPTNO = p_deptId;
return l_refcursor;
end getEmployees;
end data_pkg;
/entity class:
package net.app.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedNativeQuery;
import javax.persistence.QueryHint;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@SuppressWarnings("serial")
@Entity
@Table (name="emp")
@SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
@NamedNativeQuery( name = "getEmpsByDeptId"
, query = "{ ? = call data_pkg.getEmployees(?)}"
, resultClass = Employee.class
, hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
, @QueryHint(name = "org.hibernate.readOnly", value = "true")
public class Employee implements Serializable
@Id
@Column(name="emp_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
private int id;
@Column(name="emp_name")
private String name;
@Column(name="emp_job")
private String job;
@Column(name="emp_hiredate")
private Date hiredate;
// constructor
public Employee (){}
// getters and setters
public int getId()
return id;
etc...session bean:
package net.app.entity;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
@Stateless
public class ScottAdminImpl implements ScottAdmin
@PersistenceContext
private EntityManager entityManager;
@SuppressWarnings("unchecked")
public List<Employee> getEmployeesByDeptId(int deptId)
ArrayList<Employee> empList;
try
Query query = entityManager.createNamedQuery("getEmpsByDeptId");
query.setParameter(1, deptId);
empList = (ArrayList<Employee>) query.getResultList();
return empList;
catch (Exception e)
e.printStackTrace(System.out);
return null;
}client:
package net.app.client;
import java.util.List;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import net.app.entity.Employee;
import net.app.iface.ScottAdmin;
public class ScottClient
public static void main(String[] args)
try
// create local interface
InitialContext ctx = new InitialContext();
ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
// select employees by deptno
int deptno = 20;
List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
// output
System.out.println("Listing employees:");
for (Employee emp : empList)
System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
catch (NamingException e)
e.printStackTrace(System.out);
}Basically you just ignore the refcursor outbound parameter.
This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
Edited by: _Locutus on Apr 2, 2009 2:37 PM -
How to call BPM process from Java
Hi All,
Can anybody help how to call a BPMN process from java.Please give any sample exaple on this.
Thanks,
GaneshFor 11g BPM please look at this post. Re: Getting while running the BPEL process from java
It references an ATeam example app that can start processes from a web client. But the Java APIs are described too. -
How to use Oracle objects in java code
Hi all!
I'm reading an xls and i need to fill me oracle objects with java code:
OBJECT_NAME OBJECT_TYPE
LETTURA_OBJ TYPE
LETTURA_OBJ TYPE BODY
In the past weeks i've been using both java code into oracle and oracle objects, but new i need to write those objects with data i read with java, anybody can help me?
I know that the easiest work around would be to put the data i read from the excel file into a table and then fill the oracle objects, but now i want to learn how to write directly those objects with a command like the following one:
a sample of the code i'm tryng to write:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
import java.io.*;
import java.io.IOException;
import jxl.*;
public cass ....
#sql{ variabili_globali.var_ER_F3.Tipo_Lettura := 5}
thanks,
Massimo
Edited by: LinoPisto on 16-mag-2011 16.38mmmh i'm not understanding so much....
well... as i told before i'm working in oracle database environment and i'm developing a java procedure.
now, i have this object
CREATE OR REPLACE
TYPE REPORT.FATTURA_OBJ AS OBJECT (
POD VARCHAR2(1000),
ID_FATTURA NUMBER,
ID_FILE NUMBER,
COERENZA_EA_F VARCHAR2(1000),
COERENZA_ER_F VARCHAR2(1000),
COERENZA_EA_M VARCHAR2(1000),
COERENZA_EF_M VARCHAR2(1000),
ANOMALIA VARCHAR2(1000),
MOTIVO_INVALIDAZIONE VARCHAR2(1000),
MATRICOLA_CONTATORE VARCHAR2(1000),
POTENZA_DISPONIBILE VARCHAR2(1000),
MEMBER PROCEDURE pulisci
/and i need to work with it inside this procedure:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED REPORT."Manage_Excel_ASMBS" AS
import java.io.*;
import java.io.IOException;
import java.io.StringWriter;
public class Manage_Excel_ASMBS
public static void read_Excel(String inputFile,int var_Id_Caricamento, int var_Id_Distributore, String var_Distributore) throws SQLException, IOException
**here i need to put what i'm reading inside the excel file into oracle objects**
/can you please give me a sample ?
thanks
Maybe you are looking for
-
Hi people, Hope you can help me with this problem. Adobe Reader version : 7.0.9 (although it's 7.0.8 at the about section, but i read in another thread, it's really 7.0.9) Operating System : Suse 9.2 Kernel version : 2.6.8-24-default (default install
-
Cannot upload Predefined Virsa Rules in ABAP stack. How to move on ?
Hello, we are using SAP GRC, but nevertheless we would like to try to use the ABAP stack to upload function.txt, function_BP.txt and so on. In the configuration we have set the option Rule Architect Activation to YES. Despite that, we don't see the y
-
first it is not jailbroken, tried to update it with new version from itunes that failed try to restore it that failed about halfway error message and when i connect it it comes up ipod decteded in recovery mode whats next THANK YOU
-
After installing the Quicktime 7.6 Plug-in all my MobileMe Gallery movies display upside down
This issue is only in FF 4.0. I have a 2010 Intel iMac with Mac OS 10.6.7. I create an iMovie, upload to MobileMe Gallery, a window opens asking if I'd like to 'View' the new movie, I click 'View'. After opening my MME Gallery in FF4.0 my movie is di
-
Audio books didn't load on new IPad Air
Why didn't my iTunes purchased audio books transfer from my IPad 3 to my new Air?