hI Jai
         There is no direct way to execute a sql file.
Either you code that part as a batch statement.
And executebatch.

Statement smt = con.createStatement();
stmt.addBatch("INSERT INTO COFFEES" +
              "VALUES('Amaretto', 49, 9.99, 0, 0)");
stmt.addBatch("INSERT INTO COFFEES" +
              "VALUES('Hazelnut', 49, 9.99, 0, 0)");
stmt.addBatch("INSERT INTO COFFEES" +
              "VALUES('Amaretto_decaf', 49, 10.99, 0, 0)");
stmt.addBatch("INSERT INTO COFFEES" +
              "VALUES('Hazelnut_decaf', 49, 10.99, 0, 0)");

stmt.executeBatch();

otherwise write a stored procedure
execute it through stored procedure.


Anil


-----Original Message-----
From: Jai Ganesh, Balasubramaniam
[mailto:[EMAIL PROTECTED]]
Sent: Friday, January 05, 2001 10:52 AM
To: [EMAIL PROTECTED]
Subject:
Importance: High


Hi

I have an SQL file named as job.sql.
To execute this file in SQL* Plus(Oracle Server) we use
SQL> Start job.sql (its works fine)

But i  need to execute this file thru Java program (using JDBC)
I tried as below

                        Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con = DriverManager.getConnection(" ");
                        Statement stmt = con.createStatement();
                        stmt.executeQuery("start job.sql");

but it is not working.
can u pls help me out guys to run Start job.sql file thru java program.
Is there any command in java for executing .sql file directly.

Thanks & Regards
Jaiganesh

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to