Can't connect to SQL Server in Delphi 10.3 - delphi

I just installed the community version of Delphi, Delphi 10.3
I want to use FireDAC in stead of ADO,
so I want to test connections to SQL Server using FireDac but it is a complete disaster.
I dropped a FDConnection component on the form, and want to configure it to use Sql Server
There I notice I can choose from many DriverNames but not MSSQL
Why is that ?
So I tried the FireDAC Explorer but this has even more mysteries.
I add a new Connection Definition and there I can use MSSQL, but I cannot save this definition.
The save and save as button are disabled.
So I enter all the parameters I need, and yes, it opens my SQL Server database. I can see all tables, views, procedures... And I can even open a table to see the first 10 rows.
Great, if I could only save this definition...
Everytime I open the FireDAC Explorer my new definition is still there, but all parameters are not stored. I have to enter them all every time again.
But, no problem I think. I copy the parameters from the working definition and paste it in the parameters from the FDConnection on my form.
The parameters look like this
User_Name=xx
OSAuthent=No
Server=123.456.789.987\GTT
Database=DB_Test
DriverID=MSSQL
Name=DB_Test
Hm, interesting. Now it does show MSSQL as drivername. So let's set the connection property to true.
Now I get this error (allthough this is working fine in FireDAC Explorer with these parameters)
[FireDAC][Phys]-300. Driver [MSSQL] is not registered. To register it,
you can drop component [TFDPhysMSSQLDriverLink] into your project.
Well alright, if that is all I need to do.
But, it seems I don't have the component TFDPhysMSSQLDriverLink
I have others for all kind of databases, but not this one.
It seems there is something missing, but the errors don't give me much of a clue
So I am hoping there is someone here that understand the errors and can help me to fix this
EDIT
I found this question here with an accepted answer, but I don't know how to use that answer. I have no clue how to use the License manager to register FireDAC

Related

Unable to access SQL table from appl running as service

I have a small test application, made with Delphi 10.3.1 as an Stand Alone HTTPSYS Intraweb service. It has an ADOConnection and a ADOTable and in FormShow of unit1, I open the connection, and the table and reads the first 10 rows and add them to a listbox. Just to see that it works and is possible.
When running the application as a Stand Alone HTTPSYS, vith visual GUI, it's working nicely, but when I compile it as a service, and install it, on the sql server, or on the development machine, it fails with access Violation, trying to open the table. I suppose it is an Authentication problem.
I have tried to open connection with both Windows Auth, and with a specific SQL login, and I have tried running the service with both local system (default) and with the specific SQL account.
What am I missing ?
The Specific SQL login, works in SSMS. I'm able to use it to login and access my tables.
Also, if I create the application as a DLL and put it on my IIS10, it works fine.
You are right. It has nothing to do with authentication.
For the IntraWeb HttpSys Stand Alone program to run as a service, the ServerController.ComInitialization property must be set to ciMultiThreaded.
Thanks for your comment which lead me to look elsewhere. You do deserve the credit.
Regards
Soren

Intraweb - web application - users sessions

Today I started to write my first web application and I can't pass one step.
Everything works almost fine... I can connect to the server and open website. Problem is when I open browser and type the same address on the second pc, then I get te same data as on the first one.
Detailed...
Application has two forms, first is for login, and second one is for receiving data.
When I login on the first pc and second form shows up, and then I open browser and put the address of the server on the second pc, I see the second form after login from first pc.
What I should do in this case? I tried to find the solution in the net, but I couldn't :(
If you are using any Delphi IDE after XE3 (including) and using the IntraWeb edition that comes with Delphi you must upgrade in order to have it working correctly. It is free, and more information can be obtained here:
http://atozed.com/IntraWeb/Download/FreeKeyRequest.EN.aspx|
After upgrading (if this is your case) I suggest you to take a look at one of the IntraWeb demos, here:
https://iwdemos.codeplex.com/SourceControl/latest
There is a demo named Features that shows you exactly how to create a multi form application. To be honest, I work with IntraWeb for a long time and I've never seen that. Unless you are using some global var to hold your "current" active form. Have in mind that IntraWeb is a fully multithreaded application and global vars should not be used, unless you have some mechanism protecting concurrent access (but you should get rid of them and use ServerController properties instead).
Thnks for your quick reply.
I work with Delphi from some time, but I never used Intraweb, I worked with ComPort and IP works for I/O devices. I have XE7 and I upgraded Intraweb to 14.0.52.
I can't find a good file exchange server to put my application for sharing with you. If I find somethin I will post it below.
You can check the code and other settings of my simply project. I put the web application inside the link below, it is without the .exe file.
https://www.dropbox.com/s/75zurcew0zr363x/Project1.rar?dl=0
Thanks for your help.

Change Lightswitch internal database to external

I have been developing an application in Visual Studio Lightswitch (Silverlight client in VS2010 SP1 if it makes any difference), and so far have done all the database development in the Lightswitch designer.
I now want to use an external database, but don't want to recreate the whole app, or even just the screens. I have scripted the database, and have created a copy in SQL Server, but can't find out how to get Lightswitch to use this external database without starting the whole thing again.
Is there a simple way to change the connection string so that I can carry on from where I am, but have Lightswitch point at the external database instead of the internal one?
Turns out this is a very difficult thing to do. Super Lightswitch-hacker David Baker saw a post I'd made on the subject in the MSDN Lightswitch forum, and kindly offered to have a go at it for me. It took him several goes, but we got there in the end.
I wouldn't recommend this to anyone. I would strongly recommend using an external database right from the start. I can't see much benefit from using the internal one, and if you ever need more control over it, or want to switch to an external one, you've got major problems.
Hope this helps someone.
You must publish your project in order to create a new SQL database , publishing your project will create DB scripts for your new DB , don't use the internal LS DB to create script for your new DB.

how to use DDE server

Can I get a little code example to use DDE as a server? I know how to use the client part, but can't figure setting up my app to act as a server and receive data.
Have a look in your Delphi installation for a folder called DDEDemo. It's a DDE project that Delphi use to ship with (I'm not 100% sure it's still included, but have a look). The demo includes a DDE client and server.
Edit - Try this link for some example code.
It is so easy to use the DDE server that you don't even need sample code. You can do it just at designtime inside the Delphi form designer:
To create a server that sends out data:
Drop a TDDEServerConv and
TDDEServerItem on your form or data
module.
Connect the server item to
the server conversation (set
DDEServerItem1.ServerConv=DdeServerConv1
using object inspector, there is a
drop down list, but double clicking
it is enough).
Set the DDEServerItem.Text value to some valid text value (ie 'A')
To receive data, you might want to have macros that are executed by the DDE client that pass data to the server. For this you use the DdeServerConv.OnExecuteMacro event. Try dumping the parameter Msg:TStrings to a memo like this:
Memo1.Lines.Assign(Msg);
Now save and run your project.
To test it in excel type in:
=Project1|DdeServerConv1!DdeServerItem1
The excel dde client syntax parts are Application name followed by vertical bar, conversation name, followed by exclamation mark, then item name.
And you will see the value (A, or whatever you put into the Text property in the item) appear in Excel.
That's a working single item DDE server without any code written by you.
I generally find that I create the conversations and the items at runtime, instead of at designtime, in a real world scenario that is more useful for me.
For older (non unicode) Delphi versions there is also a full featured commercial product called Django that helps a lot with DDE work.
I think also you might be looking for information on how to write a "DDE Poke" command handler on the delphi side. I don't have a demo for that. I tried it, and the obvious things didn' quite work right for me (the item on your server has an OnPoke event, I wrote a simple client, called PokeData, and it didn't work).

Is ADO unable to report a database is marked read-only?

If "read only" is checked in the Windows desktop properties for a .dbf or .mdb file,
and a Delphi 6 ADO connection (say, via Jet for an .mdb file or ODBC for a .dbf file)
is then used to open that database, TADOTable.CanModify returns true and
TADOTable.ReadOnly returns false, apparently failing to detect the file is
actually read-only.
From the VCL source, it looks like .CanModify is just set from Supports(xUpdates)
and .ReadOnly is set from the LockType (even "read-only data source" in
TADOConnection.Properties returns 0), so those properties seem more like
tools for detecting connectionstring options as opposed to detecting the
database's original read-only state.
So what's the proper ADO technique to detect a database is marked read-only
before TADOTable.Edit is attempted? Seems the solution should not be
specific to Windows files, but some kind of database-independent technique
using just ADO. What's the solution?
I know the question is old, but it seems the accepted answer is at least incomplete. From my own experiments it seems you can detect a read-only database prior to attempting to edit data:
My setup:
I create a TADOConnection to a MDB file using the following ConnectionString: Provider=Microsoft.Jet.OLEDB.4.0;Data Source="C:\SomePath\MyDatabase.mdb"; I use a few more flags but they don't seem to matter here.
Normally when connecting, MyADOConnection.Mode switches from cmUnknown to cmShareDenyNone.
My observation:
When C:\SomePath\MyDatabase.mdb file is marked as read-only by the operating system, the connection's Mode property switches to cmRead instead upon connecting.
I can access this property directly from my TADODataset through MyDataset.Connection.Mode
Side note: In my experiments, subsequent connections required Mode to be reset to cmUnknown in order for it to be able to switch back properly to cmShareDenyNone.
Please also note that editing a row may still fail for various other reasons, even if Mode returns cmShareDenyNone. This does, however solve the original question, as to how to detect a MDB that is marked as "read-only" by the OS.
It's a pity, but you can't.
However, since the filename is part of the connection string, you can check yourself.

Resources