Uda Wiki Web

  • Topic
  • Discussion
  • Error Messages (C)

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z #

    Cannot use database commands in a explicit database connection

    "Cannot use database commands in a explicit database connection" errors are returned by the Informix server if you attempt to perform an Informix server database command in a explicit database connection. Examples of an Informix server database command are:

      DATABASE
          <DBNAME>
          -- changes current database
           CREATE DATABASE <DBNAME> -- creates a new
          database
    


    Such commands can not be used if you've already explicitly connected to a database. An explicit connection has been made if a specific database has been passed to the DATABASE field of the ODBC DSN.

    To implicitly connect to an Informix server (as opposed to a specific database on the server), you need to set the DATABASE field as:

       @server
    


    where server is the entry in the sqlhosts file you want to connect to. The sqlhosts file will be located at:

      $INFORMIXDIR/etc/sqlhosts
    


    Typically, the sqlhosts file has several lines which reference any number of (remote or local) Informix servers that may be connected to. Each line has this format:

       #Dbserver Protocol Hostname
          Port 
    


    For example:

      iif930 onsoctcp apollo2 1530
    


    This entry refers to a "iif930" server on the host "apollo2". The "iif930" server is started up in sockets mode, with connections made via TCP Port 1530. (Note: the Port value can also be a reference to an entry in the /etc/services file.) To connect to this server, I would pass "@iif930" to the DATABASE field of the DSN.

    Evidence

    Request Broker Log