MsSQL Application Example with Connect String wanted

Hello,

Is it possible please to share a small application with mssql driver, to see the connect string, where to put it and how it looks like?

Thank you
Michael Evangelinos

Hi Mike,

In the dct, add a Global Variable (eg GLO:Owner) and specify it as !GLO:Owner in the owner part of the table definition (note the exclamation before the variable name)

In your app, set the GLO:Owner before your tables are opened.
An example of its contents would be:-

GLO:Owner = 'ServerPC\SQLServer,MyDB,MyUser,MyPassword'

So basically 4 parts split by a comma. The parts are:-

Server Name and SQL Instance Name (ServerPC\SQLServer)
Database Name (MyDB)
Username (MyUser)
Password (MyPassword)

Use this if you are using Mixed Authentication on your SQL Server. If you are using Windows Authentication then the contents of GLO:Owner should be slightly different - I don’t think you specify the user or password parts - hopefully someone else can confirm this :slight_smile:

Personally, I always use Mixed Mode and have my applications have their own SQL login - just a personal choice.

Hope this helps,

Thanks,

Andy

1 Like

Thank you Andy!! I wiil try!!!

Hello Andy!
Is it possible to send me a small apps with a dictionary with all this you said me?
My email is [email protected]
Working in clarion 9.1

Thank you
Michael Evangelinos

With MSSql file drivers

Are you having a specific problem like not being able to connect to the MS sql server?

Firewalls can be an issue if you are connecting to a db on a different machine, and being able to use the old sa,sa in the string as username and pwd is not default now. The sa was short for System Account, and it just gave too much access to the sql server which is why its no longer used or recommended by MS.

Hello RichClaCode!
I don’t have to have a problem with Firewalls till noy.
I want a small app and a Dic for my problem just to anderstand it better.

Thank you
Micjae; Evangelinos

I cant help, I dont have any MS SQL version installed.

Thank you anyway RichClaCode!!!

Here’s a quick C11 example for you.

Check the Global embeds for an example of setting the Glo:Owner string.

MSSQLExample.zip (383.6 KB)

You’ll need to download and restore the AdventureWorks2019 database.

https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2019.bak

2 Likes

΅Σας ευχαριστώ πολύ αλλα δεν ανοιγει το zip. Εχω την clarion 9.1

Clarion 8 Example

MSSQLExample_Clarion8.zip (121.9 KB)

1 Like

(Καλησπέρα Mike
Το ZIP αρχείο δεν έχει πρόβλημα, το άνοιξα κανονικά)
Hello Mike…
ZIP has no problems… I can extract it’s contents:
MSSQLExample.app
MSSQLExample.cwproj
mssqlexample.dct
MSSQLExample.sln

HTH
Theodore

Hello Donald…
I didn’t have problem opening the zip file…
Just FYI…
Theodore

1 Like

Thanks to all of you. I will give a .try!

Michael Evangelinos

Hello donriidly!!
I am trying to learn from your application. I woud like to ask you the tables and the fields are created in Mssql or in clarion?

Thank you
Micahel Evangelinos

Hi Mike.

As an interesting side-note, you can also add your app name to the connection string, that can be used by the database administration teams to identify connections that come from your app, possibly to do tracing or performance improvements.

You postfix your app name in the GLO:Owner variable (as Andy explained here) with something like this

… & ‘; APP=MYNAME’

To check that it’s working, open the app with at least one table, then in SSMS run

sp_who2

to show active connections. Yours should be amongst them in the column “ProgramName”. But as I said, this may only be usefull when your database is managed on a shared server with dba’s involved.

Matthys

1 Like

I imported the tables from the MSSQL server using the Clarion dictionary. So, they were created on the SQL server side, interpreted by Clarion, and added to the dictionary.

It is possible to create the tables in the Dictionary and have Clarion create the tables on the SQL server.

Capesoft’s FM3 has great documentation on managing tables in SQL. Even if you don’t have FM3, the documentation could be useful.

Hello again, donridley


Database=person
table = dbo.people
And i have 3 fields in my dictionary, code, name, age.
Is it possible to make app and dct…for me? (MSSQL)

Thank you
Michael Evangelinos

excuse me Thys but i didn’t undestand you…