简体   繁体   中英

Accessing SQL Server 2008 R2 from a service in Delphi XE8

I'm writing a client and TWO servers in Delphi XE8. One server is a normal program with forms, the second is a windows service. Both expose the same three functions: a simple "ping", a file transfer, and a query on a MS SQL 2008 R2 database.

When I use client and the "program" server, all works well, I can write a query on the client, send the query to the server, and receive data.

When I use client and the "service" server, some parts work, but if I can write a query on the client, send the query to the server, the server receives the query, but it can't access the database.

I work on a VMWare virtual machine Win7 32 bit, with Delphi XE8 and TMS Sparkle as transport system, and DBExpress ad DB access. I have turned off antivirus and firewall. SQL Server is well configured, protocols, ports, browser is running. The service runs under LOCAL SYSTEM (with every other user the service can't start, I don't understand why).

I think TMS creates a thread every time it receives a request, and my code is inside this thread. Inside the thread I create a form, a TSQLConnection with owner the form, and a TSQLQuery, and try to open the connection.

In my log I find "SQL Error Code: 53": server not found or ... (there is nothing after "or").

I suppose it could be a permission problem, but i don't know for sure.

Some ideas?

解决:我在SQL密码中输入了错误...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM