Livecode ODBC connection without DSN?
Matthias Rebbe
matthias_livecode_150811 at m-r-d.de
Wed Jul 3 11:09:42 EDT 2019
Hi Dalton,
yes it is. You can use SQL Connection strings for it. But in any case you´ll need to have ODBC drivers installed.
This here is an old script i used to query the installed Windows ODBC drivers and do the connection with Connection strings.
It´s old and was registry check was used under Windows 32bit. But the Connectionstrings still should do with one exception.
This does not work with new versions of LC on Mac. The latest Mac version which worked with SQL Connection strings was 6.7.11.
Here´s the bug report from 2016
https://quality.livecode.com/show_bug.cgi?id=18151 <https://quality.livecode.com/show_bug.cgi?id=18151>
And here´s the script
-- connection strings Win/Mac with check which Windows SQL ODBC drivers are installed
switch the platform
case "MacOS"
get revOpenDatabase("ODBC","Driver={Actual SQL Server};Server=192.168.1.250;Database=MyDatabaseName;UID=sa;PWD=MyDatabasePassword;",,,)
break
case "Win32"
put listregistry("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\") into tOdbcDrivers
switch
case "SQL Server Native Client 11.0" is in tOdbcDrivers
get revOpenDatabase("ODBC","DRIVER={SQL Server Native Client 11.0};SERVER=192.168.1.250;DATABASE=MyDatabaseName;UID=sa;PWD=MyDatabasePassword;Trusted_Connection=No",,,)
break
case "SQL Server Native Client 10.0" is in tOdbcDrivers
get revOpenDatabase("ODBC","DRIVER={SQL Server Native Client 10.0};SERVER=192.168.1.250;DATABASE=MyDatabaseName;UID=sa;PWD=MyDatabasePassword;Trusted_Connection=No",,,)
break
case "SQL Server" is in tOdbcDrivers
get revOpenDatabase("ODBC","DRIVER={SQL Server};SERVER=192.168.1.250;DATABASE=MyDatabaseName;UID=sa;PWD=MyDatabasePassword;Trusted_Connection=No",,,)
break
end switch
break
end switch
Regards,
Matthias
Matthias Rebbe
free tools for Livecoders:
https://instamaker.dermattes.de <https://instamaker.dermattes.de/>
https://winsignhelper.dermattes.de <https://winsignhelper.dermattes.de/>
> Am 03.07.2019 um 16:42 schrieb Dalton Calford via use-livecode <use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>>:
>
> Is it possible to connect to a database without a predefined DSN using the
> livecode database connector?
>
> best regards
>
> Dalton
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com <mailto:use-livecode at lists.runrev.com>
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list