how to update databse in remote machine,i am having .sql file which i have to update my database schema in remote machine,client will provide me his machine ip address,database username,database password,database instance name...pls help me pls

package com.prion.testConnectivity;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.Reader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import com.prion.testConnectivity.ScriptRunner;;
//import com.ibatis.common.jdbc.ScriptRunner;;


public class DataBaseScript {
    /**
     * @param args
     *            the command line arguments
     */
    public static void main(String[] args) throws ClassNotFoundException,
        SQLException {

        String aSQLScriptFilePath ="C:\\export.sql";

        // Create MySql Connection
        Class.forName("oracle.jdbc.driver.OracleDriver");
        String serverName = "10.20.10.145"; // Use this server.
        String portNumber = "1521";
        String sid = "tpc";
        String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid; // for Oracle
        String username = "p6admin"; 
        String password = "system"; 

        Connection connection = DriverManager.getConnection(url, username, password);
         System.out.println("Database is connected");
        Statement stmt = null;

        try {
            // Initialize object for ScripRunner

            ScriptRunner sr = new ScriptRunner(connection, false, false);

            // Give the input file to Reader
            Reader reader = new BufferedReader(
                               new FileReader(aSQLScriptFilePath));

            // Exctute script
            sr.runScript(reader);

        } catch (Exception e) {
            System.err.println("Failed to Execute" + aSQLScriptFilePath
                    + " The error is " + e.getMessage());
        }
    }
}

problem : this code is working fine and updated all the tables but not packages(packages contains "SELECT" Statement" pls help me out

Proble

i had tryied using batch file

@ECHO OFF
CLS
sqlplus -S username/password@10.10.10.10/databaseInstanceName @C:\export.sql
ECHO.
ECHO script run successfully!!
ECHO.
PAUSE
EXIT

Note: This script is working and updating all the tables and packages but the problem here is in local machine oracle is not installed then it will not work pls help me out

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.