ODBC avec iseries V7R1
Bonjour. Voilà j'ai un gros souci depuis notre changement de version d'OS sur notre iseries (V5R4 ------->V7R1). J'ai pas mal d'agent planifié automatique qui exportait des données des applications lotus vers des fichiers physiques iseries. Déjà lors de notre passage en V5R4 ça ne fonctionnait plus et ibm avait donné comme solution de contournement la création d'une dtaara sur notre iseries :
CRTDTAARA DTAARA(QSYS/QSQCLICON) TYPE(*CHAR) LEN(7) VALUE(*PRVCHK)
Cette solution n'est plus supportée avec la nouvelle version. Quelqu'un connait-il la marche à suivre ? Merci par avance de votre aide. Ci - dessous un exemple d'un agent tel qu'il fonctionnait en V5R4 :
Option Public
Uselsx "*LSXODBC"
Sub Initialize
On Error Goto Erreur_Code
Dim con As New OdbcConnection
Dim Requete As New OdbcQuery
Dim Res As New OdbcResultset
Dim result As ODBCResultSet
Dim firstName As String
Dim Doc As NotesDocument
Dim Doc1 As NotesDocument
Dim collection As NotesDocumentCollection
Dim session As New NotesSession
Dim db As NotesDatabase
Dim scritere As String
Dim view As NotesView
Set con = New ODBCConnection
Set db = New NotesDatabase( "INTRANET/FGA/FR", "sgeneraux.nsf" )
Set qry = New ODBCQuery
Set result = New ODBCResultSet
Set qry.Connection = con
Set result.Query = qry
Set session = New NotesSession
Set DB = Session.CurrentDatabase
Call con.Connectto("S65181CC","LOTUS")
Set view = db.GetView("all")
Set Doc = view.GetFirstDocument
While Not ( doc Is Nothing )
nombresiok = nombresiok +1
Set Doc = view.GetNextDocument( doc )
Wend
scritere ={form = "saisie" }
Set collection = DB.Search(scritere,Nothing,0)
If Not collection Is Nothing Then
If collection.Count > 0 Then
Set Doc = collection.GetFirstDocument
While Not(doc Is Nothing)
nombre = nombre + 1
Set Requete.Connection = con
Requete.SQL = _
"INSERT INTO EXPLOTUS.PFINCID2 (NUMINC, DATE, AUTEUR, TYPINC, PENCPT, PECPAR, DATPEC, GESTIO, DCLOTU, HCLOTU, CLOPAR, STATUT, REGLE, RENPAR, HEURE, COPIE, SEVER, DOS, HOS ) VALUES (' " & Doc.nincident(0) & " ' , ' " & Doc.date(0) & " ' , ' " & Doc.auteur(0) & " ' , ' " & Doc.tincident(0) & " ', ' " & Doc.penc(0) & " ' , ' " & Doc.pecpar(0) & " ' ,' " & Doc.dpec(0) & " ', ' " & Doc.externe(0) & " ', ' " & Doc.dateregle(0) & " ' , ' " & Doc.heurclot(0) & " ' , ' " & Doc.reglepar(0) & " ', ' " & Doc.statut(0) & " ' , ' " & Doc.ouinon(0) & " ' , ' " & Doc.personnescal(0) & " ', ' " & Doc.heure(0) & " ' , ' " & Doc.copie(0) & " ' , ' " & Doc.severite(0) & " ', ' " & Doc.dateos(0) & " ',' " & Doc.hos(0) & " ')"
Set Res.query = Requete
Res.execute
Set Doc = collection.GetNextDocument(doc)
Wend
Exit Sub
End If
End If
Exit Sub
Erreur_Code :
Set doc1 = New NotesDocument( db )
Messagebox "Erreur de l'agent d'export des incidents SG : " & Str(Err) & ": " & Error$ & " à la ligne : " & Cstr(Erl)
Doc1.Form = "Memo"
Doc1.SendTo = "Pierre DUPONT"
Doc1.Subject = "Export des incidents SG"
Doc1.body = "Un problème s'est produit lors de l'export quotidien des incidents SG. Merci d'informer l'administrateur Domino"
Call Doc1.Send( False )
CRTDTAARA DTAARA(QSYS/QSQCLICON) TYPE(*CHAR) LEN(7) VALUE(*PRVCHK)
Cette solution n'est plus supportée avec la nouvelle version. Quelqu'un connait-il la marche à suivre ? Merci par avance de votre aide. Ci - dessous un exemple d'un agent tel qu'il fonctionnait en V5R4 :
Option Public
Uselsx "*LSXODBC"
Sub Initialize
On Error Goto Erreur_Code
Dim con As New OdbcConnection
Dim Requete As New OdbcQuery
Dim Res As New OdbcResultset
Dim result As ODBCResultSet
Dim firstName As String
Dim Doc As NotesDocument
Dim Doc1 As NotesDocument
Dim collection As NotesDocumentCollection
Dim session As New NotesSession
Dim db As NotesDatabase
Dim scritere As String
Dim view As NotesView
Set con = New ODBCConnection
Set db = New NotesDatabase( "INTRANET/FGA/FR", "sgeneraux.nsf" )
Set qry = New ODBCQuery
Set result = New ODBCResultSet
Set qry.Connection = con
Set result.Query = qry
Set session = New NotesSession
Set DB = Session.CurrentDatabase
Call con.Connectto("S65181CC","LOTUS")
Set view = db.GetView("all")
Set Doc = view.GetFirstDocument
While Not ( doc Is Nothing )
nombresiok = nombresiok +1
Set Doc = view.GetNextDocument( doc )
Wend
scritere ={form = "saisie" }
Set collection = DB.Search(scritere,Nothing,0)
If Not collection Is Nothing Then
If collection.Count > 0 Then
Set Doc = collection.GetFirstDocument
While Not(doc Is Nothing)
nombre = nombre + 1
Set Requete.Connection = con
Requete.SQL = _
"INSERT INTO EXPLOTUS.PFINCID2 (NUMINC, DATE, AUTEUR, TYPINC, PENCPT, PECPAR, DATPEC, GESTIO, DCLOTU, HCLOTU, CLOPAR, STATUT, REGLE, RENPAR, HEURE, COPIE, SEVER, DOS, HOS ) VALUES (' " & Doc.nincident(0) & " ' , ' " & Doc.date(0) & " ' , ' " & Doc.auteur(0) & " ' , ' " & Doc.tincident(0) & " ', ' " & Doc.penc(0) & " ' , ' " & Doc.pecpar(0) & " ' ,' " & Doc.dpec(0) & " ', ' " & Doc.externe(0) & " ', ' " & Doc.dateregle(0) & " ' , ' " & Doc.heurclot(0) & " ' , ' " & Doc.reglepar(0) & " ', ' " & Doc.statut(0) & " ' , ' " & Doc.ouinon(0) & " ' , ' " & Doc.personnescal(0) & " ', ' " & Doc.heure(0) & " ' , ' " & Doc.copie(0) & " ' , ' " & Doc.severite(0) & " ', ' " & Doc.dateos(0) & " ',' " & Doc.hos(0) & " ')"
Set Res.query = Requete
Res.execute
Set Doc = collection.GetNextDocument(doc)
Wend
Exit Sub
End If
End If
Exit Sub
Erreur_Code :
Set doc1 = New NotesDocument( db )
Messagebox "Erreur de l'agent d'export des incidents SG : " & Str(Err) & ": " & Error$ & " à la ligne : " & Cstr(Erl)
Doc1.Form = "Memo"
Doc1.SendTo = "Pierre DUPONT"
Doc1.Subject = "Export des incidents SG"
Doc1.body = "Un problème s'est produit lors de l'export quotidien des incidents SG. Merci d'informer l'administrateur Domino"
Call Doc1.Send( False )