[Gambas-user] Connection via ODBC
bagonergi at gmail.com
Mon Oct 19 19:44:03 CEST 2020
Il giorno lun 19 ott 2020 alle ore 19:35 First Last <d4t4full at gmail.com> ha
> (Sorry for the "mailus interruptus", I'll start over.)
> In *this link*
> you'll find info about setting up the whole DB2 under ODBC environment for
> Linux/Unix, courtesy of IBM.
> Note that since Aug 2015, though, there are two ways to set up pretty much
> *any* database using ODBC in Gambas.
> The first one is setting up the whole unixODBC Driver Manager environment
> as above described and normally used, but it takes time, is kind of
> error-prone and tiresome if you have to deploy the same app to a bunch of
> end users (same setup over and over...).
> The second approach I tried to assimilate as smoothly as possible to
> whatever already existed, and is similar to what exists on Windows
> platforms, and it is the use of "Connection Strings".
> Basically, you tell ODBC all the settings that normally go in the several
> ODBC config files in a single string, and the ODBC Driver Manager will take
> care of the connection.
> This is an example Connection String for connecting to a MSSQL Server 2005
> using freeTDS from ODBC
> In Gambas, you'd connect this way:
> *' Gambas class file*
> *Private $conn As Connection*
> *Private Sub Connect(connString As String)*
> * $conn = New Connection*
> * $conn.Type = "odbc" 'Yup, lowercase.*
> * $conn.Host = connString*
> * $conn.Open()*
> You just call Connect() with the adequate connection string.
> Now, parameters for the vast amount of different drivers depend on the
> actual driver used by ODBC (unfortunately, I don't have access to anything
> besides MSSQL), as an example, the *TDS_Version* parameter in the example
> above sets some defaults in FreeTDS so it knows "beforehand" to what kind
> of server it will connect.
> Beware: Some parameters may, others WILL, affect connectivity and may also
> impact overall speed.
thank you very much, I pass the information to our friend immediately...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the User