[IronPython] [python] IronPython and Oracle

Michael Foord fuzzyman at voidspace.org.uk
Wed Aug 29 22:19:19 CEST 2007


Hello Jane,

I hope you don't mind, but I added your example code to the IronPython 
cookbook:

http://www.ironpython.info/index.php/Oracle_%26_OleDb

All the best,


Michael Foord

jane janet wrote:
>
> Dear Everybody,
>
>  I installed Oracle Database 10/g/ Express Edition (Universal) on the 
> Server Host.
>
> And then, I used Ironpython access this database on server host by 
> Microsoft OLE DB Provider for Oracle. It's work.
>
> * *
>
> *import clr*
>
> *import System*
>
> *clr.AddReference("System.Data")*
>
> *from System.Data import DataSet *
>
> *from System.Data.OleDb import OleDbConnection, OleDbDataAdapter, 
> OleDbCommand*
>
> *conStr = "Provider=MSDAORA.1;User ID=name;Password=pwd;Persist 
> Security Info=False"*
>
> *con = OleDbConnection(conStr)*
>
> *query = "SELECT * FROM TEST"*
>
> *adapter = OleDbDataAdapter(query,con)*
>
> *ds = DataSet()*
>
> *con.Open()*
>
> *adapter.Fill(ds,"t1")*
>
> *for i in range(ds.Tables["t1"].Rows.Count -1 ):*
>
> *print ds.Tables["t1"].Rows[i][0]*
>
> *print ds.Tables["t1"].Rows[i][1]*
>
> *print ds.Tables["t1"].Rows[i][2]*
>
> *con.Close()*
>
> But my problem is I can't access Oracle Server side from client side 
> by the same provider.
>
> I changed conStr to this
>
> conStr = """Provider=MSDAORA.1;User ID=name;Password=pwd;
>   (DESCRIPTION=(CONNECT_DATA=(SID =XE)
>   (CID=(PROGRAM=C:\WINDOWS\system32\Rundll32.exe)
>   (HOST=hostname)(USER=name)))
>   (ADDRESS=(PROTOCOL=TCP)(HOST=xx.yy.zz.ww)
>   (PORT=1521)))"""
>
> I got EnvironmentError: ORA-12560: TNS:protocol adapter error
>
> I don't know how to solve this problem.
>
> Please help me everything i missed and everything i should know. What 
> I should do or change something, please tell me.
>
> Thank you.
>
>
>
>  
>
>  
>
>
> ------------------------------------------------------------------------
> Puzzles, trivia teasers, word scrambles and more. Play for your chance 
> to win! <http://g.msn.com/8HMAENUS/2728??PS=47575>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   




More information about the Ironpython-users mailing list