[Zope] Z Oracle Database Connections

Oleg Broytmann Oleg Broytmann <phd@phd.fep.ru>
Tue, 26 Jun 2001 19:31:05 +0400 (MSD)


On Tue, 26 Jun 2001, John Wormington wrote:
> BadRequest: <strong>Invalid connection string:
> </strong><CODE>username/password@server</CODE><br>
>
> OracleError
> (12154, 'ORA-12154: TNS:could not resolve service name')
> ********************************
>
> Now by looking at it I initially thought that it was an oracle problem.
> However out oracle admin showed me that she could log into that same box and
> use sqlplus and get data back.  I have to now look into how to trouble shoot
> either ZOracleDA or DCOracle.  Has anyone ran into these Database Connection
> strings suddenly failing?

   To start debugging the problem, wrote a simple Python program and try to
connect to the server. Something like this:

#! /usr/local/bin/python -O

jwt = None

import os
os.environ["ORACLE_HOME"] = "/usr/local/oracle/app/oracle/product/8.0.5"
os.environ["NLS_LANG"] = "AMERICAN_AMERICA.CL8KOI8R" # Russian Cyrillic KOI8-R

def jwt_connect(login="xxx", password="yyy", SID="jwt"):
   global jwt
   from DCOracle import Connect
   jwt = Connect("%s/%s@%s" % (login, password, SID))

jwt_connect()

import sys

cursor = jwt.cursor()
format = "%s | "*13 + "%s\n"

cursor.execute("SELECT * FROM sides_view")
while 1:
   olist = cursor.fetchmany(10)
   if not olist: break
   for row in olist:
      sys.stdout.write(format % row)

cursor.close()
jwt.close()

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.