Re: OCI Orlon call snafoo

From: Thomas Dwyer III <tomiii_at_mtu.edu>
Date: 7 Oct 1993 14:29:22 -0400
Message-ID: <291n62$caf_at_opus.mtu.edu>


David Trahan (p00775_at_psilink.com) wrote:
>Please tell me I'm not losing my noodle...
>(I know I lost it a long time ago!)
>
> I'm trying to write a simple little Oracle application in C
>using OCI calls. In this particular case, I need to have two (count
>'em - 2) SEPARATE logons to the SAME instance, each logged in under a
>different user name. So... upon flipping through Oracle's Programmer's
>Guide to the Oracle Call Interface (version 7), I see the 'orlon' call
>has the following description:
>
> "An OCI program can connect to one or more Oracle instances
> multiple times. Communication takes place using the logon
> data area defined within the program."
>
>Then they go on to show a nice little example of two LDAs and two HDAs
>connecting to two DIFFERENT instances (how about an unambiguous example
>guys!?!) Clearly in their example you can connect to two DIFFERENT
>instances, but it is completely UNCLEAR if you can connect twice to the
>SAME instance. I ASSUMED (big mistake when dealing with Oracle) that I
>could do this, and wrote my code accordingly. However, when I run it,
>the "second" orlon returns "ORA-01075 you are already logged on
>meathead". Well alright, it didn't say meathead, but it was sure implied.
>

I agree, the example could be better. This little test program works for me though. If you change the orlon() calls to olon() you will have the problem you described. Could this be what's happening?

Cheers,
Tom.III
tomiii_at_mtu.edu

  • Cut here ---------- #include <stdio.h> #include <oratypes.h> #include <ocidfn.h> #include <ocidem.h>

typedef struct {

	Lda_Def		lda;
	ub1		hda[256];

} Session;

main(argc, argv)

int	argc;
char	**argv;
{
	Session		ses1;
	Session		ses2;


	if (orlon(&ses1.lda, ses1.hda, "user1/pass1", -1, (text *)0, -1, 0)) {
		printf("cannot connect session 1\n");
		exit(1);
	}

	if (orlon(&ses2.lda, ses2.hda, "user2/pass2", -1, (text *)0, -1, 0)) {
		printf("cannot connect session 2\n");
		exit(1);
	}

	/* pause while we type "select * from v$session" in another window */
	(void)getchar();

	if (ologof(&ses2.lda)) {
		printf("cannot disconnect session 2\n");
		exit(1);
	}

	if (ologof(&ses1.lda)) {
		printf("cannot disconnect session 1\n");
		exit(1);
	}

	exit(0);

} Received on Thu Oct 07 1993 - 19:29:22 CET

Original text of this message