使用oracle的OTT实用程序时遇到问题

时间:2013-08-14 20:40:02

标签: c++ oracle oci occi

这是我在命令提示符下运行的命令:

ott userid=username/password intype=object.typ outtype=objectOut.typ 
                code=cpp hfile=temp.h cppfile=temp.cpp mapfile=tempmapfile.cppset

这是我得到的错误:

O2T-1118, Unable to register the connection
O2T-102, ERROR: Unable to connect to schema "username"

我无法弄清楚如何正确注册我的连接。有人能帮我解释一下这个问题吗?

1 个答案:

答案 0 :(得分:1)

如上所述,您的用户名或密码错误。

我创建了一个新用户并连接了:

SQL> create user ott identified by ott;

User created.

SQL> grant connect,resource to ott;

Grant succeeded.

SQL> conn ott/ott

Connected.
SQL>

然后创建一个名为ott_type的对象:

SQL> create type ott_type as object
  2  (name varchar2(30),
  3   empno number,
  4   hiredate date);
  5  /

Type created.

SQL>

然后我创建一个intype文件:

[oracle@db oracle]$ cat ott_typein.tpy
case=lower
type ott_type
[oracle@db oracle]$

现在我将使用ott:

转换它
[oracle@db oracle]$ ott userid=ott/ott intype=ott_typein.tpy outtype=ott_typeout.tpy code=cpp \
> hfile=ott_type.h cppfile=ott_type.cpp mapfile=ott_type.cppset

OTT: Release 10.2.0.5.0 - Production on Thu Aug 15 13:02:21 CST 2013

Copyright (c) 1999, 2009, Oracle.  All rights reserved.

System default option values taken from: /u01/app/oracle/product/10.2.0/db_1/precomp/admin/ottcfg.cfg

我们可以看到它成功了!我们更改了userid的密码:

[oracle@db oracle]$ ott userid=ott/ottwrong intype=ott_typein.tpy outtype=ott_typeout.tpy code=cpp \
> hfile=ott_type.h cppfile=ott_type.cpp mapfile=ott_type.cppset

OTT: Release 10.2.0.5.0 - Production on Thu Aug 15 13:21:00 CST 2013

Copyright (c) 1999, 2009, Oracle.  All rights reserved.

System default option values taken from: /u01/app/oracle/product/10.2.0/db_1/precomp/admin/ottcfg.cfg

java.sql.SQLException: ORA-01017: invalid username/password; logon denied

    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:692)
    at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:352)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:453)
    at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:133)
    at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:77)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:753)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at oracle.ott.Konnection.getTheConnection(Konnection.java:110)
    at oracle.ott.Konnection.<init>(Konnection.java:39)
    at oracle.ott.Doit.main(Doit.java:98)
    at oracle.ott.c.CMain.main(CMain.java:9)

O2T-1117, Error reported by subsystem:
ORA-01017: invalid username/password; logon denied


O2T-102, ERROR: Unable to connect to schema "ott"

[oracle@db oracle]$