Solved

Connecting to Remote MSSQL6.5 Server

Posted on 1998-10-19
6
169 Views
Last Modified: 2012-05-04
Whats the easiest way to connect to a Microsoft SQL 6.5 Server across a TCP/IP network using Delphi 4 Client Server?
0
Comment
Question by:Dazza051197
  • 3
  • 2
6 Comments
 
LVL 4

Expert Comment

by:dwwang
ID: 1343376
Just setup SQL server client using TCP/IP, and then create a BDE alias pointing to the TCP/IP connection, that's all.

Need some further information, please add your comment.
0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1343377
Err, so I would need SQL Server Client installed, and then BDE, and then my application ?  An example of how I create the BDE alias to point to the TCP/IP connection would be a lot of help. I understand you may find this a little tedious, so I'll double the points for you if you can manage it.
0
 
LVL 1

Expert Comment

by:Greedy
ID: 1343378
well lets just get your development machine talking to it first...then we'll work on building the install for distribution.  Ok you have the C/S version that's good we will be using SQL Links instead of crummy ODBC...(has it's place but not in a Delphi C/S app)...this will out line a super quick example to show you how to do this - I'm actually doing it in D3 C/S but it hasn't changed in D4

open delphi
go to file | new application
drop a TDataBase Component on the form
drop a TTable on the form
drop a TDataSource on the form
Double click the TDataBase component
For name put in MyTestDB (this is your alias by the way - unless you have defined one in the DBE...but I don't recomend that)
leave alias name blank
for driver name use MSSQL all caps don't get confused by the SQL server one that's really ODBC
hit the button marked defaults - if you see anything in there that says ODBC you have the wrong driver
for database name type in pubs
for the server name put your server
check the login prompt and the keep connected to ON
click OK
in the object inspector click the Connected to true it'll pop up a login box...put in your user name and password...now you need to make sure that you have access to the pubs database on the SQL server if you don't go into the enterprize manager and give it to yourself...or log in as sa
Go to the TDataBase comp
in the object inspector set the database name to MyTestBD...it'll be in the list
then for table name put in jobs (dbo.jobs)
then click on the datasource and set the dataset to table1
click on the grid and set it datasource to datasource1
then click on the table and set active to true...the grid should display something...it might not have any data in it but you get the idea...

You can also use a TQuery to do this too...it's as easy and gives beter performance...(in most cases anyway)




0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 4

Accepted Solution

by:
dwwang earned 300 total points
ID: 1343379
No you don't need do these manually, InstallShield can do all for you, since currently we are just distributing our softwares in this way:

1.collect DLLs needed by SQL Client(and let IS to install them to windows's system directory or your App's dir)
2.add registry entry needed by TCP/IP SQL Client
3. Also IS can help you install the BDE

I'will paste all the details within an hour.
0
 
LVL 4

Expert Comment

by:dwwang
ID: 1343380
Hi, here is the detail:

1. the DLL's needed by SQL Server6.5 Client:
DBMSPCN.DLL
DBMSSOCN.DLL
DBMSSPXN.DLL
DBNMPNTW.DLL
NTWDBLIB.DLL
Let InstallShield to copy them to the proper directory.

2. Registry info needed: (let IS add them for you)

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\Client\ConnectTo
Add an string entry of your preferred ServerName (Its name can be any string, for example:MySQLServer)

Set the value to :  "DBMSSOCN,172.16.1.1,1433"
(172.16.1.1 should be replaced by you SQL Server's TCP/IP, and 1433 should be replaced by its port, but 1433 is the default)

3. In the BDE Alias section Step 3 of IS, simply add two lines in the editbox:

DATABASE NAME=YouDBNameInSQLServer
SERVER NAME=YouPreferredServerName (which is the entry name in the registry info)

That's all, depends on that you know how to use InstallSiheld.


0
 
LVL 1

Author Comment

by:Dazza051197
ID: 1343381
I'd like to split the points between Greedy and Dwwang.  Greedy's excellent detailed explanation of how to connect to the SQL database was perfect and Dwwang's list of the DLL's I need.  I've now connected to my first MS SQL Server via TCP and I thank you very much.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now