RE: New Era 3.0 - Problems with Logon to Crystal Report
Posted in 1997
Hi all Juan Bello Wrote> >David: >We have problems with logon to an Informix OnLine DSA server >in Applications in New Era 3.0 / Cristal Report.. >We got the -951 error code (User username is not known on the >database server) when we call CRPjob::StartJob() sentence . This is only if in >the Crystal Report we don't set the File --> Save Data With Report >option checked in (?) We had tried with the CRPEngine::logOnServer to >do this manually but with the same results , we will appreciate your help Well, that's an interesting one.... :-) I don't know why your connection is not working when you make a call to startjob(). If you are using the ODBC driver supplied with crystal 5.0 or the driver bundled with NE 3.0 then I suspect that you're having unique problems that no -one else can re-create. I say this because, I also had problems using the standard drivers, although they were not quite like the one above. For what it is worth, here are my thoughts on resolving the issue : I use the native Informix driver supplied on the crystal reports web site. http://www.img.seagatesoftware.com. Click on 'What's hot' and continue clicking until you see the native Informix driver link, download the zip file and extract it (it's only about 30K) I used this driver for two reasons : 1 - The 'standard' ODBC driver refuses to have a connect string written for it, crashes at run-time with stack overflow errors and the like. 2 - Continually logging on to the server while you're running your report is a bit tedious. Read the text file accompanying the driver on the installation and use, then try the following in your code: 1 - Instantiate the engine object with the open parameter set to true. 2 - Open the report job with OpenJob(Filename). 3 - Get the log on information for the first table used in your report,(I will assume that all the tables belong to the same database) getNthTableLogonInfo(0) - where 0 represents the id for the first table used in the report and 1 represents the second etc. This returns a variable of type CRPELogInfo (look it up in the help file if you need more info) 4 - The code is as follows : Note : CurJob is a CRPEJob object, LogInfo is a CRPELogInfo object, Main_Engine is a CRPEEngine object CALL reportWN.CurJob.GetNthTableLogonInfo(0) RETURNING ok, reportWN.LogInfo 5 - Set up the log on parameters, this is to bypass the 'standard' ODBC driver. LET reportWN.LogInfo.m_serverName = "Database Server Name" LET reportWN.LogInfo.m_databaseName = "Database Name" LET reportWN.LogInfo.m_userID = "informix" LET reportWN.LogInfo.m_password = "password" 6 - Next, log onto the server using the driver you downloaded as follows: LET ok = reportWN.Main_Engine.LogOnServer("P2SIFMX.dll",reportWN.LogInfo) --Where P2SIFMX.dll is the native driver you downloaded. 6 - Output to a destination ie: OutPutToWindow(title,left,top,width,height,window style,containing window) The above procedure has worked quite well for me and certainly speeds up the reporting process. There are however a few catches... 1 - You have to use the native driver with the report at CREATION time. Just log onto the server from within Crystal and click cancel until a logon server dialog appears, then choose the 'Informix Online Server' Option. This has to be done when you create a new report, it cannot be done afterwards - you simply cannot get the dialog to appear unless you've selected the 'new' option. This may well be problematic for you, since it will mean the recreation of all your crystal reports ... :-( 2 - The printer preview window that appears, sends the output to the default printer and I had no success in calling the printer selection functions built into the crystal class. This means you have to write your own common dialogs for printer selection in C++ and embed this code in the application, of course this will mean compiling your application to 'C' .... sorry. Good luck and please mail the list back with the results. Regards David david@west.co.za Senior Software Consultant The West Solutions Group Friends help you move...REAL friends help you move bodies!