Page 1 of 1

ODBC connection SQL 2008

Posted: Mon Dec 01, 2014 1:06 pm
by bsouthuk
Hi

I wonder if someone is able to help me as I am having issues connected to my companies SQL database using Livecode.

Firstly, I have created an ODBC data source

I am using the following code in LIvecode:

Code: Select all

on mouseUp
-- use a global variable to hold the connection ID so other scripts can use it
global gConnectionID


-- connect to the database
put revOpenDatabase("ODBC", "data source name", "database name", "userid", "password" ) into tResult
-- check if it worked and display an error message if it didn't

-- & set the connection ID global

if tResult is a number then
put tResult into gConnectionID
answer info "Connected to the database." & cr & "Connection ID = " & gConnectionID
else
put empty into gConnectionID
answer error "Unable to connect to the database:" & cr & tResult
end if
end mouseUp
However, I keep getting the following message even though I am using a laptop that is connected to the companies network:

*unable to connect to the database: [microsoft] [odbc driver manager] data source name not found and no default driver specified*

Is someone able to help with this? Am very desperate!

Many thanks

Daniel

Re: ODBC connection SQL 2008

Posted: Tue Dec 02, 2014 7:51 am
by snm
Check the syntax of revOpenDatabase in dictionary for ODBC connection. There is missing second "," after "datasource name".

Marek

Re: ODBC connection SQL 2008

Posted: Mon Jan 19, 2015 7:30 pm
by AxWald
Hi,

and be sure to use the correct ODBC drivers - on my 64bit machine I had to install the 32-bit drivers to work with LiveCode and Access 2003!

Have fun!