windows powershell: execute select against an oracle instance. (System.Data.OracleClient)

in no way a powershell guy, but

powershell script:


[Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient") > null

 $connection=New-Object DATA.OracleClient.OracleConnection(
    "Data Source=eoxi;User Id=eoxrep;Password=***"
    )
   
 $connection.Open()
 $reader = (new-Object DATA.OracleClient.OracleCommand(
    "select * from eox.eox_log_ereignis_a where rownum < 10",
    $connection)).ExecuteReader()

 while( $Reader.Read()) {
    $id   = $reader["log_id"]
    $time = $reader["log_log_area"]
    write-output "$id $time"
 }
 $connection.Close()



executes as:

oracle select

GAC    Version        Location
---    -------        --------
True   v2.0.50727     C:\Windows\assembly\GAC_32\System.Data.OracleClient
174063524 ww Data Import: ISIN nicht gefunden: LU0097188931
174063532 ww Data Import: ISIN nicht gefunden: DE000A0MQR19
174063533 ww Data Import: ISIN nicht gefunden: LU0418839287
174063534 ww Data Import: ISIN nicht gefunden: LU0418837232
174063538 ww Data Import: ISIN nicht gefunden: DE000A1J3N83
174063507 gateUpload Startup
174063511 V-Buchungsdatum: 25.03.2015 00:00:00
174063512 Fonds werden geladen...
174063514 Fonds (12123) laden beendet 03:40:14.1277410.

Kommentare

Beliebte Posts aus diesem Blog

using the birt runtime with spring boot and gradle to generate PDF from a Report Design File

Debugging angular 4 Jasmin/Karma tests with Visual Studio Code