domenica 19 maggio 2013

Powershell and Oracle: the strange couple

Here it is a nice guide to query an OracleDB using Powershell.
Basically install an Oracle Client (with .NET support), and define and use the following function (courtesy of PoshCode comunity):


function Get-OLEDBData ($connectstring, $sql) {            
   $OLEDBConn = New-Object System.Data.OleDb.OleDbConnection($connectstring)            
   $OLEDBConn.open()            
   $readcmd = New-Object system.Data.OleDb.OleDbCommand($sql,$OLEDBConn)            
   $readcmd.CommandTimeout = '300'            
   $da = New-Object system.Data.OleDb.OleDbDataAdapter($readcmd)            
   $dt = New-Object system.Data.datatable            
   [void]$da.fill($dt)            
   $OLEDBConn.close()            
   return $dt            
}
 
 
A test is here:

$connString = "password=pwd;User ID=id;Data Source=ambarabaciccicocco;Provider=OraOLEDB.Oracle"            
$query= "SELECT * FROM HR.DEPARTMENTS"            
Get-OLEDBData -connection $connString -sql $query

Here are the guides:
http://guyharrison.typepad.com/oracleguy/2008/01/accessing-oracl.html
http://sev17.com/2010/02/28/querying-oracle-from-powershell-part-1/
http://cmille19.wordpress.com/2010/03/01/querying-oracle-from-powershell-part-2/

Enjoy!
Sayonara

lunedì 6 maggio 2013

XenServer 5.6 and prblem with the xapi service

If the xapi service cannot start, or experiencing some problem with the xsconsole, try this:

http://support.citrix.com/article/CTX128316