Re: Deja news posting
Posted in 2000
On Wed, 19 Jan 2000, Bryan White wrote: >I'm replying to a posting I sent on Deja News yesterday that you kindly >replied to. I decided to email you directly in case you did not keep >up with my posting's thread. The posting and your reply are at the >bottom of this message. >I seem to be in good shape on my system, here are the versions I am >running... > >Informix-IDS 7.30.UC7 Informix Dynamic Server >INFORMIX-SE 7.24.UC7 Standard Engine Database Server. >INFORMIX-ESQL/C 7.24.UC7 embedded SQL for developing C programs. >INFORMIX-SQL 7.20.UD7 application development tools. >INFORMIX-4GL 7.20.UD7 application programming language >INFORMIX-4GL RDS 7.20.UD7 Rapid Development System. >INFORMIX-4GL ID 7.20.UD6 Interactive Debugger. Yes, that's pretty good. Be aware that 7.20.UD7 for the p-code tools would be a bad move, and 7.20.UEx and 7.30.UCx both introduce new p-code versions. (7.20.UD7 should have done so, but didn't, so it is neither compatible with 7.20.UD6 nor with 7.20.UEx or 7.30.UCx). >I put together a small application selecting from an IDS and an SE >database that then displayed the data to the screen. I had no problems >connecting to either database, I passed in the SE database as a >parameter (which was found by traversing the DBPATH) and I passed in >the IDS database as the second database parameter in the format >dbname@servername which was found in the sqlhosts file. I was able to >access each database by closing one then opening the other (which we do >in all of our applications since we have all SE databases now). OK; that's an important step. It verifies that both database systems are accessible. >I'm not real clear on your reply in this sense: do you mean if I go to >the IIUG archives and get the functions you described (because I have >an older version of I4GL) I would be able to access multiple databases >simultaneously, Not strictly simultaneously, but concurrently - yes. >for example, in one single select statement? No. That has to be done by the servers and cannot be done by an ESQL/C application directly (and I4GL programs are only big ESQL/C apps when all is said and done). In ESQL/C terms, you'd be able to do: $ CONNECT TO $se_name AS 'se_conn' ...; $ CONNECT TO $ids_name AS 'ids_conn' ...; $ SET CONNECTION 'se_conn'; -- collect data from SE database (into program storage) $ SET CONNECTION 'ids_conn'; -- stuff data into IDS database (from program storage) This means you can switch between the two databases without the overhead of formally connecting each time (which can be slow, especially over a network). There's an option WITH CONCURRENT TRANSACTIONS (the ... in my ESQL/C) which means that you can maintain active transactions on one connection while switching to the other. Without that, you will fail to switch connections if the connection has a transaction open. Note that if you had I4GL 7.30, you'd simply write: SET CONNECTION 'se_conn' in your code. With any earlier version, that won't work. Further, the connection management statements are not preparable (preparing a statement requires a database server, and connect is about connecting to one, so how do you get a database server to tell you how to connect to a database server?). That's why you need the ESQL/C functions from the IIUG archive. >If this is so, could you give me a hint (names etc) on how to find the >functions you mentioned on IIUG's website? In the software archive, I4GL section, under a title such as connect? >I really appreciate your reply. >Bryan W. White > >> I've got a very general question. Can applications (in this case 4gl >> applications) access databases that are both SE and IDS. The >> applications in question were developed using SE. I am moving to IDS, >> but can only make the move a few databases at a time. > >Yes, provided... > >If you are using a 6.00 or later version of ESQL/C (or, in this case, a >version of I4GL that is 6.00 or later), then there is a CONNECT statement, >plus SET CONNECTION and DISCONNECT, which allow you to have independent >connections to different databases, which can be of different logging modes >(eg SE and IDS). This is contrast with the distributed SQL syntax where the >databases have to be OnLine or IDS, and have to have the same logging mode. >There's an additional complication. Unless you have I4GL 7.30, you will need >to go to the IIUG archives to obtain some ESQL/C functions which provide >I4GL with the connect statements. I4GL 7.30 has direct support for CONNECT >etc -- earlier versions do not. I4GL 4.20 (or earlier) is built with ESQL/C >4.12 and cannot support multiple connections; neither can software built >with ESQL/C 5.x. -- Yours, Jonathan Leffler (jonathan.leffler@informix.com) #include <disclaimer.h> Guardian of DBD::Informix v0.95 -- http://www.perl.com/CPAN "I don't suffer from insanity; I enjoy every minute of it!"