2005年09月19日 星期一 21:38
我下了cx_Oracle,按照例子写如下:
import cx_Oracle
def connection():
connection = cx_Oracle.connect("admin","martin","test")
cursor = connection.cursor()
cursor.execute("select 1 from dual")
count,=cursor.fetchone()
print "reurn result ",count
if __name__=="__main__":
print "connecting.................." 
connection()
print "end"
其中,我的oracle的 TNSNAMES.ORA 文件如下:
test=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>)(PORT 
= 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test)
)
)
我想问一下 cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗?
可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的,
pytho的错误如下:
connecting..................
Traceback (most recent call last):
File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel-
connection()
File "D:/workspace/project/python/OracleTest.py", line 4, in connection
connection = cx_Oracle.connect("etasadmin","etasadmin","etas")
DatabaseError: ORA-12154: TNS: 无法处理服务名
谢谢。
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050919/0061daa1/attachment.html
2005年09月19日 星期一 21:46
....
大哥,你是不是打错了
 connection = cx_Oracle.connect("etasadmin","etasadmin","etas")
                                                         ^^^^
----------------------- Original Message -----------------------
From:    "martin.xus" <martin.xus at gmail.com>
To:      python-chinese at lists.python.cn
Date:    Mon, 19 Sep 2005 21:38:24 +0800
Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。
----------------------------------------------------------------
> 我下了cx_Oracle,按照例子写如下:
> 
> import cx_Oracle
> 
> def connection():
> connection = cx_Oracle.connect("admin","martin","test")
> cursor = connection.cursor()
> cursor.execute("select 1 from dual")
> count,=cursor.fetchone()
> print "reurn result ",count
> 
> if __name__=="__main__":
> print "connecting.................." 
> connection()
> print "end"
> 
> 其中,我的oracle的 TNSNAMES.ORA 文件如下:
> 
> test=
> (DESCRIPTION =
> (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>)(PORT 
> = 1521))
> )
> (CONNECT_DATA =
> (SERVER = DEDICATED)
> (SERVICE_NAME = test)
> )
> )
> 
> 我想问一下 cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗?
> 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的,
> 
> pytho的错误如下:
> connecting..................
> 
> Traceback (most recent call last):
> File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel-
> connection()
> File "D:/workspace/project/python/OracleTest.py", line 4, in connection
> connection = cx_Oracle.connect("etasadmin","etasadmin","etas")
> DatabaseError: ORA-12154: TNS: 无法处理服务名
> 
> 
> 谢谢。
--------------------- Original Message Ends --------------------
2005年09月19日 星期一 21:49
不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 后面那个etas是不是就是oracle配置文件那个啊? 在我的机器上没跑通,我用的是oracle8。 On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > .... > 大哥,你是不是打错了 > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > ^^^^ > ----------------------- Original Message ----------------------- > From: "martin.xus" <martin.xus at gmail.com> > To: python-chinese at lists.python.cn > Date: Mon, 19 Sep 2005 21:38:24 +0800 > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > ---------------------------------------------------------------- > > 我下了cx_Oracle,按照例子写如下: > > > > import cx_Oracle > > > > def connection(): > > connection = cx_Oracle.connect("admin","martin","test") > > cursor = connection.cursor() > > cursor.execute("select 1 from dual") > > count,=cursor.fetchone() > > print "reurn result ",count > > > > if __name__=="__main__": > > print "connecting.................." > > connection() > > print "end" > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > test= > > (DESCRIPTION = > > (ADDRESS_LIST = > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>< > http://192.168.0.160>)(PORT > > = 1521)) > > ) > > (CONNECT_DATA = > > (SERVER = DEDICATED) > > (SERVICE_NAME = test) > > ) > > ) > > > > 我想问一下 cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > pytho的错误如下: > > connecting.................. > > > > Traceback (most recent call last): > > File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel- > > connection() > > File "D:/workspace/project/python/OracleTest.py", line 4, in connection > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > 谢谢。 > > --------------------- Original Message Ends -------------------- > > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050919/de13ecb1/attachment-0001.htm
2005年09月19日 星期一 21:57
你这样写 con = cx_Oracle.connect( 'user/pass at service' ) ----------------------- Original Message ----------------------- From: "martin.xus" <martin.xus at gmail.com> To: python-chinese at lists.python.cn Date: Mon, 19 Sep 2005 21:49:06 +0800 Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 ---------------------------------------------------------------- > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > 后面那个etas是不是就是oracle配置文件那个啊? > 在我的机器上没跑通,我用的是oracle8。 > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > .... > > 大哥,你是不是打错了 > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > ^^^^ > > ----------------------- Original Message ----------------------- > > From: "martin.xus" <martin.xus at gmail.com> > > To: python-chinese at lists.python.cn > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > ---------------------------------------------------------------- > > > 我下了cx_Oracle,按照例子写如下: > > > > > > import cx_Oracle > > > > > > def connection(): > > > connection = cx_Oracle.connect("admin","martin","test") > > > cursor = connection.cursor() > > > cursor.execute("select 1 from dual") > > > count,=cursor.fetchone() > > > print "reurn result ",count > > > > > > if __name__=="__main__": > > > print "connecting.................." > > > connection() > > > print "end" > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > test= > > > (DESCRIPTION = > > > (ADDRESS_LIST = > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>< > > http://192.168.0.160>)(PORT > > > = 1521)) > > > ) > > > (CONNECT_DATA = > > > (SERVER = DEDICATED) > > > (SERVICE_NAME = test) > > > ) > > > ) > > > > > > 我想问一下 cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > pytho的错误如下: > > > connecting.................. > > > > > > Traceback (most recent call last): > > > File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel- > > > connection() > > > File "D:/workspace/project/python/OracleTest.py", line 4, in connection > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > 谢谢。 > > > > --------------------- Original Message Ends -------------------- > > > > > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > --------------------- Original Message Ends --------------------
2005年09月19日 星期一 22:02
还是一样 import cx_Oracle def connection(): connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) cursor = connection.cursor() cursor.execute('select 1 from dual') count,=cursor.fetchone() print 'reurn result ',count if __name__=='__main__': print 'connecting..................' connection() print 'end' ---------------- Traceback (most recent call last): File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel- connection() File "D:/workspace/project/python/OracleTest.py", line 4, in connection connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) DatabaseError: ORA-12154: TNS: 无法处理服务名 On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > 你这样写 > con = cx_Oracle.connect( 'user/pass at service' ) > > ----------------------- Original Message ----------------------- > From: "martin.xus" <martin.xus at gmail.com> > To: python-chinese at lists.python.cn > Date: Mon, 19 Sep 2005 21:49:06 +0800 > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > ---------------------------------------------------------------- > > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > > 后面那个etas是不是就是oracle配置文件那个啊? > > 在我的机器上没跑通,我用的是oracle8。 > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > .... > > > 大哥,你是不是打错了 > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > ^^^^ > > > ----------------------- Original Message ----------------------- > > > From: "martin.xus" <martin.xus at gmail.com> > > > To: python-chinese at lists.python.cn > > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > ---------------------------------------------------------------- > > > > 我下了cx_Oracle,按照例子写如下: > > > > > > > > import cx_Oracle > > > > > > > > def connection(): > > > > connection = cx_Oracle.connect("admin","martin","test") > > > > cursor = connection.cursor() > > > > cursor.execute("select 1 from dual") > > > > count,=cursor.fetchone() > > > > print "reurn result ",count > > > > > > > > if __name__=="__main__": > > > > print "connecting.................." > > > > connection() > > > > print "end" > > > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > > > test= > > > > (DESCRIPTION = > > > > (ADDRESS_LIST = > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160>< > http://192.168.0.160>< > > > http://192.168.0.160>)(PORT > > > > = 1521)) > > > > ) > > > > (CONNECT_DATA = > > > > (SERVER = DEDICATED) > > > > (SERVICE_NAME = test) > > > > ) > > > > ) > > > > > > > > 我想问一下 cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > > > pytho的错误如下: > > > > connecting.................. > > > > > > > > Traceback (most recent call last): > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > -toplevel- > > > > connection() > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > connection > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > 谢谢。 > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > _______________________________________________ > > > python-chinese list > > > python-chinese at lists.python.cn > > > http://python.cn/mailman/listinfo/python-chinese > > > > > --------------------- Original Message Ends -------------------- > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050919/b11971f2/attachment.html
2005年09月19日 星期一 22:08
test= (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>)(PORT = 1521)) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test) ^^^^ ) ) 如果你确定你的配置里面有etas,那么我只能遗憾的告诉你我也不知道为什么,因为我用一直都是好的。 ----------------------- Original Message ----------------------- From: "martin.xus" <martin.xus at gmail.com> To: python-chinese at lists.python.cn Date: Mon, 19 Sep 2005 22:02:09 +0800 Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 ---------------------------------------------------------------- > 还是一样 > import cx_Oracle > > def connection(): > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > cursor = connection.cursor() > cursor.execute('select 1 from dual') > count,=cursor.fetchone() > print 'reurn result ',count > > if __name__=='__main__': > print 'connecting..................' > connection() > print 'end' > > ---------------- > > Traceback (most recent call last): > File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel- > connection() > File "D:/workspace/project/python/OracleTest.py", line 4, in connection > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > 你这样写 > > con = cx_Oracle.connect( 'user/pass at service' ) > > > > ----------------------- Original Message ----------------------- > > From: "martin.xus" <martin.xus at gmail.com> > > To: python-chinese at lists.python.cn > > Date: Mon, 19 Sep 2005 21:49:06 +0800 > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > ---------------------------------------------------------------- > > > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > > > 后面那个etas是不是就是oracle配置文件那个啊? > > > 在我的机器上没跑通,我用的是oracle8。 > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > > > .... > > > > 大哥,你是不是打错了 > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > ^^^^ > > > > ----------------------- Original Message ----------------------- > > > > From: "martin.xus" <martin.xus at gmail.com> > > > > To: python-chinese at lists.python.cn > > > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > ---------------------------------------------------------------- > > > > > 我下了cx_Oracle,按照例子写如下: > > > > > > > > > > import cx_Oracle > > > > > > > > > > def connection(): > > > > > connection = cx_Oracle.connect("admin","martin","test") > > > > > cursor = connection.cursor() > > > > > cursor.execute("select 1 from dual") > > > > > count,=cursor.fetchone() > > > > > print "reurn result ",count > > > > > > > > > > if __name__=="__main__": > > > > > print "connecting.................." > > > > > connection() > > > > > print "end" > > > > > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > > > > > test= > > > > > (DESCRIPTION = > > > > > (ADDRESS_LIST = > > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160>< > > http://192.168.0.160>< > > > > http://192.168.0.160>)(PORT > > > > > = 1521)) > > > > > ) > > > > > (CONNECT_DATA = > > > > > (SERVER = DEDICATED) > > > > > (SERVICE_NAME = test) > > > > > ) > > > > > ) > > > > > > > > > > 我想问一下 cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > > > > > pytho的错误如下: > > > > > connecting.................. > > > > > > > > > > Traceback (most recent call last): > > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > -toplevel- > > > > > connection() > > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > connection > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > 谢谢。 > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > > > > _______________________________________________ > > > > python-chinese list > > > > python-chinese at lists.python.cn > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > --------------------- Original Message Ends -------------------- > > > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > --------------------- Original Message Ends --------------------
2005年09月19日 星期一 22:12
谢谢。 etas是原先的那个. 那如果我不用service name,直接采用ip地址呢,该怎么写connection string啊? connection = cx_Oracle.connect( 'etasadmin/etasadmin at 192.168.0.160:1521:etas' ) 学JDBC里面的,可是不通. On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > test= > (DESCRIPTION = > (ADDRESS_LIST = > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160> < > http://192.168.0.160>)(PORT > = 1521)) > ) > (CONNECT_DATA = > (SERVER = DEDICATED) > (SERVICE_NAME = test) > ^^^^ > ) > ) > 如果你确定你的配置里面有etas,那么我只能遗憾的告诉你我也不知道为什么,因为我用一直都是好的。 > > ----------------------- Original Message ----------------------- > From: "martin.xus" <martin.xus at gmail.com> > To: python-chinese at lists.python.cn > Date: Mon, 19 Sep 2005 22:02:09 +0800 > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > ---------------------------------------------------------------- > > 还是一样 > > import cx_Oracle > > > > def connection(): > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > > cursor = connection.cursor() > > cursor.execute('select 1 from dual') > > count,=cursor.fetchone() > > print 'reurn result ',count > > > > if __name__=='__main__': > > print 'connecting..................' > > connection() > > print 'end' > > > > ---------------- > > > > Traceback (most recent call last): > > File "D:/workspace/project/python/OracleTest.py", line 12, in -toplevel- > > connection() > > File "D:/workspace/project/python/OracleTest.py", line 4, in connection > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > 你这样写 > > > con = cx_Oracle.connect( 'user/pass at service' ) > > > > > > ----------------------- Original Message ----------------------- > > > From: "martin.xus" <martin.xus at gmail.com> > > > To: python-chinese at lists.python.cn > > > Date: Mon, 19 Sep 2005 21:49:06 +0800 > > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > ---------------------------------------------------------------- > > > > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > > > > 后面那个etas是不是就是oracle配置文件那个啊? > > > > 在我的机器上没跑通,我用的是oracle8。 > > > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > > > > > .... > > > > > 大哥,你是不是打错了 > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > ^^^^ > > > > > ----------------------- Original Message ----------------------- > > > > > From: "martin.xus" <martin.xus at gmail.com> > > > > > To: python-chinese at lists.python.cn > > > > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > > > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > > ---------------------------------------------------------------- > > > > > > 我下了cx_Oracle,按照例子写如下: > > > > > > > > > > > > import cx_Oracle > > > > > > > > > > > > def connection(): > > > > > > connection = cx_Oracle.connect("admin","martin","test") > > > > > > cursor = connection.cursor() > > > > > > cursor.execute("select 1 from dual") > > > > > > count,=cursor.fetchone() > > > > > > print "reurn result ",count > > > > > > > > > > > > if __name__=="__main__": > > > > > > print "connecting.................." > > > > > > connection() > > > > > > print "end" > > > > > > > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > > > > > > > test= > > > > > > (DESCRIPTION = > > > > > > (ADDRESS_LIST = > > > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160> > <http://192.168.0.160>< > > > http://192.168.0.160>< > > > > > http://192.168.0.160>)(PORT > > > > > > = 1521)) > > > > > > ) > > > > > > (CONNECT_DATA = > > > > > > (SERVER = DEDICATED) > > > > > > (SERVICE_NAME = test) > > > > > > ) > > > > > > ) > > > > > > > > > > > > 我想问一下 > cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > > > > > > > pytho的错误如下: > > > > > > connecting.................. > > > > > > > > > > > > Traceback (most recent call last): > > > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > > -toplevel- > > > > > > connection() > > > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > > connection > > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > > > > 谢谢。 > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > > > > > > > _______________________________________________ > > > > > python-chinese list > > > > > python-chinese at lists.python.cn > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > _______________________________________________ > > > python-chinese list > > > python-chinese at lists.python.cn > > > http://python.cn/mailman/listinfo/python-chinese > > > > > --------------------- Original Message Ends -------------------- > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050919/2bbb6837/attachment-0001.htm
2005年09月19日 星期一 22:20
就是说,可不可以不读取那个文件,直接连接oracle数据库? On 9/19/05, martin.xus <martin.xus at gmail.com> wrote: > > 谢谢。 > > etas是原先的那个. > 那如果我不用service name,直接采用ip地址呢,该怎么写connection string啊? > connection = cx_Oracle.connect( 'etasadmin/etasadmin at 192.168.0.160:1521:etas' > ) > 学JDBC里面的,可是不通. > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > test= > > (DESCRIPTION = > > (ADDRESS_LIST = > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>< > > http://192.168.0.160>)(PORT > > = 1521)) > > ) > > (CONNECT_DATA = > > (SERVER = DEDICATED) > > (SERVICE_NAME = test) > > ^^^^ > > ) > > ) > > 如果你确定你的配置里面有etas,那么我只能遗憾的告诉你我也不知道为什么,因为我用一直都是好的。 > > > > ----------------------- Original Message ----------------------- > > From: "martin.xus" <martin.xus at gmail.com> > > To: python-chinese at lists.python.cn > > Date: Mon, 19 Sep 2005 22:02:09 +0800 > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > ---------------------------------------------------------------- > > > 还是一样 > > > import cx_Oracle > > > > > > def connection(): > > > connection = cx_Oracle.connect( ' etasadmin/etasadmin at etas' ) > > > cursor = connection.cursor() > > > cursor.execute('select 1 from dual') > > > count,=cursor.fetchone() > > > print 'reurn result ',count > > > > > > if __name__=='__main__': > > > print 'connecting..................' > > > connection() > > > print 'end' > > > > > > ---------------- > > > > > > Traceback (most recent call last): > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > -toplevel- > > > connection() > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > connection > > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > > > 你这样写 > > > > con = cx_Oracle.connect( 'user/pass at service ' ) > > > > > > > > ----------------------- Original Message ----------------------- > > > > From: "martin.xus" <martin.xus at gmail.com> > > > > To: python-chinese at lists.python.cn > > > > Date: Mon, 19 Sep 2005 21:49:06 +0800 > > > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > ---------------------------------------------------------------- > > > > > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > > > > > 后面那个etas是不是就是oracle配置文件那个啊? > > > > > 在我的机器上没跑通,我用的是oracle8。 > > > > > > > > > > On 9/19/05, 张骏 < zhangj at foreseen-info.com> wrote: > > > > > > > > > > > > .... > > > > > > 大哥,你是不是打错了 > > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > ^^^^ > > > > > > ----------------------- Original Message ----------------------- > > > > > > From: "martin.xus" <martin.xus at gmail.com > > > > > > > To: python-chinese at lists.python.cn > > > > > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > > > > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > > > ---------------------------------------------------------------- > > > > > > > 我下了cx_Oracle,按照例子写如下: > > > > > > > > > > > > > > import cx_Oracle > > > > > > > > > > > > > > def connection(): > > > > > > > connection = cx_Oracle.connect("admin","martin","test") > > > > > > > cursor = connection.cursor() > > > > > > > cursor.execute("select 1 from dual") > > > > > > > count,=cursor.fetchone() > > > > > > > print "reurn result ",count > > > > > > > > > > > > > > if __name__=="__main__": > > > > > > > print "connecting.................." > > > > > > > connection() > > > > > > > print "end" > > > > > > > > > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > > > > > > > > > test= > > > > > > > (DESCRIPTION = > > > > > > > (ADDRESS_LIST = > > > > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160> > > <http://192.168.0.160>< > > > > http://192.168.0.160>< > > > > > > http://192.168.0.160>)(PORT > > > > > > > = 1521)) > > > > > > > ) > > > > > > > (CONNECT_DATA = > > > > > > > (SERVER = DEDICATED) > > > > > > > (SERVICE_NAME = test) > > > > > > > ) > > > > > > > ) > > > > > > > > > > > > > > 我想问一下 > > cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > > > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > > > > > > > > > pytho的错误如下: > > > > > > > connecting.................. > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > > > -toplevel- > > > > > > > connection() > > > > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > > > connection > > > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > > > > > > > 谢谢。 > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > python-chinese list > > > > > > python-chinese at lists.python.cn > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > _______________________________________________ > > > > python-chinese list > > > > python-chinese at lists.python.cn > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > --------------------- Original Message Ends -------------------- > > > > _______________________________________________ > > python-chinese list > > python-chinese at lists.python.cn > > http://python.cn/mailman/listinfo/python-chinese > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050919/edafe694/attachment.html
2005年09月19日 星期一 23:18
cx_Oracle使用oci接口。至于是不是可以指定ip我不清楚。 如果你不安装客户端,或者不配置net8应该不会成功。 我自己的机器上配置了3个oracle服务,都可以连上。因此,我更加怀疑是你oracle配置的问题。 另外,JDBC好像是自己实现的Socket,并不像cx_Oracle使用的oci接口 ----------------------- Original Message ----------------------- From: "martin.xus" <martin.xus at gmail.com> To: python-chinese at lists.python.cn Date: Mon, 19 Sep 2005 22:20:52 +0800 Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 ---------------------------------------------------------------- > 就是说,可不可以不读取那个文件,直接连接oracle数据库? > > On 9/19/05, martin.xus <martin.xus at gmail.com> wrote: > > > > 谢谢。 > > > > etas是原先的那个. > > 那如果我不用service name,直接采用ip地址呢,该怎么写connection string啊? > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at 192.168.0.160:1521:etas' > > ) > > 学JDBC里面的,可是不通. > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > test= > > > (DESCRIPTION = > > > (ADDRESS_LIST = > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160 <http://192.168.0.160>< > > > http://192.168.0.160>)(PORT > > > = 1521)) > > > ) > > > (CONNECT_DATA = > > > (SERVER = DEDICATED) > > > (SERVICE_NAME = test) > > > ^^^^ > > > ) > > > ) > > > 如果你确定你的配置里面有etas,那么我只能遗憾的告诉你我也不知道为什么,因为我用一直都是好的。 > > > > > > ----------------------- Original Message ----------------------- > > > From: "martin.xus" <martin.xus at gmail.com> > > > To: python-chinese at lists.python.cn > > > Date: Mon, 19 Sep 2005 22:02:09 +0800 > > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > ---------------------------------------------------------------- > > > > 还是一样 > > > > import cx_Oracle > > > > > > > > def connection(): > > > > connection = cx_Oracle.connect( ' etasadmin/etasadmin at etas' ) > > > > cursor = connection.cursor() > > > > cursor.execute('select 1 from dual') > > > > count,=cursor.fetchone() > > > > print 'reurn result ',count > > > > > > > > if __name__=='__main__': > > > > print 'connecting..................' > > > > connection() > > > > print 'end' > > > > > > > > ---------------- > > > > > > > > Traceback (most recent call last): > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > > -toplevel- > > > > connection() > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > > connection > > > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > > > > > 你这样写 > > > > > con = cx_Oracle.connect( 'user/pass at service ' ) > > > > > > > > > > ----------------------- Original Message ----------------------- > > > > > From: "martin.xus" <martin.xus at gmail.com> > > > > > To: python-chinese at lists.python.cn > > > > > Date: Mon, 19 Sep 2005 21:49:06 +0800 > > > > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > > ---------------------------------------------------------------- > > > > > > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > > > > > > 后面那个etas是不是就是oracle配置文件那个啊? > > > > > > 在我的机器上没跑通,我用的是oracle8。 > > > > > > > > > > > > On 9/19/05, 张骏 < zhangj at foreseen-info.com> wrote: > > > > > > > > > > > > > > .... > > > > > > > 大哥,你是不是打错了 > > > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > > ^^^^ > > > > > > > ----------------------- Original Message ----------------------- > > > > > > > From: "martin.xus" <martin.xus at gmail.com > > > > > > > > To: python-chinese at lists.python.cn > > > > > > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > > > > > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > > > > ---------------------------------------------------------------- > > > > > > > > 我下了cx_Oracle,按照例子写如下: > > > > > > > > > > > > > > > > import cx_Oracle > > > > > > > > > > > > > > > > def connection(): > > > > > > > > connection = cx_Oracle.connect("admin","martin","test") > > > > > > > > cursor = connection.cursor() > > > > > > > > cursor.execute("select 1 from dual") > > > > > > > > count,=cursor.fetchone() > > > > > > > > print "reurn result ",count > > > > > > > > > > > > > > > > if __name__=="__main__": > > > > > > > > print "connecting.................." > > > > > > > > connection() > > > > > > > > print "end" > > > > > > > > > > > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > > > > > > > > > > > test= > > > > > > > > (DESCRIPTION = > > > > > > > > (ADDRESS_LIST = > > > > > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160> > > > <http://192.168.0.160>< > > > > > http://192.168.0.160>< > > > > > > > http://192.168.0.160>)(PORT > > > > > > > > = 1521)) > > > > > > > > ) > > > > > > > > (CONNECT_DATA = > > > > > > > > (SERVER = DEDICATED) > > > > > > > > (SERVICE_NAME = test) > > > > > > > > ) > > > > > > > > ) > > > > > > > > > > > > > > > > 我想问一下 > > > cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > > > > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > > > > > > > > > > > pytho的错误如下: > > > > > > > > connecting.................. > > > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > > > > -toplevel- > > > > > > > > connection() > > > > > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > > > > connection > > > > > > > > connection = cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > > > > > > > > > > 谢谢。 > > > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > python-chinese list > > > > > > > python-chinese at lists.python.cn > > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > > _______________________________________________ > > > > > python-chinese list > > > > > python-chinese at lists.python.cn > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > _______________________________________________ > > > python-chinese list > > > python-chinese at lists.python.cn > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > --------------------- Original Message Ends --------------------
2005年09月20日 星期二 09:14
刚才发了邮件,里面个附件截图,太大了,被python-chinese截获了,没发成功:( ------------- 我只安装了oracle9 client 运行时的 100 多M,这个已经够了吧?(连的是Oracle 8这个应该没有太大关系吧) 我在net manager里面也做了配置。 这个还需要别的特殊的设定吗?我只是安装了一个client 的运行时环境。 ----------------------------------------------- On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > cx_Oracle使用oci接口。至于是不是可以指定ip我不清楚。 > 如果你不安装客户端,或者不配置net8应该不会成功。 > > 我自己的机器上配置了3个oracle服务,都可以连上。因此,我更加怀疑是你oracle配置的问题。 > > 另外,JDBC好像是自己实现的Socket,并不像cx_Oracle使用的oci接口 > ----------------------- Original Message ----------------------- > From: "martin.xus" <martin.xus at gmail.com> > To: python-chinese at lists.python.cn > Date: Mon, 19 Sep 2005 22:20:52 +0800 > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > ---------------------------------------------------------------- > > 就是说,可不可以不读取那个文件,直接连接oracle数据库? > > > > On 9/19/05, martin.xus <martin.xus at gmail.com> wrote: > > > > > > 谢谢。 > > > > > > etas是原先的那个. > > > 那如果我不用service name,直接采用ip地址呢,该怎么写connection string啊? > > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at 192.168.0.160 > :1521:etas' > > > ) > > > 学JDBC里面的,可是不通. > > > > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > > > test= > > > > (DESCRIPTION = > > > > (ADDRESS_LIST = > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160>< > http://192.168.0.160>< > > > > http://192.168.0.160>)(PORT > > > > = 1521)) > > > > ) > > > > (CONNECT_DATA = > > > > (SERVER = DEDICATED) > > > > (SERVICE_NAME = test) > > > > ^^^^ > > > > ) > > > > ) > > > > 如果你确定你的配置里面有etas,那么我只能遗憾的告诉你我也不知道为什么,因为我用一直都是好的。 > > > > > > > > ----------------------- Original Message ----------------------- > > > > From: "martin.xus" <martin.xus at gmail.com> > > > > To: python-chinese at lists.python.cn > > > > Date: Mon, 19 Sep 2005 22:02:09 +0800 > > > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() 的问题。 > > > > ---------------------------------------------------------------- > > > > > 还是一样 > > > > > import cx_Oracle > > > > > > > > > > def connection(): > > > > > connection = cx_Oracle.connect( ' etasadmin/etasadmin at etas' ) > > > > > cursor = connection.cursor() > > > > > cursor.execute('select 1 from dual') > > > > > count,=cursor.fetchone() > > > > > print 'reurn result ',count > > > > > > > > > > if __name__=='__main__': > > > > > print 'connecting..................' > > > > > connection() > > > > > print 'end' > > > > > > > > > > ---------------- > > > > > > > > > > Traceback (most recent call last): > > > > > File "D:/workspace/project/python/OracleTest.py", line 12, in > > > > -toplevel- > > > > > connection() > > > > > File "D:/workspace/project/python/OracleTest.py", line 4, in > > > > connection > > > > > connection = cx_Oracle.connect( 'etasadmin/etasadmin at etas' ) > > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > > > > > > > > > > > On 9/19/05, 张骏 <zhangj at foreseen-info.com> wrote: > > > > > > > > > > > > 你这样写 > > > > > > con = cx_Oracle.connect( 'user/pass at service ' ) > > > > > > > > > > > > ----------------------- Original Message ----------------------- > > > > > > From: "martin.xus" <martin.xus at gmail.com> > > > > > > To: python-chinese at lists.python.cn > > > > > > Date: Mon, 19 Sep 2005 21:49:06 +0800 > > > > > > Subject: Re: [python-chinese] cx_Oracle 中cx_Oracle.connect() > 的问题。 > > > > > > ---------------------------------------------------------------- > > > > > > > 不好意思,这个是另外一个用户,我想试别的用户看看的。那个用户名是存在的。 > > > > > > > 后面那个etas是不是就是oracle配置文件那个啊? > > > > > > > 在我的机器上没跑通,我用的是oracle8。 > > > > > > > > > > > > > > On 9/19/05, 张骏 < zhangj at foreseen-info.com> wrote: > > > > > > > > > > > > > > > > .... > > > > > > > > 大哥,你是不是打错了 > > > > > > > > connection = > cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > > > ^^^^ > > > > > > > > ----------------------- Original Message > ----------------------- > > > > > > > > From: "martin.xus" <martin.xus at gmail.com > > > > > > > > > To: python-chinese at lists.python.cn > > > > > > > > Date: Mon, 19 Sep 2005 21:38:24 +0800 > > > > > > > > Subject: [python-chinese] cx_Oracle 中cx_Oracle.connect() > 的问题。 > > > > > > > > > ---------------------------------------------------------------- > > > > > > > > > 我下了cx_Oracle,按照例子写如下: > > > > > > > > > > > > > > > > > > import cx_Oracle > > > > > > > > > > > > > > > > > > def connection(): > > > > > > > > > connection = cx_Oracle.connect("admin","martin","test") > > > > > > > > > cursor = connection.cursor() > > > > > > > > > cursor.execute("select 1 from dual") > > > > > > > > > count,=cursor.fetchone() > > > > > > > > > print "reurn result ",count > > > > > > > > > > > > > > > > > > if __name__=="__main__": > > > > > > > > > print "connecting.................." > > > > > > > > > connection() > > > > > > > > > print "end" > > > > > > > > > > > > > > > > > > 其中,我的oracle的 TNSNAMES.ORA 文件如下: > > > > > > > > > > > > > > > > > > test= > > > > > > > > > (DESCRIPTION = > > > > > > > > > (ADDRESS_LIST = > > > > > > > > > (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.160<http://192.168.0.160> > <http://192.168.0.160> > > > > <http://192.168.0.160>< > > > > > > http://192.168.0.160>< > > > > > > > > http://192.168.0.160>)(PORT > > > > > > > > > = 1521)) > > > > > > > > > ) > > > > > > > > > (CONNECT_DATA = > > > > > > > > > (SERVER = DEDICATED) > > > > > > > > > (SERVICE_NAME = test) > > > > > > > > > ) > > > > > > > > > ) > > > > > > > > > > > > > > > > > > 我想问一下 > > > > cx_Oracle.connect中第三个参数test,不就是TNSNAMES.ORA中的SERVICE_NAME吗? > > > > > > > > > 可是为什么上面代码不能登陆,但是我的PL/SQL 是可以登陆的, > > > > > > > > > > > > > > > > > > pytho的错误如下: > > > > > > > > > connecting.................. > > > > > > > > > > > > > > > > > > Traceback (most recent call last): > > > > > > > > > File "D:/workspace/project/python/OracleTest.py", line 12, > in > > > > > > -toplevel- > > > > > > > > > connection() > > > > > > > > > File "D:/workspace/project/python/OracleTest.py", line 4, > in > > > > > > connection > > > > > > > > > connection = > cx_Oracle.connect("etasadmin","etasadmin","etas") > > > > > > > > > DatabaseError: ORA-12154: TNS: 无法处理服务名 > > > > > > > > > > > > > > > > > > > > > > > > > > > 谢谢。 > > > > > > > > > > > > > > > > --------------------- Original Message Ends > -------------------- > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > python-chinese list > > > > > > > > python-chinese at lists.python.cn > > > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > > > > > _______________________________________________ > > > > > > python-chinese list > > > > > > python-chinese at lists.python.cn > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > > > > > > > _______________________________________________ > > > > python-chinese list > > > > python-chinese at lists.python.cn > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > --------------------- Original Message Ends -------------------- > > _______________________________________________ > python-chinese list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20050920/4b61b0d1/attachment-0001.htm
Zeuux © 2025
京ICP备05028076号