Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

Connecting to Remote MSSQL6.5 Server

Whats the easiest way to connect to a Microsoft SQL 6.5 Server across a TCP/IP network using Delphi 4 Client Server?
0
Dazza051197
Asked:
Dazza051197
  • 3
  • 2
1 Solution
 
dwwangCommented:
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
 
Dazza051197Author Commented:
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
 
GreedyCommented:
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
dwwangCommented:
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
 
dwwangCommented:
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
 
Dazza051197Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now