Problem : Error:599 Cannot open SQL server

Problem : Error:599 Cannot open SQL server

Error:599 Cannot open SQL server
Execute .

I use Delphi5 Enterprise (Update pack 1 and Delphi 5 ADOExpress Update Pack 2 are installed) and the Crystal Reports VCL v. 7.5.0.52 to view/print my reports. The reports are designed in Crystal Reports 8 Developer Edt. and I use af MS SQL Server 7.

The above problem occurs when I try to show/print the report with other data than the ones that was saved with the report. Fx, I preview the report in Crystal Reports with the parameter id “7” and saves the data with the report – no problem there. If I then try to open the report (also with parameter id “7”) in my Delphi program, everything still works fine. But, if I from my Delphi program opens the report using parameter id “2”, then the above error occurs.

The “Convert database driver” tells me that I’m using the “pdssql.dll” to connect to my SQL Server. Isn’t pd*.dll old 16bit drivers !? I’ve download p2ssql.dll v. 8.0.0.21 from Crystals web site, but I can’t select it in the “Convert database driver” list !?

Hope you have a solution to my problem.

Thanks in advance.


Solution: Error:599 Cannot open SQL server

Just wondering why you’re not using the latest crystal reports 8/8.5 VCL. Are there any issues you have to consider???
If there are no issues at all, I highly recommend you to go to cystal decision site, download the VCL and replace your version 7 vcl.

Are you connecting with an ODBC data source?
Let see if I can remember this right. A couple of years ago, I encountered somewhat the same problem as this. Below is a code sample that is similar to what I use to load a report, connect to the database server, and execute the report. This code runs using the latest cr8 vcl:

procedure PrintReport(Report: String; Preview: Boolean = False);
begin
try
Crpe1.ReportName := ‘c:\reports\myreport.rpt’;

// supply the values for SQLServerName, SQLUserName, SQLPassword and SQLDBName with the exact value as declared on your BDE.

Crpe1.Connect.ServerName := SQLServerName;
Crpe1.Connect.UserID := SQLUserName;
Crpe1.Connect.Password := SQLPassword;
Crpe1.Connect.DatabaseName := SQLDBName;
Crpe1.Connect.Propagate := True;

if Preview then
Crpe1.Output := toWindow
else
Crpe1.Output := toPrinter;

if Crpe1.Connect.Test then
Crpe1.Execute;
except
on E: Exception do
MessageDlg(Format(‘Unable to execute report:’ +
#13#10 + #13#10 + ‘%s’, [e.Message]), mtError, [mbOk], 0);
end;
end;

If you have problem with runtime files, there are a number of utilities that come with Crystal Reports which are very useful for tackling Runtime File problems.  Some of these are installed in the same directory as CRW32.EXE, and others can be found in the Tools directory on the Install CD:

DEXPERT.EXE – This is the Report Distribution Expert from Crystal Reports.  With Crystal 6.0, it is a separate program.  With Crystal 5.0, you will need to run it from the Report menu of the designer (CRW32.EXE).  This program is mainly intended to simplify the distribution of Compiled Reports, which are usually used by people who do not want to do a programming interface to the runtime engine.  Hence it is of limited use to Delphi developers, but can be used to provide a list of required runtime files.  Bear in mind that it will list all available U2L’s and Export DLL’s, whether they are used by the Report or not.

DSX32.EXE – This program generates a list of loaded DLL’s for a specific application which is running.  It also has a Compare option for comparing two different lists, which is very handy when you have one machine that works and another that doesn’t.  This utility does not work on Windows NT.

RPTCHK32.EXE – The purpose of this utility is to load a Report, analyse it for the Runtime Files it requires, and then provide you with the results of the analysis.

CRWCHK32.EXE – This utility was meant to be run on a client machine.  You tell it what Crystal version you are distributing, and which options you want to scan for, and it will search out the DLL’s and tell you if the versions are what was expected or not.  It will list all the versions of the files that it finds in the Windows search path, along with their versions, dates, and sizes.  It will also record any that it does not find.

SQLCON32.EXE – This utility does not actually check for Runtime Files.  It is an application which connects to ODBC and tests out ODBC Data Sources to see if they are functioning correctly.  It will retrieve lists of tables and fields from an ODBC Data Source, and run an SQL Query on a Data Source.  It’s primary use is to test out ODBC connection problems on client machines.

When connecting to ODBC, there are two layers we are concerned with:  The Report’s connection to ODBC via the P2SODBC.DLL, and the ODBC drivers connection to the database.  If there is a problem with runtime Reports connecting to ODBC on a client machine, we need to find out which layer is giving the problem.  If SQLCON can connect and run SQL Queries, then the problem is with P2SODBC.  It is either not being found, is the wrong version, or is corrupt.  If SQLCON cannot connect, then the problem is with the installation and setup of the ODBC drivers.