Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Connecting to Remote MSSQL6.5 Server

Posted on 1998-10-19
6
Medium Priority
?
181 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
dwwang earned 1200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

618 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