Solved

"Cannot Connect to SQL Server" Error when Running Crystal reports from VB6 program

Posted on 2006-06-28
11
836 Views
Last Modified: 2012-06-27
We have a program written in VB6 that connects to a DB2 database and generates a crystal report based on user input.  The problems occurs after a new install, when the program attempts to write a crystal report, it gives the error message "Cannot Connect to SQL Server"  I believe the problem is somewhere in the .dll files that control crystal reports, but I do not know how to fix the problem.  The program does in fact connect to the DB2 database because it runs a SELECT statement on the database when the program starts.  There are several computers that the program runs fine on, so I know the connection string is correct.  Is there a tool I can use that wil make sure the correct .dll files are in place or is the problem somewhere else?

Thanks, Any help is greatly appreciated.
0
Comment
Question by:asubigsaxy
  • 6
  • 5
11 Comments
 
LVL 42

Expert Comment

by:frodoman
ID: 17004611
What driver are you using to connect to DB2?  I've tried several but the only one that seems to actually work correctly most of the time is the Client Access drivers.  I suspect that what you're encountering is a specific error (user access privaledges, etc.) but the driver is returning a very generic message.
0
 

Author Comment

by:asubigsaxy
ID: 17010322
We install the DB2 (v7.2) Run-time Client that was provided by IBM to set up the DSN for the connection.  
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17012882
There is more than one client but based on the version # I am guessing that this is the Client Express driver.  The first thing I'd check is if the computers that work have the same version of the driver as those that don't -- It's possible that the more recent version doesn't work the same way as the older ones.

If you have a standalone copy of Crystal, you might want to try running this report on one of the problem machines in the Crystal environment.  Sometimes you get a better error message there than you get coming back through an api.

frodoman
0
 

Author Comment

by:asubigsaxy
ID: 17042500
Thanks Frodoman,

The same driver is installed on each machine.

The crystal design enviroment is not installed on any of the problem machines, but I think our license would allow us to do that.  Something in the .dll files that fire up crystal reports must be messed up, but I dont really know much about how .dll files work.
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17043038
>>> I think our license would allow us to do that.

Yea, as long as you aren't using your own copy at the time you should legally be able to install it and 'work' on another machine for a little while to see if you get a better error message.

You might just want to try reinstalling the dll files for Crystal (I assume you're using one of the merge modules to do it) - maybe something got corrupted there.  
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.

 

Author Comment

by:asubigsaxy
ID: 17043254
The VB6 program installs the .dll files, but I am not familiar with merge modules.
0
 

Author Comment

by:asubigsaxy
ID: 17043502
Also, we use crystal reports 8.5
0
 
LVL 42

Expert Comment

by:frodoman
ID: 17045045
Can you reinstall the VB6 program or will that make a mess of things?
0
 

Author Comment

by:asubigsaxy
ID: 17045174
I have re-installed it many times on one machine, the program was written by my predecessesor, maybe some windows update created a file version problem, I've read that can cause the error -- but I am kinda clueless as to what .dll files are required for it to operate sucessfully --
0
 
LVL 42

Accepted Solution

by:
frodoman earned 500 total points
ID: 17045395
That certainly could be the case - particularly if a newer dll was installed then when you reinstall the vb6 app it won't overwrite a newer dll with an older one.

You can try using the free FILEMON tool ( http://www.sysinternals.com/Utilities/Filemon.html ) while running the application.  It will show you all of the dll's that are accessed but you may have a lot to sift through unless you can isolate this application.  I'd stop everything else on the machine from running that you can before using FileMon.

0
 

Author Comment

by:asubigsaxy
ID: 17130655
The .dll driver the program was using was an old p2soledbc.dll  We rewrote the code to use a new p2odbc.dll -- The crystal report driver was getting the login info from the DB2 driver on the client machine, so only one user could correctly access the program.  The new .dll uses the windows login so that anyone who logs in can use the program.  I think it was developed way back in the day when there was only one user per computer.
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

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

759 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

20 Experts available now in Live!

Get 1:1 Help Now