CallableStatement: setString(int parameterIndex, String x) : CallableStatement « java.sql « Java by API






CallableStatement: setString(int parameterIndex, String x)

 
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;

public class Main {
  static String url = "jdbc:oracle:thin:@localhost:1521:javaDemo";
  static String username = "username";
  static String password = "welcome";
  public static void main(String[] args) throws Exception {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection(url, username, password);

    CallableStatement stmt = conn.prepareCall("{call CREATE_USERS (?, ?, ?, ?, ?, ?)}");

    stmt.setString(1, "a");
    stmt.setString(2, "b");
    stmt.setString(3, "c");
    stmt.setString(4, "d");
    stmt.setString(5, "e");
    stmt.setString(6, "f");
    stmt.execute();
    conn.close();
  }
} 

   
  








Related examples in the same category

1.CallableStatement: execute()
2.CallableStatement: registerOutParameter(int parameterIndex, int sqlType)
3.CallableStatement: setInt(int parameterIndex, int x)