From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,4ef7e3d0c7ac8809 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!k32g2000vbn.googlegroups.com!not-for-mail From: iloAda Newsgroups: comp.lang.ada Subject: Re: Many Database Connections Date: Mon, 31 Jan 2011 06:12:48 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <99d20061-de06-4383-8675-e1abd9803b0d@o10g2000vbg.googlegroups.com> <88b03959-0d74-487b-9fcc-ab3a0dc6eab9@k14g2000pre.googlegroups.com> NNTP-Posting-Host: 137.194.2.20 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1296483168 5226 127.0.0.1 (31 Jan 2011 14:12:48 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 31 Jan 2011 14:12:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k32g2000vbn.googlegroups.com; posting-host=137.194.2.20; posting-account=r1a26AoAAAD4nbikbegb_8j7mwzetiwY User-Agent: G2/1.0 X-HTTP-Via: 1.1 proxy.enst.fr:3128 (squid/2.6.STABLE18) X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:16813 Date: 2011-01-31T06:12:48-08:00 List-Id: On Jan 28, 4:22=A0pm, Emmanuel Briot wrote: > > I do use the Get_Task_Connection to create the connection, and I've > > looked into the GNATCOLL library and it seems to me that it has a > > global variable (DB_Attributes) that holds some info about the DB, the > > first call to the Get_Task_Connection function will give a value to > > DB_Attributes, and all subsequent calls to the Get_Task_Connection > > function will return the value of DB_Attributes, even if we try to > > connect to a new Database (The only solution I found till now is to > > open a connection, insert values then directly close the connection, > > but this isn't a good practice!) > > DB_Attributes is not a global variable (I don't think gnatcoll is > using any such variable). > It is a package which allows us to store task attributes (ie for each > task we store which is the associated connection -- to match the > semantics of Get_Task_Connection). > So indeed the second call to Get_Task_Connection will return the first > connection, since you have a single task. > In your case, you do not want to use Get_Task_Connection since you > want multiple connections in the same task. > > So use something like: > > =A0 DB1 :=3D Connection_Factory (DB1_Descr); > =A0 Reset_Connection (DB1, DB1_Descr); > =A0 DB2 :=3D Connection_Factory (DB2_Descr); > =A0 Reset (DB2, DB2_Descr); > > and then you have two independent connections that you should be able > to use from the same thread. Thanks Emmanuel !! It worked like a charm!! I think that the final solution whould be a little smarter because the final solution might very well be multithreaded!! Thanks anyway! ilo