You are right Jorge, the comment #PostgreSQL... and #Oracle... was
exchanged.... but every thing else is ok.
ora.cfg has a bduri like this:
sqlalchemy.dburi="oracle://pippo:[email protected]:1521/mydb"
dev.cfg has a dburi like this:
sqlalchemy.dburi="postgresql://pg:[email protected]:5434/pg"
I created this table in both dbs:
create table database (name varchar(20));
then I inserted this row into oracle db:
insert into database values('Oracle v10g');
and this one in pg db:
insert into database values('PostgreSQL v8.4.7');
the first access to oracle works...
engine = get_engine()
print engine.execute('select name from database').fetchall()
[(u'Oracle v10g',)]
but the second one, do not.
engine = get_engine()
print engine.execute('select name from database').fetchall()
[(u'Oracle v10g',)]
----------
# -*- coding: utf-8 -*-
import turbogears
from turbogears.database import get_engine
#Oracle...
turbogears.update_config(configfile='ora.cfg', modulename="sicer.config")
sql='select name from database'
engine = get_engine()
print engine.execute(sql).fetchall()
#PostgreSQL...
turbogears.update_config(configfile='dev.cfg', modulename="sicer.config")
sql='select name from database'
engine = get_engine()
print engine.execute(sql).fetchall()
Jorge Godoy wrote:
Are you sure you have the names correct?
There is no "name" column on a "database" table on PostgreSQL by
default. And it is also an interesting name choice to name the
PostgreSQL configuration file as "ora.cfg"...
--
Jorge Godoy <[email protected] <mailto:[email protected]>>
On Fri, Oct 28, 2011 at 11:44, jo <[email protected]
<mailto:[email protected]>> wrote:
Hi all,
I'm trying to write a script to access to PostgreSQL and Oracle,
like this:
# -*- coding: utf-8 -*-
import turbogears
from turbogears.database import get_engine
#PostgreSQL...
turbogears.update_config(configfile='ora.cfg',
modulename="sicer.config")
sql='select name from database'
engine = get_engine()
print engine.execute(sql).fetchall()
#Oracle...
turbogears.update_config(configfile='dev.cfg',
modulename="sicer.config")
sql='select name from database'
engine = get_engine()
print engine.execute(sql).fetchall()
I was hoping to be logged on to the 2 databases, one at a time, but...
[(u'Oracle v10g',)]
[(u'Oracle v10g',)]
Could someone help me?
j
--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
To unsubscribe from this group, send email to
[email protected]
<mailto:turbogears%[email protected]>.
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.
--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.
--
Jose Soares
Sferacarta Net
Via Bazzanese 69
40033 Casalecchio di Reno
Bologna - Italy
Ph +39051591054
fax +390516131537
web:www.sferacarta.com
Le informazioni contenute nella presente mail ed in ogni eventuale file
allegato sono riservate e, comunque, destinate esclusivamente alla persona o
ente sopraindicati, ai sensi del decreto legislativo 30 giugno 2003, n. 196. La
diffusione, distribuzione e/o copiatura della mail trasmessa, da parte di
qualsiasi soggetto diverso dal destinatario, sono vietate. La correttezza,
l’integrità e la sicurezza della presente mail non possono essere garantite. Se
avete ricevuto questa mail per errore, Vi preghiamo di contattarci
immediatamente e di eliminarla. Grazie.
This communication is intended only for use by the addressee, pursuant to
legislative decree 30 June 2003, n. 196. It may contain confidential or
privileged information. You should not copy or use it to disclose its contents
to any other person. Transmission cannot be guaranteed to be error-free,
complete and secure. If you are not the intended recipient and receive this
communication unintentionally, please inform us immediately and then delete
this message from your system. Thank you.
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en.