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