IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Exécuter la commande SQLLDR avec vb.net


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Homme Profil pro
    Inscrit en
    Mars 2010
    Messages
    366
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations forums :
    Inscription : Mars 2010
    Messages : 366
    Par défaut Exécuter la commande SQLLDR avec vb.net
    Bonjour,

    Je voudrai exécuter la commande SQLLDR avec .net

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    Dim startInfo As ProcessStartInfo
            Dim pStart As New Process()
            pStart = New Process()
            startInfo = New ProcessStartInfo("C:\\oracle\\product\\10.2.0\\client_1\\BIN\\sqlldr.exe", " user/pwd@schema control=c:\\oracle\\sqlloader\\job.ctl LOG=c:\\oracle\\sqlloader\\job.log")
            pStart.StartInfo = startInfo
            pStart.Start()
            pStart.WaitForExit()
    malgré que la commande tourne bien sur cmd

  2. #2
    Membre éclairé
    Homme Profil pro
    Inscrit en
    Mars 2010
    Messages
    366
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations forums :
    Inscription : Mars 2010
    Messages : 366
    Par défaut
    J'ai essayé avec ce code
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
     Dim pp As New System.Security.SecureString
                pp.AppendChar("x")
                pp.AppendChar("x")
                pp.AppendChar("x")
                pp.AppendChar("x")
                Dim batpath As String
                batpath = "c:\test.bat"
                Dim process As New Process
                process.StartInfo.FileName = batpath
                process.StartInfo.CreateNoWindow = True
                process.StartInfo.UserName = "Administrateur"
                process.StartInfo.Password = pp
                process.StartInfo.UseShellExecute = False
                process.Start()
                process.WaitForExit()
    mais rien ne se fait, malgré que je n'ai pas reçu d'erreurs

    qq a un avis?

  3. #3
    Membre éclairé
    Homme Profil pro
    Inscrit en
    Mars 2010
    Messages
    366
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations forums :
    Inscription : Mars 2010
    Messages : 366
    Par défaut
    J'ai fais comme ça maintenant
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     Dim cmd As String
                cmd = "C:\oracle\product\10.2.0\client_1\BIN\sqlldr USERID=user/pwd@schema CONTROL=c:\oracle\sqlloader\job.ctl LOG=c:\oracle\sqlloader\job.log "
     
     
                ' ******* Lancement de la commande
                Dim retour As Integer
                retour = WshShell.Run(cmd, 0, True)
    Response.Write(retour.ToString)
                WshShell = Nothing
    le problème que le retour est égale à 4
    j'ai mis dans cmd, un fichier .bat qui copie un fichier d'une répertoire à un autre et ça marche nickel
    est ce que quelqu'un connait comment analyser le retour (4) du run?

    Merci

  4. #4
    Membre éclairé
    Homme Profil pro
    Inscrit en
    Mars 2010
    Messages
    366
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations forums :
    Inscription : Mars 2010
    Messages : 366
    Par défaut
    solution
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    Dim proc As New Process
     
                Dim mycommand As String
                mycommand = "CMD.EXE"
     
                proc.StartInfo = New ProcessStartInfo(mycommand)
                proc.StartInfo.Arguments = "/c SQLLDR user/pwd@schema CONTROL=C:\oracle\sqlloader\job.ctl LOG=C:\oracle\sqlloader\job.log"
                proc.StartInfo.RedirectStandardOutput = True
                proc.StartInfo.RedirectStandardError = True
                proc.StartInfo.UseShellExecute = False
                proc.StartInfo.WorkingDirectory = "C:\oracle\sqlloader"
                proc.Start()
                proc.WaitForExit()
    If proc.ExitCode = 0 Then
                    Response.Write("insertion faite")
     
                Else
                    Response.Write(proc.StandardError.ReadToEnd)
                End If

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Exécution de commandes SHELL avec SharpSSH
    Par belaidw dans le forum Services Web
    Réponses: 0
    Dernier message: 29/09/2009, 05h00
  2. Exécuter une commande DOS avec VB.net 2005
    Par peregna2007 dans le forum VB.NET
    Réponses: 2
    Dernier message: 20/08/2008, 11h42
  3. [Système] Exécuter une commande java avec exec()
    Par kenny49 dans le forum Langage
    Réponses: 2
    Dernier message: 05/06/2007, 09h29
  4. Exécuter une commande système avec perl
    Par Olivier Regnier dans le forum Langage
    Réponses: 12
    Dernier message: 08/04/2007, 16h41
  5. Exécution de commande Windows avec Telnet
    Par blackstreet dans le forum Réseau
    Réponses: 2
    Dernier message: 02/02/2007, 13h38

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo