C11 migration of C5 - ODBC driver

Hello again.

I have managed to get an end-to-end build of our applications in C11. I am still yet to get one of the more heavily modified C5 templates moved to our template chain, but I have confidence I’ll get it done eventually…

My current problem…

When I run our C11 application, as soon as I attempt to open the first table, I am prompted to select the DSN then provide a username and password to complete the connection. Once connected the applicatioin runs without issue or any further connection prompts. The method we used in C5 worked adequately but doesn’t seem to work the same way in C11, has it changed?

I copied the C5 DCT to the C11 folder and allowed C11 to convert it (rather than export to TXD and import it into a clean C11 dictionary). As far as I can tell, all settings appear in C11 as they do in C5.

As per the image, we provide the ‘OWNER’ as !GlobalDSN and in code we assign values to it of the passed DSN name, our configured db user and password. As you can see, the ‘Connecting To’ line in C11 is blank but not in C5. The code between C5 and C11 did not change eg;

GlobalDSN = CommandDSN & ‘,’ & ODBCUser & ‘,’ & ODBCPass

and is set prior to the first table being opened.


I ran trace on both our C5 version and C11 version to see what the differences are, here are the results:


I’ve been trying various things for several hours and looking at the C11 help doco but nothing jumps out at me as being a solution.

I notice that in C5 with DET, CheckOpen() is only declared/defined in DSA but in C11 each app has it’s own CheckOpen() declaration. Is this to do with the Threaded attribute on each table in the DCT?

I’d appreciate any help or tips that anyone might have.

A second question, in C5 the !GlobalDSN in the owner field method only recognises System DSNs, any idea if C11 identifies User DSNs?


Hi Andrew

one thought: check the definition of GlobalDSN and make sure it is not threaded.

if it is threaded and it is being setup on the application frame at start up time, then it will be blank in all other threads.

maybe show the generated code for the GlobalDSN definition


Geoff R

Hi Geoff.

It’s been a while since it was done in C5 so I can’t speak as to why it was done that way, but GlobalDSN is hand coded (it could be done in the Data UI) in each app as GlobalDSN STRING(100). Not Threaded.

It seemed to work and it did the job.

I’m thinking I should perhaps declare it in the app that contains the DCT declarations and delcare it elsewhere as EXTERNAL,DLL.

The odd thing is that once the ODBC connection is established via the Data Source selection
and the credentials supplied, the application happily plods along without any further request for data source or creds.


You say you use:
GlobalDSN = CommandDSN & ‘,’ & ODBCUser & ‘,’ & ODBCPass
Are those variables CSTRING or String? If STRING you might need to CLIP() them or you’ll have lots of spaces.
I also thought the DSN had user and password in it? I usually use DSN-less connections so it’s been a while.

I suggest it’s not being set in time now, before it’s used. Presumably in your custom template code there is a somewhat different start-up sequence. Have a look at where it is first used, and then set it before then.

Thanks everyone.

What works in C5/DET doesn’t necessarily work in C11.

Ultimately it was a combination of things. I made GlobalDSN a global variable (and removed local declarations) made it a CSTRING and CLIP()ed the assignment.

Seems to be working as intended/expected now.

Thanks for the input.


1 Like