Jan 052005
 

Not too big a accomplishment for the experienced .NET-programmer, but since I’m still learning .NET, and ODP.NET and IronPython, I think I did something great. This is the script (don’t be scared):

import sys
sys.LoadAssemblyByName('Oracle.DataAccess')
from Oracle.DataAccess import *
from Oracle.DataAccess.Client import *
OraCon = OracleConnection()
OraCon.ConnectionString = 'User Id=scott; Password=tiger; Data Source=ORCL'
OraCon.Open()
OraCmd = OraCon.CreateCommand()
OraCmd.CommandText = 'select ename from emp where deptno = 20'
OraDR = OraCmd.ExecuteReader()
while OraDR.Read(): 
    print("Employee Name: " + OraDR.GetString(0))
OraCon.Close()

And this is the output:

 Posted by at 23:32

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)