[Tutor] updating Oracle tables via python

Liam Clarke cyresse at gmail.com
Wed Mar 30 01:22:42 CEST 2005


Is that all the code? It's not going to be giving you any feedback.
Chuck a few print commands in it. 

i.e.
connection = cx_Oracle.connect("db/password at dbname")

cursor = connection.cursor()

print "Cursor created"

strUpdate = " UPDATE table SET firstname = 'JOSEPH'  WHERE lastname = 'SMITH' "

cursor.execute(strUpdate)

cursor.close()

connection.close()

print "completed"


When you query the database manually, are your changes there?


Regards, 

Liam Clarke

On Tue, 29 Mar 2005 15:16:41 -0800, Williams, Thomas
<WilliTf at dshs.wa.gov> wrote:
>  
>  
> 
> Greetings, 
> 
> I am attempting to update an Oracle table using python.  When I execute the
> code, the python script appears to hang, in that nothing else happens. 
> 
>   
> 
> As always, any assistance you can provide will be appreciated. 
> 
>   
> 
> Code: 
> 
>   
> 
> connection = cx_Oracle.connect("db/password at dbname") 
> 
> cursor = connection.cursor() 
> 
> strUpdate = " UPDATE table SET firstname = 'JOSEPH'  WHERE lastname =
> 'SMITH' " 
> 
> cursor.execute(strUpdate) 
> 
> cursor.close() 
> 
> connection.close() 
> 
>   
> 
>   
> 
> Tom Williams
>  DSHS - Research and Data Analysis Division 
>  14th and Jefferson, MS: 45204 
>  Olympia, WA  98504-5204 
>  360.902.0764 
> 
>   
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 
> 


-- 
'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.


More information about the Tutor mailing list