구조는 이렇습니다...
지금 현재는 ASP.NET --> 웹서비스(SQL 작성) --> com+ 호출 구조입니다.
<ASP.NET>
Dim oDataSet As New DataSet()
Dim oDAL As New ZAA010T()
fnQuery = ""
Try
fnQuery = oDAL.GetZaa010T(sMajorCd, sCodeName, oDataSet) ---> 웹서비스 호출
If fnQuery <> "" Then Throw New Exception(fnQuery)
rptSheet1.DataSource = oDataSet
rptSheet1.DataBind()
Catch err As Exception
fnQuery = "[fnQuery]" & vbCrLf & err.Source & vbCrLf & err.Message & vbCrLf & fnQuery
Finally
If Not oDataSet Is Nothing Then
oDataSet.Dispose()
oDataSet = Nothing
End If
oDAL.Dispose()
oDAL = Nothing
End Try
======================================================================================================
<웹서비스>
Dim oDAL As New FSBCtrlWeb.CInvoke()
Dim sSQL As New StringBuilder("")
SetZaa010T = ""
Try
sSQL.Remove(0, sSQL.Length)
sSQL.AppendLine("INSERT INTO ZAA010T(MAJOR_CD, MINOR_CD, CODE_NAME, REF_CD1, REF_CD2, REF_CD3) VALUES ( ")
sSQL.AppendLine(" '" & sMajorCd & "',")
sSQL.AppendLine(" '" & sMinorCd & "',")
sSQL.AppendLine(" '" & sCodeName & "',")
sSQL.AppendLine(" '" & sRefCd1 & "',")
sSQL.AppendLine(" '" & sRefCd2 & "',")
sSQL.AppendLine(" '" & sRefCd3 & "') ")
SetZaa010T = oDAL.ExecuteSQL(sSQL.ToString) ---> com+ 호출
If Not SetZaa010T.Equals("") Then Throw New Exception(SetZaa010T)
Catch err As Exception
SetZaa010T = err.Source & vbCrLf & err.Message & vbCrLf & SetZaa010T
Finally
oDAL.Dispose()
oDAL = Nothing
sSQL = Nothing
End Try
================================================================================
<com+>
[AutoComplete]
public string ExecuteSQL(string sSQL)
{
string rtnVal = "";
FSBCtrlWeb.Tx oDAL = new FSBCtrlWeb.Tx();
try
{
rtnVal = oDAL.ExecuteSQL(sSQL); ---> sql 실행 함수 호출
if (rtnVal != "") throw new Exception(rtnVal);
-------- 오류발생
StringBuilder sSQL2 = new StringBuilder("");
sSQL2.Remove(0, sSQL.Length);
sSQL2.AppendLine("INSERT INTO ZAA010T(MAJOR_CD, MINOR_CD, CODE_NAME, REF_CD1, REF_CD2, REF_CD3) VALUES ( ");
sSQL2.AppendLine(" '88',");
sSQL2.AppendLine(" '88',");
sSQL2.AppendLine(" '88',");
sSQL2.AppendLine(" '88',");
sSQL2.AppendLine(" '88',");
sSQL2.AppendLine(" '88') ");
rtnVal = oDAL.ExecuteSQL(sSQL2.ToString());
if (rtnVal != "") throw new Exception(rtnVal);
-------
ContextUtil.SetComplete();
return "";
}
catch(Exception err)
{
ContextUtil.SetAbort();
return err.Source + "\n" + err.Message + "\n" + rtnVal;
}
finally
{
}
}
================================================================================
< SQL 실행함수>
[AutoComplete]
public string ExecuteSQL(string sSQL)
{
OracleConnection oConn = null;
OracleCommand oComm = null;
int sRtnVal = 0;
try
{
oConn = new OracleConnection(GetConnString());
oConn.Open();
oComm = new OracleCommand(sSQL, oConn);
sRtnVal = oComm.ExecuteNonQuery();
return "";
}
catch (Exception err)
{
return err.Source + "\n" + err.Message;
}
finally
{
oComm.Dispose();
oComm = null;
if (oConn != null && oConn.State != ConnectionState.Closed)
{
oConn.Close();
}
}
}
================================================================================
위와 같은 구조로 되어 있는데...요는
com+ 에서 하나의 함수에서 SetComplete 혹은 SetAbort 를 하는데....
SQL 을 하나만 실행한다는 보장이 없거든여.....하나의 함수에서 INSERT , UPDATE, SELECT 등 여러개의 문장이 있을 수 있는데...
그래서 SQL을 실행만을 전담하는 com+(?) 을 따로 만들어서 사용하고 싶은데....
[Transaction(TransactionOption.Required, Isolation = TransactionIsolationLevel.ReadCommitted), JustInTimeActivation(true),
EventTrackingEnabled(true)] 와 같은 속성을 어떻게 설정을 해야 하는지요?
예를 들어...
SELECT 만을 실행하는 함수가 GetRecordset, insert, update 등을 실행하는 함수가 ExecuteSQL 로 가정하면...
임의함수 COM+ aaaa 에서 GetRecordSet, ExecuteSQL 함수를 호출 할 경우 트랜잭션이 함께 묶이는지요?
그런 구조를 만들고 싶은데....조언 좀 부탁합니다...
ps. 이야기가 잘 전달이 되었는지...
[최초 등록일: ]
[최종 수정일: 9/21/2006]