I am trying to run the Oracle build Java statement.
We have got a callbell statment to avoid troubles with question marks. Setting up the sync process was incorrect, this works well for most of our statements, but in case of a Java switch statement, The given exception is found:
java.sql.SQLException: unavailable on the index or parameter: 1
I think it has something to do with the colon used in the switch statement is.
Here's an example of this problem:
JDBCTest.java
package jdbctest; Import java.io.buffferedReader; Import java.io.FileInputStream; Import java.io.IOException; Import java.io.InputStreamReader; Import java.sql.CallableStatement; Import java.sql.Connection; Import java.sql.DriverManager; Public class JDBCTest {Public Static Zero Main (String [] Args) Exception {String Data = Picture ("/ TMP / Demo SQL") throws; Connection Conn = Null; Callable template callstat = empty; Try {string driver = "oracle.jdbc.driver.OracleDriver"; String url = "jdbc: oracle: thin: @ 193.53.40.220: 1521: aura11"; String user name = ""; String password = ""; Class.forName (driver); Conn = DriverManager.getConnection (URL, Username, Password); Conn.setAutoCommit (wrong); CallStat = conn.prepareCall (data); CallStat.setEscapeProcessing (wrong); CallStat.execute (); } {{CallStat.close ()}} Hold {Exception {}} {conn.close ()}} Hold (Exception Ex) {}}} Personal String String Reading Script (string filename) throws IOException {StringBuilder stringBuilder = New stringbilder (); Buffer Reader = Faucet; Try {string currentLine; Reader = new buffed reader (new input striker reader (new file inputstream (filename), "ISO-885 9-1"); While ((current line = reader. Readline ()) = null {currentLine = currentLine.replaceAll ("^ \\ s + $", ""); CurrentLine = currentLine.replaceAll ("\\ S + $", " Finally, try {{}} reader.close ();} hold (exception before) {}} return stringbilder .tosting ();}} Create or re-create package JDBCTest as Java> Source Code> Demo.SQL Java Source Name "JDBCTest"; Public class demo { Public Zero Test () {int a = 3; Switch (A) {Case 1: System. Case: System.out.println ("3"); breakdown; ojdbc6 on an 11gR2 Oracle database; .jar (as a JDBC driver).
Comments
Post a Comment