I am using a DSN connection to an Oracle database and am having problems with getting the syntax correct for stored procedures/fucntions. Below is what I have so far:
This function is working
var password varchar2(70);
exec
assword := cascade.ae.get_password('srider');
print password;
returns
PASSWORD
--------------------------------------------------------------------------------------------------------------------------------
wRFSg8UAUJ2OHj0ZNoSeOAAw55o=
gave me
public bool validate_account(string account, string password) {
//this._dbc = new OdbcCommand("cascade.ae.get_password");
//this._dbc = new OdbcCommand("ae.get_password");
this._dbc = new OdbcCommand("get_password");
this._dbc.CommandType = CommandType.StoredProcedure;
//this._dbc.Parameters.Add("@v_account", OdbcType.VarChar, 70);
//this._dbc.Parameters["@v_account"].Value = account;
//this._dbc.Parameters["@v_account"].Direction = ParameterDirection.Input;
this._dbc.Parameters.Add("v_account", OdbcType.VarChar, 70);
this._dbc.Parameters["v_account"].Value = account;
this._dbc.Parameters["v_account"].Direction = ParameterDirection.Input;
OdbcParameter op = this._dbc.Parameters.Add("@results", OdbcType.VarChar, 70);
op.Direction = ParameterDirection.Output;
execute_nonquery(this._dbc);
string results = (string)op.Value;
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] buffer1 = new ASCIIEncoding().GetBytes(password);
byte[] buffer2 = sha.ComputeHash(buffer1);
sha.Clear();
return results == Convert.ToBase64String(buffer2) ? true : false;
}
private void execute_nonquery(OdbcCommand cmd) {
cmd.Connection = this._db;
this._db.Open();
try {
// test stored password with supplied password
cmd.ExecuteNonQuery();
} catch (Exception ex) {
// future error trapping
this._log.exception(ex.Message);
}
this._db.Close();
}
This function is working
var password varchar2(70);
exec
print password;
returns
PASSWORD
--------------------------------------------------------------------------------------------------------------------------------
wRFSg8UAUJ2OHj0ZNoSeOAAw55o=
gave me
public bool validate_account(string account, string password) {
//this._dbc = new OdbcCommand("cascade.ae.get_password");
//this._dbc = new OdbcCommand("ae.get_password");
this._dbc = new OdbcCommand("get_password");
this._dbc.CommandType = CommandType.StoredProcedure;
//this._dbc.Parameters.Add("@v_account", OdbcType.VarChar, 70);
//this._dbc.Parameters["@v_account"].Value = account;
//this._dbc.Parameters["@v_account"].Direction = ParameterDirection.Input;
this._dbc.Parameters.Add("v_account", OdbcType.VarChar, 70);
this._dbc.Parameters["v_account"].Value = account;
this._dbc.Parameters["v_account"].Direction = ParameterDirection.Input;
OdbcParameter op = this._dbc.Parameters.Add("@results", OdbcType.VarChar, 70);
op.Direction = ParameterDirection.Output;
execute_nonquery(this._dbc);
string results = (string)op.Value;
SHA1 sha = new SHA1CryptoServiceProvider();
byte[] buffer1 = new ASCIIEncoding().GetBytes(password);
byte[] buffer2 = sha.ComputeHash(buffer1);
sha.Clear();
return results == Convert.ToBase64String(buffer2) ? true : false;
}
private void execute_nonquery(OdbcCommand cmd) {
cmd.Connection = this._db;
this._db.Open();
try {
// test stored password with supplied password
cmd.ExecuteNonQuery();
} catch (Exception ex) {
// future error trapping
this._log.exception(ex.Message);
}
this._db.Close();
}