Re: Error -1811
Posted in 2004
Though I am sure it ought to be obvious to me, I think may be I am
misunderstanding the term 'DATABASE statements' what to you mean,
cannot I not do:
CONNECT TO ...
then do
EXEC SQL etc etc
I don't understand why not.
Also what do you specifically mean by
'the CONNECT statement'
Does this mean any kind of CONNECT.
I am using CONNECT TO ... AS ...,
then from time to time I use SET CONNECTION
to as I understand change the current connection.
A lot of the code is wrapped, so it's difficult to get to the boittom of
it, but I think some of the scenarios is:
CONNECT TO ... AS
EXEC ...
EXEC ...
EXEC ...
CONNECT TO ... AS
get error -1811
===================================
CONNECT TO ... AS b
EXEC ...
EXEC ...
EXEC ...
SET CONNECTION TO c (some other previous connection)
EXEC ...
no error
=======================================
CONNECT TO ... AS b
EXEC ...
EXEC ...
EXEC ...
SET CONNECTION TO c (some other previous connection)
SET CONNECTION TO c ... DORMANT
EXEC ...
error -1811
========================================
CONNECT TO ... AS b
EXEC ...
begin
EXEC ...
EXEC ...
SET CONNECTION TO c (some other previous connection)
SET CONNECTION TO c ... DORMANT
SET CONNECTION TO b
EXEC ...
EXEC ...
end
error -1811
===========================================
|---------+---------------------------->
| | Jonathan Leffler |
| | <jleffler@earthli|
| | nk.net> |
| | Sent by: |
| | owner-informix-li|
| | st@iiug.org |
| | |
| | |
| | 02/04/2004 06:00 |
| | Please respond to|
| | Jonathan Leffler |
| | |
|---------+---------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|
| |
| To: informix-list@iiug.org |
| cc: |
| Subject: Re: Error -1811 |
>--------------------------------------------------------------------------------------------------------------------------------------------------|
Andrew Hardy wrote:
> can somebody explain to me what this means:
>
> lesu273> finderr -1811
> -1811 Implicit connection not allowed after an explicit connection.
>
> Once you have used the CONNECT TO statement to establish an explicit
> connection to a database server, you cannot use one of the DATABASE
> statements to connect implicitly to another database server. After an
> explicit connection, you must use the CONNECT TO statement to connect
> to other database servers.
>
>
> If I have established an explicit connection to a db server, then surely
> any using one of the databse statements after tha, must be asumed to be
> sent to that server ?
Yes, but did you connect to the server or to a specific database on
the server?
You can create an implicit connection like this:
DATABASE 'joe@bloggs';
You can also create an implicit connection like this:
DATABASE 'joe';
You can create an explicit connection to a database like this:
CONNECT TO 'joe@bloggs';
After this, you cannot use any of the DATABASE statements.
You can create an explicit connection to a database server like this:
CONNECT TO '@bloggs';
And after this, you can do:
CREATE DATABASE bill; CLOSE DATABASE;
DATABASE joe; ...
CLOSE DATABASE;
And so on.
> So why does the statement I execute think it is for a different server ?
The error message is clear - you are not allowed to create an implicit
connection after you've made an explicit connection to a database.
The expansion of the error message is not as clear as it could be.
Better wording would be more like:
Once you use the CONNECT statement to establish an explicit connection
to a database, you cannot use any of the DATABASE statements when that
is the current connection. You can use the notation CONNECT TO
'dbase@server' to connect to a different database, or the notation
CONNECT TO '@server' to connect to a database server (after which, you
can use the various DATABASE statements in that connection).
--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
sending to informix-list