i want call stored procedure name (mytable1) of oracle 10g in below code of struts. how ?
import java.sql.*; public class loginuser { public string username; public string password; public string execute() { connection con; statement stmt; resultset rs; try { class.forname("oracle.jdbc.driver.oracledriver"); con=drivermanager.getconnection("jdbc:oracle:thin:@localhost:1521:xe","gaurav","oracle"); stmt=con.createstatement(); rs=stmt.executequery(" how call procedure"); } catch(classnotfoundexception e) { } catch(sqlexception ex) { } } public string getpassword() { return password; } public void setpassword(string m) { this.password = m; } public string getusername() { return username; } public void setusername(string username) { this.username = username; } }
below procedure :
create or replace procedure mytable1 (tname varchar2) stmt varchar2(1000); begin stmt := 'create table '||tname || '(username varchar2(20) ,password varchar2 (10))'; execute immediate stmt; end;
Comments
Post a Comment