开发者

Embed SQL Password into Crystal Reports RPT file?

开发者 https://www.devze.com 2022-12-28 06:23 出处:网络
We are experimenting with Crystal Reports viewers such as this one: http://www.thereportviewer.com/ ... which can actually re-connect to the data source and re-run a Crystal Reports RPT file with li

We are experimenting with Crystal Reports viewers such as this one:

http://www.thereportviewer.com/

... which can actually re-connect to the data source and re-run a Crystal Reports RPT file with live data.

However when running the report the viewer asks for a password to connect to the data source (in this case SQL Server).

Does Crystal Reports have some wa开发者_运维百科y of embedding a connection password into a RPT file to avoid this? Or should I be using a System DSN from the Control Panel/ODBC thing to get around this?

I figure someone else must have had this problem.


You can't do that. If possible set the password in the DSN or use a Report Viewer that can store the passwords for you. You can of course also build your own .NET report viewer, which isn't very hard to do if you've got .NET knowledge.

Added on April 29, 2010:

What you can try is doing the following: Connect to a "ODBC (RDO)" via "Create Connection" in Crystal Reports. At the bottom of the dialog you'll find an option to enter a connection string. A connection string can contain the login info, like the example below.

Example connection string: DSN=;DB=;UID=;PWD=password


To automatic connect to SQL using user sa and password in Crystal Reports

1) Create File DSN in ODBC Control 2) In Create file DSN add line with SA Password like this:

[ODBC]
DRIVER=SQL Server
UID=sa
PWD=your_pass
DATABASE=Your_Database
WSID=YourServerName
APP=System operacyjny Microsoft® Windows®
SERVER=YourServerName\YourDatabase
Description=YourDescription

3) Connect to SQL in Crystal Report using Your DSN File

You have to remember that your password is easy to find so this is very dangerous.


In newer version of The Report Viewer, you create an override connection, leaving the server and database fields blank, but setting the username and password, and it will work. The software will set the username and password to that value without changing the other connection settings inside the report. This will stop it from prompting you for a username and password.

You could also set the username and password inside the ODBC driver, or other driver settings, but some databases don't allow this for security reason... and you may not be using ODBC.


we had this problem too, but are currently assessing sabrelogic logicity viewer. It will store the username and password in a separate file, which call up, and runs the report. It has the advantage that I can store the reports in a central location, and just send out the file that calls up each report to each user, simplifying the problem of making changes to a report that has been distributed. Sabrelogic

The only donwside that I have found with it to date is that it doesn't handle dynamic parameters very well.


I had the same problem with hana studio + crystal report and I solved it with this conection string, I forgot to put the user and password.

DRIVER={yourdriver};SERVERNODE=servername or IP;DATABASE=databaseName;UID=databaseuser;PWD=password

0

精彩评论

暂无评论...
验证码 换一张
取 消