将Lotus Notes数据库导入Access / SQL - 文档怎么样?

时间:2010-09-21 13:12:39

标签: sql ms-access lotus-notes lotus-domino

我有一些Lotus Notes'数据库',我想将其导入Access或SQL。

我认为我已经完成了大部分步骤(安装NotesSQL ODBC驱动程序,设置ODBC连接到Lotus DB,将数据导入Access),但我无法弄清楚如何处理所有文档,例如:Word Files ,PDF文档,Lotus DB中的Excel工作簿。

Lotus Notes DB充满了它们。导入后,我注意到Access中的一个名为“Documents”的表,但我不知道如何处理它。我在Lotus DB中看到每个文档的行/记录,但它不像SQL那样有实际文件数据的列。

请告诉我如何实际使用我从Lotus DB中提取的文档。

1 个答案:

答案 0 :(得分:2)

最好的办法是从数据库中提取文档并将其存储在文件共享中。这将为您提供最大的灵活性。要保留与原始Notes文档的关联,您可能希望将它们与文件名一起导出,或者导出到文件夹名称包含Access中相关记录的ID的文件夹中。或者至少确保记录包含文档的路径。

我不相信你可以通过NotesSQL驱动程序提取附件。

以下是一个示例脚本,您可以将其放入代理程序以从数据库中提取附件:(来自http://www.notes411.com/dominosource/tips.nsf/0/4F1FF33C52F08D76802570C2003A2FD6!opendocument

Sub Initialize 
      Dim session As New NotesSession 
      Dim db As NotesDatabase 
      Dim collection As NotesDocumentCollection 
      Dim doc As NotesDocument 
      Set db = session.CurrentDatabase 
      Set collection = db.UnprocessedDocuments 
      Set doc = collection.GetFirstDocument() 
      While Not(doc Is Nothing) 
            Call extractMyAttachment( doc ) 
            Set doc = collection.GetNextDocument(doc) 
      Wend 
End Sub 

Function extractMyAttachment (doc) 
      Dim emb As Variant 
      Dim nid As String 

      nid = doc.NoteID 

      Dim rtitem As Variant 

      Set rtitem = doc.GetFirstItem( "Body" ) 

      Dim pathName As String, fileName As String, mydir As String, 
newfilename As String 
      mydir = "Coda" 
      pathName$ = "P:\" & mydir 

      fileName$ = Dir$(pathName$, 16) 

      Dim boxType As Long, answer As Integer 
      boxType& = 36 

      If fileName$ = "" Then 
            answer% = Messagebox("Directory "& pathName$ &" does not exist, 
would you like to create it ?", boxType&, "Create" & mydir & " on P:\ ?") 
            If answer% = 6 Then 
                  Mkdir pathname$ 

                  fileName$ = Dir$(pathName$, 16) 

                  If filename$ <> "" Then 
                        If ( rtitem.Type = RICHTEXT ) Then 

                              Forall o In rtitem.EmbeddedObjects 
                                    If ( o.Type = EMBED_ATTACHMENT ) Then 
                                          newfilename$ = pathname$ & "\" & 
o.source 
                                          Call o.ExtractFile (newfilename$ 
) 
                                    End If 
                              End Forall 

                        End If 
                  End If 
            End If 

      Else 
            If ( rtitem.Type = RICHTEXT ) Then 

                  Forall o In rtitem.EmbeddedObjects 
                        If ( o.Type = EMBED_ATTACHMENT ) Then 
                              newfilename$ = pathname$ & "\" & o.source 
                              fileName$ = Dir$(NewFileName$, 0) 
                              If fileName$ <> "" Then 
                                    answer% = Messagebox("File "& 
NewFileName$ &" already exists, would you like to overwirite it ?", 
boxType&, "Overwrite" & NewFileName$ & " ?") 
                                    If answer% = 6 Then 
                                          Call o.ExtractFile (newfilename$ 
) 
                                    End If 
                              Else 
                                    Call o.ExtractFile (newfilename$ ) 
                              End If 

                        End If 
                  End Forall 

            End If 
      End If 
End Sub