ODBC connection SQL 2008

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bsouthuk
Posts: 261
Joined: Fri Dec 05, 2008 7:25 pm

ODBC connection SQL 2008

Post by bsouthuk » Mon Dec 01, 2014 1:06 pm

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

snm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 253
Joined: Fri Dec 09, 2011 11:17 am

Re: ODBC connection SQL 2008

Post by snm » Tue Dec 02, 2014 7:51 am

Check the syntax of revOpenDatabase in dictionary for ODBC connection. There is missing second "," after "datasource name".

Marek

AxWald
Posts: 578
Joined: Thu Mar 06, 2014 2:57 pm

Re: ODBC connection SQL 2008

Post by AxWald » Mon Jan 19, 2015 7:30 pm

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!
All code published by me here was created with Community Editions of LC (thus is GPLv3).
If you use it in closed source projects, or for the Apple AppStore, or with XCode
you'll violate some license terms - read your relevant EULAs & Licenses!

Post Reply