在connect 的时候应该加上 using :db_name,
EXEC SQL CONNECT :username IDENTIFIED BY :password USING :db_name.
db_name 应该声明在host 变量区域,VARCHAR2型,指向当前数据库的名字。

解决方案 »

  1.   

    查一下你的tnsnames.ora看一看有没有默认配置
      

  2.   

    ORA-03114 not connected to ORACLECause: A call to Oracle was attempted when no connection was established. Usually this 
    happens because a user-written program has not logged on. It may happen if communication 
    trouble causes a disconnection. In addition, this message could occur when ALTER SYSTEM 
    KILL SESSION or ALTER SYSTEM DISCONNECT SESSION were issued with the IMMEDIATE qualifier 
    because, in those cases, the client's connection to the database is terminated without 
    waiting for the client to issue a request.Action: Try again. If the message recurs and the program is user written, check the 
    program.