从命令行执行以下命令是成功的,但是从Java类执行同一命令会引发“无效的SQL语句”错误。
EXPDP DCR/DCR2017 DIRECTORY=D33 DUMPFILE=DCR.DMP SCHEMAS=DCR
Java代码:
String sql ="EXPDP DCR/DCR2017 DIRECTORY=D33 DUMPFILE=DCR.DMP SCHEMAS=DCR";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection connection = DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/orcl","DCR","DCR2017");
PreparedStatement prepareStatement = connection.prepareStatement(sql);
boolean execute = prepareStatement.execute();
System.out.println(execute);