Re: Database / Connect statement
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
From: DEEPAK RAJ PATEL <d_patel123@usa.net> > >Is there any difference, advantages or disadvantages of using CONNECT >statement against using DATABASE statement to connect to a Database in 4Gl >programs code or SQL statements. CONNECT isn't supported by 4GL (unless it's in 7.30, which I ain't seen yet.) So I guess it's academic. :-) If it is supported by 7.30 and you're using that, then I guess it offers you things like deciding who you connect as and which instance you connect to from within the program, and there is a vague and unsubstantiated rumour that the connection process is "lighter", but how often do you connect to the database, anyway? :) ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com
Obnoxio The Clown wrote: > From: DEEPAK RAJ PATEL <d_patel123@usa.net> > > > >Is there any difference, advantages or disadvantages of using CONNECT > >statement against using DATABASE statement to connect to a Database in 4Gl > >programs code or SQL statements. > > CONNECT isn't supported by 4GL (unless it's in 7.30, which I ain't seen > yet.) It is in 7.30. > So I guess it's academic. :-) > No it's not. > If it is supported by 7.30 and you're using that, then I guess it offers you > things like deciding who you connect as and which instance you connect to > from within the program, and there is a vague and unsubstantiated rumour > that the connection process is "lighter", but how often do you connect to > the database, anyway? :) There are several advantages. One, you can connect to different databases simultaneously, and transfer data between those databases via the I4GL program, even if one of them is SE and one is OnLine, or one is a MODE ANSI database and the other is unlogged or logged but not MODE ANSI. Using a single connection, you cannot do this without repeatedly (and therefore slowly) making connections to the two different databases. This is probably the biggest advantage. You can also do explicit DISCONNECT operations when you've finished with the database. This would benefit, for example, a menu program that read the user's menu options from the database and thereafter did not want to have database access. You could call down onto C code to call sqlexit() and other similar things, but it is much cleaner to be able to say 'DISCONNECT ALL' and not have to worry any further. The third benefit is that you can connect to remote machines without having a .rhosts file or /etc/hosts.equiv files -- because you can specify the username and password (but make absolutely sure you use a VARCHAR variable for the password field!). This can be very useful. There are probably others; however, lest anyone get fancy ideas, multi-threading isn't one of them -- the I4GL libraries are not thread safe and trying to do multi-threading is pretty much doomed to failure sooner or later. -- Yours, Jonathan Leffler (Jonathan.Leffler@Informix.com) #include Guardian of DBD::Informix v0.95 -- http://www.perl.com/CPAN "Windows is NOT a virus: a virus is small and efficient."