I want to run a .sql f开发者_StackOverflow社区ile from java without using jdbc on windows 7. I am trying with java runtime class which executes the system commands. But my java is running with only user privileges and the command needs Administrator privileges. The command that am using to run is "sqlplus /nolog @sqlscript.sql".
You need either JDBC, or a 3rd party software+sufficient rights.
No other way. (If we don't count low-level DB access, which would be an overkill)
I was able to do it by installing oracle client as the logged in user(We need to hold the shift key and right click on the exe and select Run as different user). Also we need to set oracle home in non primary partition of the hard diski.e., not where OS is installed. After doing this if i pass a command like "sqlplus /nolog @test.sql" to the Java Runtime class, it executes the script. This works in only win 7 Ultimate and above. Win 7 Home and starter editions does not support this.
精彩评论