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: 103376,4ef7e3d0c7ac8809 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o21g2000prn.googlegroups.com!not-for-mail From: Emmanuel Briot Newsgroups: comp.lang.ada Subject: Re: Many Database Connections Date: Fri, 28 Jan 2011 07:22:06 -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: 194.98.77.125 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1296228126 19067 127.0.0.1 (28 Jan 2011 15:22:06 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 28 Jan 2011 15:22:06 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: o21g2000prn.googlegroups.com; posting-host=194.98.77.125; posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; 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:16772 Date: 2011-01-28T07:22:06-08:00 List-Id: > 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: DB1 := Connection_Factory (DB1_Descr); Reset_Connection (DB1, DB1_Descr); DB2 := Connection_Factory (DB2_Descr); Reset (DB2, DB2_Descr); and then you have two independent connections that you should be able to use from the same thread.