Ejemplo n.º 1
0
        public static string GetDBZFJ(string ip, string port, string sidtype, string sid, string uid, string pass)
        {
            string[] m_ConnectStringModel =
            {
                "DATA SOURCE =(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})) (CONNECT_DATA=(SID={2})));USER ID={3};PASSWORD ={4}",
                "DATA SOURCE =(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})) (CONNECT_DATA=(SERVICE_NAME={2})));USER ID={3};PASSWORD ={4}"
            };
            string connectstring = String.Format(m_ConnectStringModel[Convert.ToInt32(sidtype)], ip, port, sid, uid, pass);

            XMLDbHelper.FactoryDbHelper af = new XMLDbHelper.FactoryDbHelper(XMLDbHelper.DbHelperType.ORACLE, connectstring, true);
            DataSet ds = af.GetNlsDatabaseParameters();

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow[] drs = ds.Tables[0].Select("PARAMETER='NLS_CHARACTERSET'");
                if (drs.Length == 1)
                {
                    try
                    {
                        return(drs[0]["VALUE"].ToString());
                    }
                    catch { }
                }
            }
            return("");
        }