程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> Java應用JDBC或MyBatis框架向Oracle中拔出XMLType數據

Java應用JDBC或MyBatis框架向Oracle中拔出XMLType數據

編輯:關於JAVA

Java應用JDBC或MyBatis框架向Oracle中拔出XMLType數據。本站提示廣大學習愛好者:(Java應用JDBC或MyBatis框架向Oracle中拔出XMLType數據)文章只能為提供參考,不一定能成為您想要的結果。以下是Java應用JDBC或MyBatis框架向Oracle中拔出XMLType數據正文


本文實例講述了C#加密app.config中銜接字符串的辦法。分享給年夜家供年夜家參考。詳細以下:

銜接字符串中包括數據庫的拜訪信息,帳號和暗碼,是以普通不以明文顯示,本代碼用來加密銜接字符串。

public static class EncryptConnection
{
  public static void EncryptConnectionString(bool encrypt)
  {
   Configuration configFile = null;
   try
   {
    // Open the configuration file and retrieve the connectionStrings section.
    configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
    ConnectionStringsSection configSection = configFile.GetSection("connectionStrings") as ConnectionStringsSection;
    if ((!(configSection.ElementInformation.IsLocked)) && (!(configSection.SectionInformation.IsLocked)))
    {
     if (encrypt && !configSection.SectionInformation.IsProtected)
     //encrypt is false to unencrypt
     {
      configSection.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
     }
     if (!encrypt && configSection.SectionInformation.IsProtected)
     //encrypt is true so encrypt
     {
      configSection.SectionInformation.UnprotectSection();
     }
     //re-save the configuration file section
     configSection.SectionInformation.ForceSave = true;
     // Save the current configuration.
     configFile.Save();
    }    
   }
   catch (System.Exception ex)
   {
    throw (ex);
   }
   finally
   {
   }
  }
}

願望本文所述對年夜家的C#法式設計有所贊助。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved