2011-09-15 51 views
1

Windowsサーバー2008 R2(64ビット)サーバー上のデータベースをコンパクトにするためにwinformアプリケーションでJROを使用しているときに問題に直面しています。開発PCのコンパクトアクセス2007データベース64ビットWindows 2008サーバー

構成::私はステップの下に続く
OS:Windows XP Professionalの版:2002(SP3)32ビット
MSOfficeのインストール2003:はい
のVisual Studio:2010プレミアム
の.NET Framework:4.0。以下のコードで30319

二つのWinフォームアプリケーションが作成されます。

アプリケーション1:DB

アクセス2007を圧縮するために

ターゲットプラットフォームは、x86に設定されているし、Microsoft Jetとレプリケーションの追加の参照は2.6ライブラリ

設定ファイルオブジェクト:

<?xml version="1.0"?> 
<configuration> 
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/></startup> 
<appSettings> 
<add key="SourceDB" value="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Test\Test2007.accdb;Jet OLEDB:Engine Type=5"/> 
<add key="DestDB" value="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Test\Test2007BK.accdb;Jet OLEDB:Engine Type=5"/> 
<add key="AppDB" value="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\Test\Test2007.accdb;" /> 
</appSettings> 
</configuration> 

コード:

 string SrcDBName = ConfigurationManager.AppSettings["SourceDB"]; 
     string DestDBName = ConfigurationManager.AppSettings["DestDB"]; 

     int ReturnCode = 0; 
     JRO.JetEngine objJRO = null; 
     try 
     { 
      MessageBox.Show("Start Compact"); 
      objJRO = new JRO.JetEngine(); 
      objJRO.CompactDatabase(SrcDBName, DestDBName); 
      MessageBox.Show("End Compact"); 
     } 
     catch (Exception ex) 
     { 
      MessageBox.Show("Error in Compact"); 
      ReturnCode = -1; 
      StackTrace STrace = new StackTrace(ex, true); 
      StackFrame StkFrame = STrace.GetFrame(STrace.FrameCount - 1); 
      string Disp_Msg = "Message:\t" + ex.Message + Environment.NewLine; 
      Disp_Msg += "Error Date:\t" + DateTime.Now.ToString("dddd, MMM d yyyy HH:mm:ss"); 

      //MessageBox.Show(Disp_Msg, "Compact Utility", MessageBoxButtons.OK, MessageBoxIcon.Error); 
      File.AppendAllText(Path.GetDirectoryName(Application.ExecutablePath) + @"\CompactErr.txt", Disp_Msg + Environment.NewLine + "Stack Trace:\t" + ex.StackTrace + Environment.NewLine + Environment.NewLine); 
     } 
     finally 
     { 
      Marshal.ReleaseComObject(objJRO); 
      objJRO = null; 
     } 

アプリケーション2:Accessでのテスト接続のために2007

private void Form1_Load(object sender, EventArgs e) 
    { 
     try 
     { 
      //Connection Test 
      MessageBox.Show("Start DBConn"); 
      TestConn(); 
      MessageBox.Show("End DBConn"); 
     } 
     catch (Exception ex) 
     { 
      MessageBox.Show("Error in Conn Opening"); 
      string Disp_Msg = "Message:\t" + ex.Message + Environment.NewLine; 
      Disp_Msg += "Error Date:\t" + DateTime.Now.ToString("dddd, MMM d yyyy HH:mm:ss"); 
      File.AppendAllText(Path.GetDirectoryName(Application.ExecutablePath) + @"\CompactErr.txt", Disp_Msg + Environment.NewLine + "Stack Trace:\t" + ex.StackTrace + Environment.NewLine + Environment.NewLine); 
     } 
    } 

    public void TestConn() 
    { 
     string strConnectionString = ConfigurationManager.AppSettings["AppDB"]; 
     DbConnection objConnection; 
     DbProviderFactory objFactory = OleDbFactory.Instance; 

     objConnection = objFactory.CreateConnection(); 
     objConnection.ConnectionString = strConnectionString; 
     objConnection.Open(); 
     objConnection.Close(); 
    } 

今の上記2 Microsoft OfficeのAccessデータベースエンジン2010

: - :

Serverの詳細:64
NO MSOfficeの
NOのVisual Studio
インストール

Windowsサーバー2008 R2(SP1)eはWin2008サーバに配備されています

ケース1:Access DB Engine 2010(64ビット)がインストールされている場合
リンク:http://www.microsoft.com/download/en/details.aspx?id=13255

  1. アクセス2007(Test2007.accdb)への接続が正しくステップ2を実行しながらJRO働いていない
  2. エラーメッセージを使用してDBの
  3. コンパクトに行われます:

メッセージ:クラスが登録されていません
スタックトレース:JRO.IJetEngine.CompactDatabase(String SourceConnection、String Destconnection) at CompactUtility.Program.Main(String [] args)

ケース2:アクセスDBエンジン2007がインストールされています:
リンク:アクセス2007からhttp://www.microsoft.com/download/en/details.aspx?displaylang=en&id=23734

  1. 接続(Test2007。「Microsoft.ACE.OLEDB.12.0」プロバイダはローカルマシン上に登録されていない。
    メッセージ:ACCDB)ステップ1を実行中JROが正しく
  2. エラーメッセージを働い使用DBのコンパクト
  3. 行われません。

Windows Server 2008(64ビット)サーバーでの作業と、両方の問題を解決するための助言をいただきますようお願い申し上げます。

も参考リンクの下に査読ではなく:

Microsoft.ACE.OLEDB.12.0 provider is not registered

おかげで、 シャー

答えて

0

私が知っている、それは古い質問ですが、それでも、This linkは、第二の問題で私を助けていました。 正しく覚えていれば、問題はエンジンの64ビット問題に起因しています。 Visual Studioへの Adding the Componentはこの動作を修正する必要があります。

関連する問題