Re: PREPARE statement
Posted in 1997
>From: plassmann.pad@sni.de (Johannes Plassmann) >Date: 24 Jun 1997 10:33:25 GMT >X-Informix-List-Id: <news.39586> > >Is it possible to 'prepare' a connect statement >(e.g. EXEC SQL PREPARE from 'CONNECT TO stores7') >Our Informix Database (7.11) returns always SQL: -201: Syntax error occured As you have discovered, you cannot prepare the CONNECT, DISCONNECT or SET CONNECTION statements. If you think about it, this is reasonable. To PREPARE a statement, you need a database engine. But the CONNECT statement doesn't have an engine to talk to -- you are trying to set up the connection. Obviously, SET CONNECTION and DISCONNECT do have an engine around, but SET CONNECTION redirects the conversation from one engine to another, so it isn't clear how one of the engines could handle the statement. And DISCONNECT tells an engine to go away -- that could be handle by the engine, but isn't directly. You can, however, use variables for the connection name, the database or server name, the user name and the password, so you can use: EXEC SQL CONNECT TO :servername; where the server name variable would contain 'stores7' for your example, but might contain 'stores7@anubis_47' or '@anubis_47' or any other valid database identification string. >also the documentation (Informix Guide to SQL V7.1, Syntax) says in description >of command prepare: CONNECT, CLOSE DATABASE, OPEN DATEBASE, DISCONNECT etc >can only be prepared through a are singelton prepare. On p1-276 of the Informix Guide to SQL: Syntax Version 6.0, it correctly states that CONNECT, DISCONNECT and SET CONNECTION cannot be prepared. On p1-357 of the Informix Guide to SQL: Syntax Version 7.1, it incorrectly say that the connection management statements are limited because they cannot be a part of multi-statement prepares -- it should list them under the unpreparable statements. On p1-407 of the Informix Guide to SQL: Syntax Volume 1 Version 7.2, it does not list the connection management statements under the non-preparable statements, so that is faulty, too. The Informix Guide to SQL: Syntax Volume 1 Version 9.1 correctly lists the connection management statements as non-preparable. I've copied this message to doc@informix.com so that maybe the 7.3 manuals (or next revision of the 7.2 manuals) can be fixed, and/or an erratum placed in the release notes. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>