Board index » delphi » How to connect to mssql with named pipes instead of tcp/ip?

How to connect to mssql with named pipes instead of tcp/ip?

Hi!

I have tried some days now to communicate with a mssql server
with named pipes instead of tcp/ip.

It was when I had disabled the tcp/ip on the sql server and only had
named pipes enabled when I saw that my apps couldnt communicate with it
anymore.

I have dropped the following database components on the form:

TDatabase
TQuery
TSession

The three components are connected through the SessionName property.

What to do? I have tried to put things in the Params property of the
TDatabase control in a thousand of ways by now...

Best regards
/Anders

 

Re:How to connect to mssql with named pipes instead of tcp/ip?


This may not be a delphi problem.

First, make sure that you can communicate with SQL server using the default
sql tools.

You will have to run the SQL client config tool on each client and set the
clients to use Named Pipes as well as the server.

Quote
"Anders Linden" <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90EF59225anderslindenpercepti@207.105.83.65...
Quote
> Hi!

> I have tried some days now to communicate with a mssql server
> with named pipes instead of tcp/ip.

> It was when I had disabled the tcp/ip on the sql server and only had
> named pipes enabled when I saw that my apps couldnt communicate with it
> anymore.

> I have dropped the following database components on the form:

> TDatabase
> TQuery
> TSession

> The three components are connected through the SessionName property.

> What to do? I have tried to put things in the Params property of the
> TDatabase control in a thousand of ways by now...

> Best regards
> /Anders

Re:How to connect to mssql with named pipes instead of tcp/ip?


tr...@kc.rr.com (Travis L. Reno) wrote in <3b6697fa_1@dnews>:

Quote
>This may not be a delphi problem.

True, but a VCL one and I have not found a better newsgroup.

Quote
>First, make sure that you can communicate with SQL server using the
>default sql tools.

Yes, I dont have any problems with connecting to the sql server using named
pipes with the help of enterprise manager or query analyzer.

Quote
>You will have to run the SQL client config tool on each client and set
>the clients to use Named Pipes as well as the server.

The client is my program. (Using the 3 VCL components mentioned earlier).
Quote
>"Anders Linden" <no_spam_to_anders.lin...@perceptive.se> wrote in
>message news:90EF59225anderslindenpercepti@207.105.83.65...
>> Hi!

>> I have tried some days now to communicate with a mssql server
>> with named pipes instead of tcp/ip.

>> It was when I had disabled the tcp/ip on the sql server and only had
>> named pipes enabled when I saw that my apps couldnt communicate with
>> it anymore.

>> I have dropped the following database components on the form:

>> TDatabase
>> TQuery
>> TSession

>> The three components are connected through the SessionName property.

>> What to do? I have tried to put things in the Params property of the
>> TDatabase control in a thousand of ways by now...

>> Best regards
>> /Anders

Re:How to connect to mssql with named pipes instead of tcp/ip?


Anders,

   If you set Microsoft's Client Network Utility to use Named Pipes, then
that is what your using.  There is nothing to set in your code (this is not
a Delphi/VCL issue).  Just curious, why Named Pipes?  TCP/IP is much faster
(in our tests, but mileage may vary)

Good luck,
krf

Quote
Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90EF80682anderslindenpercepti@207.105.83.65...
Quote
> tr...@kc.rr.com (Travis L. Reno) wrote in <3b6697fa_1@dnews>:

Re:How to connect to mssql with named pipes instead of tcp/ip?


If You are using System DSN - check Client Configuration -> Network Library.
It must correspond server's configuration (see Kevin's reply)

Dimka

Quote
"Anders Linden" <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90EF59225anderslindenpercepti@207.105.83.65...
Quote
> Hi!

> I have tried some days now to communicate with a mssql server
> with named pipes instead of tcp/ip.

> It was when I had disabled the tcp/ip on the sql server and only had
> named pipes enabled when I saw that my apps couldnt communicate with it
> anymore.

> I have dropped the following database components on the form:

> TDatabase
> TQuery
> TSession

> The three components are connected through the SessionName property.

> What to do? I have tried to put things in the Params property of the
> TDatabase control in a thousand of ways by now...

> Best regards
> /Anders

Re:How to connect to mssql with named pipes instead of tcp/ip?


Yeah! Now it works with named pipes! Thanks a lot!

The question is... shouldnt it be up to the application what transport it
uses? Is the settings that I set in microsoft client network utitlity
affecting ado too? And how can tcp/ip be faster than named pipes?

Why named pipes? When you connect to a named pipe, you get a direct kernel
handle. They have a reputation of being fast. When you connect to a named
pipe on another computer, it will use netbios (and probably tcp/ip) as
transport. Did your test involve connecting to other computers or only the
same? I will use the same for client and server.

When I have looked at the api, it seems like a named pipe only allows a
client a time and queues the rest. It is a single-cpu system, so I think
thats the best way to use the cycles. If a processor only has one thing at
a time to do, it will not switch between tasks, right?

And if a named pipe is on the same computer as the one you are connecting
from, you will not use the netbios protocol either.

Isnt there a setting in my application to override the settings in the
Microsoft's Client Network Utility?

Thanks again.

Best regards
/Anders

kfrev...@midwayusa.com (Kevin Frevert) wrote in <3b66a5b7_1@dnews>:

Quote
>Anders,

>   If you set Microsoft's Client Network Utility to use Named Pipes,
>   then
>that is what your using.  There is nothing to set in your code (this is
>not a Delphi/VCL issue).  Just curious, why Named Pipes?  TCP/IP is much
>faster (in our tests, but mileage may vary)

>Good luck,
>krf

>Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message
>news:90EF80682anderslindenpercepti@207.105.83.65...
>> tr...@kc.rr.com (Travis L. Reno) wrote in <3b6697fa_1@dnews>:

Re:How to connect to mssql with named pipes instead of tcp/ip?


Quote
Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90F054897anderslindenpercepti@207.105.83.65...

Quote
> The question is... shouldnt it be up to the application what transport it
> uses? Is the settings that I set in microsoft client network utitlity
> affecting ado too? And how can tcp/ip be faster than named pipes?

I hope not, I have enough things to worry about :).  I believe so, but
someone who is an ADO expert might better answer that question.  Like I
wrote, your mileage may vary, but all the docs I've read (sorry, I don't
have any links off the top of my head), Named Pipes is a huge network hog
and the cause for a lot of network related bottlenecks.  Ok for a small
network, but for large, dispersed network, TCP/IP is the best choice.

Quote
> Why named pipes? When you connect to a named pipe, you get a direct kernel
> handle. They have a reputation of being fast. When you connect to a named
> pipe on another computer, it will use netbios (and probably tcp/ip) as
> transport. Did your test involve connecting to other computers or only the
> same? I will use the same for client and server.

During our tests we had 70 plus employees doing a number of different tasks
and performance was so bad, the apps (Delphi apps and M$'s native tools)
were almost unusable.  Switched to TCP/IP and queries that took 2-3 minutes
now are instantaneous.

Quote
> When I have looked at the api, it seems like a named pipe only allows a
> client a time and queues the rest. It is a single-cpu system, so I think
> thats the best way to use the cycles. If a processor only has one thing at
> a time to do, it will not switch between tasks, right?

How do you "use the cycles"?

Quote
> And if a named pipe is on the same computer as the one you are connecting
> from, you will not use the netbios protocol either.

> Isnt there a setting in my application to override the settings in the
> Microsoft's Client Network Utility?

I'm sure all the utility is doing is setting some registry settings, so
might do some looking around.  Just curious, why?

Re:How to connect to mssql with named pipes instead of tcp/ip?


kfrev...@midwayusa.com (Kevin Frevert) wrote in <3b67fb43_1@dnews>:

Quote

>Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message
>news:90F054897anderslindenpercepti@207.105.83.65...
>> The question is... shouldnt it be up to the application what transport
>> it uses? Is the settings that I set in microsoft client network
>> utitlity affecting ado too? And how can tcp/ip be faster than named
>> pipes?

>I hope not, I have enough things to worry about :).  I believe so, but
>someone who is an ADO expert might better answer that question.  Like I
>wrote, your mileage may vary, but all the docs I've read (sorry, I don't
>have any links off the top of my head), Named Pipes is a huge network
>hog and the cause for a lot of network related bottlenecks.  Ok for a
>small network, but for large, dispersed network, TCP/IP is the best
>choice.

But if the computer talks with itself, there can be no network hog.
Therefore tcp/ip would just only add a layer, I think.
Did your tests include cases where the client and the server was the same
computer?

- Show quoted text -

Quote
>> Why named pipes? When you connect to a named pipe, you get a direct
>> kernel handle. They have a reputation of being fast. When you connect
>> to a named pipe on another computer, it will use netbios (and probably
>> tcp/ip) as transport. Did your test involve connecting to other
>> computers or only the same? I will use the same for client and server.

>During our tests we had 70 plus employees doing a number of different
>tasks and performance was so bad, the apps (Delphi apps and M$'s native
>tools) were almost unusable.  Switched to TCP/IP and queries that took
>2-3 minutes now are instantaneous.

>> When I have looked at the api, it seems like a named pipe only allows
>> a client a time and queues the rest. It is a single-cpu system, so I
>> think thats the best way to use the cycles. If a processor only has
>> one thing at a time to do, it will not switch between tasks, right?

>How do you "use the cycles"?

I think it is the best for the cpu to not do more than one thing at the
same time, if possible. queues just _have_ to speed up the cpu, because it
doesnt have to switch between tasks all the time.

Quote

>> And if a named pipe is on the same computer as the one you are
>> connecting from, you will not use the netbios protocol either.

>> Isnt there a setting in my application to override the settings in the
>> Microsoft's Client Network Utility?

>I'm sure all the utility is doing is setting some registry settings, so
>might do some looking around.  Just curious, why?

Of course, I want my application to act in the way I have defined.
Without changing the registry.

Best regards
/Anders Lindn

Re:How to connect to mssql with named pipes instead of tcp/ip?


Quote
Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90F159A12anderslindenpercepti@207.105.83.65...

Quote
> But if the computer talks with itself, there can be no network hog.
> Therefore tcp/ip would just only add a layer, I think.
> Did your tests include cases where the client and the server was the same
> computer?

You are correct, there shouldn't be any network traffic.  I've only tested
against MSSQL desktop on my local machine (using TCP/IP) with a small subset
of our production database, so my mileage varies.

Quote
> >How do you "use the cycles"?

> I think it is the best for the cpu to not do more than one thing at the
> same time, if possible. queues just _have_ to speed up the cpu, because it
> doesnt have to switch between tasks all the time.

Are you writing kernel-level device drivers/NT services?  Unless your using
Assembler, I don't see how you can control what/how the CPU decides to
time-slice instructions.

Quote
> Of course, I want my application to act in the way I have defined.
> Without changing the registry.

Just courious, why would you want to do that yourself?   I'd rather have a
bad venereal disease than attempt to write my own network protocol
interface.

krf

Re:How to connect to mssql with named pipes instead of tcp/ip?


Quote
>Just courious, why would you want to do that yourself?   I'd rather have
>a bad venereal disease than attempt to write my own network protocol
>interface.

>krf

Putting the responsibility on the application instead of the system whether
to use named pipes or tcp/ip is hardly an attempt to write a protocol of
any kind.

Best regards
/Anders

Re:How to connect to mssql with named pipes instead of tcp/ip?


Then I'm confused.  You wrote you want to manipulate the network protocol,
but you don't want to modify the registry.  The only other way I know is to
write your own protocol (I'm sure there are the C headers somewhere you
could use).

Of course, this is getting way outside the bounds of any Borland/Delphi/VCL
issue (you might get better answers on M$ newsgroups).

Good luck,
krf

Quote
Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90F1AB3D1anderslindenpercepti@207.105.83.65...
Quote
> Putting the responsibility on the application instead of the system
whether
> to use named pipes or tcp/ip is hardly an attempt to write a protocol of
> any kind.

Re:How to connect to mssql with named pipes instead of tcp/ip?


What I want is to use the VCL components and in some way change some
property so that they will use named pipes instead of tcp/ip.

(Regardless of the settings in the "client network utility").

Hope I was expressing myself better this time :)

/Anders

kfrev...@midwayusa.com (Kevin Frevert) wrote in <3b696b47_2@dnews>:

Quote
>Then I'm confused.  You wrote you want to manipulate the network
>protocol, but you don't want to modify the registry.  The only other way
>I know is to write your own protocol (I'm sure there are the C headers
>somewhere you could use).

>Of course, this is getting way outside the bounds of any
>Borland/Delphi/VCL issue (you might get better answers on M$
>newsgroups).

>Good luck,
>krf

>Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message
>news:90F1AB3D1anderslindenpercepti@207.105.83.65...
>> Putting the responsibility on the application instead of the system
>whether
>> to use named pipes or tcp/ip is hardly an attempt to write a protocol
>> of any kind.

Re:How to connect to mssql with named pipes instead of tcp/ip?


If you are using ADO, set the Network Library property of the connection
string to the DLL name of the protocol you want to use (without the .DLL
extension).

If you are using the BDE and ODBC, it is a little trickier.  You may be able
to create 2 DSNs: one using named pipes, the other using sockets.  Then you
can code which DSN to use in your app.

If you do use TCP/IP socket connectivity, you cannot do Trusted Security
(ie. NT/2000 Authentication).  You have to use either Named Pipes or
Multi-Protocol (RPC) for trusted connectivity.

Hope that helps.

Al

Quote
"Anders Linden" <no_spam_to_anders.lin...@perceptive.se> wrote in message

news:90F261931anderslindenpercepti@207.105.83.65...
Quote
> What I want is to use the VCL components and in some way change some
> property so that they will use named pipes instead of tcp/ip.

> (Regardless of the settings in the "client network utility").

> Hope I was expressing myself better this time :)

> /Anders

> kfrev...@midwayusa.com (Kevin Frevert) wrote in <3b696b47_2@dnews>:

> >Then I'm confused.  You wrote you want to manipulate the network
> >protocol, but you don't want to modify the registry.  The only other way
> >I know is to write your own protocol (I'm sure there are the C headers
> >somewhere you could use).

> >Of course, this is getting way outside the bounds of any
> >Borland/Delphi/VCL issue (you might get better answers on M$
> >newsgroups).

> >Good luck,
> >krf

> >Anders Linden <no_spam_to_anders.lin...@perceptive.se> wrote in message
> >news:90F1AB3D1anderslindenpercepti@207.105.83.65...
> >> Putting the responsibility on the application instead of the system
> >whether
> >> to use named pipes or tcp/ip is hardly an attempt to write a protocol
> >> of any kind.

Other Threads