Change DSN connection at runtime in CR2010?

Hello,
I'm using CR2010 to attempt to run reports created in Crystal 8.0 using a DSN (MS Sql).  This works fine if attempting to run a report that was created against the target DSN but if trying to change to a different DSN at runtime  I get an error - "The table xxxx could not be found".  I'm hoping to find solution that does not involve changing the actual reports as they are already distributed (currently run using COM).  This probably doesn't help but when using the legacy COM method to run the reports, they work against a different DSN.
Currently, I create a new ConnectionInfo instance, set the server (DSN), db, user and password  then Set and ApplyLogOnInfo for each Table - this does not seem to have any effect.  I found some suggestions to try the following but this seems to just fail to connect at all as I end up with "The field name is not known":
Table.Location = connectionInfo.DatabaseName + ".dbo." + table.Location.Substring(table.Location.LastIndexOf(".") + 1);
Is there a way to connect to a different DSN, it will always be MS Sql, without having to update every customer report?
Thanks.

See if the KB [1553921  - Is there a utility that would help in writing database logon code?|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333533353333333933323331%7D.do] will help.
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Similar Messages

  • Changing database connection at runtime

    Hi All,
    I have multiple screens based from different database instances. How can I make a single menu screen which will allow log in for another database connection? I tried using the LOGIN_SCREEN built in but it does not change the connection once you are already connected to one database.

    If you want to change connections, you first have to logout. Besides the logon_screen builtin does not change the connection, but it only sets several application properties.
    In the Forms Help there is an example how to use the logon_screen. It basically comes to the next pl/sql code:
    declare
    MyUsername VARCHAR2(40);
    MyPassword VARCHAR2(40);
    MyConnect VARCHAR2(40);
    begin
    logon_screen;
    MyUsername := Get_Application_Property(USERNAME);
    MyPassword := Get_Application_Property(PASSWORD);
    MyConnect := Get_Application_Property(CONNECT_STRING);
    logout;
    if MyConnect is not null then
    logon(MyUsername,MyPassword| |'@'| |MyConnect);
    else
    logon(MyUsername,MyPassword);
    end if;
    end;
    null

  • Does changing report connection at runtime require the same user/pwd used at design time?

    I've recently integrated Crystal 13 into a web service to provide HTML reports served up within our web application.  Sometimes reports would work and other times they would fail when attempting to connect to the database.  The ConnectionInfo associated with the tables referenced in the reports bore the account info used at design time (in the Crystal IDE), what ever connection was set as the Datasource Location, this would include the server name, database name, and other attributes of the connection.
    I found that any changes I make to table, sub-report connection info have no affect unless the UserID and Password match the UserID and Password saved with the report during design time.  While generally searching online, I came across several references to this being and issue or suggestion when database connection problems dynamically running reports.
    If this is by design?
    How would I support customers who want to use my reports, but also require that they manage the db access accounts?
    Thanks,
    Jeff

    Hi Brian, thanks for the response. 
    It does make sense that subreports would not necessarily be constrained to the same connection as the container report, and the designer would not persist a password for any stored connection.
    I'm on Windows 7 and up, Crystal 13 runtime, C# web service, sql 2008 r2 and up (native client).
    After loading the report source, I call ReportDocument.SetDatabaseLogon to set userId, password, serverName, and databaseName pulled from web.config.  I then pass the connection info and the ReportDocument to a recursive call that applies the connection info to each table in the report and each table in any subreport.
    Based on your description, it sounds like I may be missing, and require, the SetDatabaseLogon call on each subreport (ReportDocument).
    This seems to ring true and I think coincides with your description.  Would you agree?
    Thanks,
    Jeff

  • Allow users to change database connection at runtime

    Folks,
    CR 12.2.0.290
    BOE 12.1.0
    I develop CR on desktop and then save to the BOE repository.  Users need the ability to point the report to a different Oracle schema.  Tables and elements are the same, just the data is stored via streams so that each location has its own reporting schema.  So one (16 total) report needs to run against multiple schemas based on which origin the user is trying to report against; one at a time.  Other than having a set of reports for each site, how can I allow the users to select the schema to run against at runtime?
    Thanx
    Mike

    When you schedule a report with InfoView, there is a Database option where an ODBC connection, user and password can be specified.  Can this be used?  (I'm not familiar enough with Oracle to know for sure...  Also, this option doesn't show if the report uses Business Views.)
    HTH,
    Carl

  • Changing Database connection at runtime in CR2008

    Hi,
    I have a VS2008 application which is using CR2008 to generate pdf reports for the user. Problem is I am not able to change the database connection to any server other than the one that was used to create the report template.
    My environment has CR2008 SP2. I have tried reports with no paramter as well as the ones with parameters both dont seem to work.
    I have already tried a couple of things:
    a) report document refresh after loading it
    b) setting the database connection as
    this._crReport.DataSourceConnections[0].SetConnection(dbServerName, dbName, dbUserId, dbPwd);
    c) setting the database connection as
    tbls = this._crReport.Database.Tables;
                    bool test = false;
                    foreach (Table tbl in tbls)
                        tblLogonInfo = tbl.LogOnInfo;
                        tblLogonInfo.ConnectionInfo = connInfo;
                        tbl.ApplyLogOnInfo(tblLogonInfo);
                        test = tbl.TestConnectivity(); ** note this alwys return a true for the changed database server
    I have read a couple of thread but none has worked for me...Is this a known issue with CR2008?
    Thanks
    Kajal

    Hi Kajal,
    I am assuming that you are not changing the schema of the report at any point of time. I would suggest you to try pointing to the other database through designer to make sure that you can hit the database and the schema is correct. You can also create a udl file to check the database connectivity.
    Then just for testing purpose you can try the following code:
    ReportDocument reportDoc = new ReportDocument();
    reportDoc.Load("path of the report");
    reportDoc.SetDatbaseLocation("uid","pwd","Servername","tablename");
    reportDoc.SetParameterValues("Parameter-Name","values");
    CrystalReportViewer.ReportSoure=reportDoc;
    Does that help?
    Thanks.

  • Changing connection at runtime

    How can I change the db connection at
    runtime in a bc4j and jsp application:
    I start from a standard db connection
    read from the app property file and then
    I read from the database connection information and I have to reconnect.
    Thank's in advance
    Mauro

    If you want to change connections, you first have to logout. Besides the logon_screen builtin does not change the connection, but it only sets several application properties.
    In the Forms Help there is an example how to use the logon_screen. It basically comes to the next pl/sql code:
    declare
    MyUsername VARCHAR2(40);
    MyPassword VARCHAR2(40);
    MyConnect VARCHAR2(40);
    begin
    logon_screen;
    MyUsername := Get_Application_Property(USERNAME);
    MyPassword := Get_Application_Property(PASSWORD);
    MyConnect := Get_Application_Property(CONNECT_STRING);
    logout;
    if MyConnect is not null then
    logon(MyUsername,MyPassword| |'@'| |MyConnect);
    else
    logon(MyUsername,MyPassword);
    end if;
    end;
    null

  • How to change a connection with the database in Runtime?

    How to change a connection with the database in Runtime?
    My connection was made using ADF Business component (ApplicationModule).
    ADF Swing.
    JDeveloper Studio 11.1.1.4.0.

    When deploying ADF applications with database connection, you should be using JDBC data sources configured in the weblogic server.
    You could change the JDBC data sources to a different DB instance or location - by changing the JDBC data source and restarting the weblogic server.
    For more details, check
    http://techiecook.wordpress.com/2010/12/02/oracle-weblogic-adf-datasources/
    Thanks,
    Navaneeth

  • Dynamic database connections at Runtime dbAdapter

    Hi
    I need to connect to a database defined a runtime in a BPEL process using the dbadapter. All the configuration parameters for making the connection are provided at runtime (connectionURL, User, Password) and i need a way to configure them in the dbAdapter make the connection and execute some SQLStatements.
    Until now we were testing with some bpelx Properties changing dynamically the name of the jndi (jca.jndi) that works fine, but we cant define a datasource for every database. We also tried with another set of properties for setting the connection at runtime (jca.mcf.ConnectionString, jca.mcf.Password,jca.mcf.UserName) unsuccessfully.
    Do you know a way to define connections parameters at runtime in dbAdapter? Is that possible with SOA version 11.1.1.6 ?
    If this is not possible what alternative do you suggest for making dynamic connections to a database.?
    Regards
    Sergio

    You can try using the function query-database and formulate the 4th parameter which is JDBC connect string at runtime.
    oraext:query-database()
    Returns a node-set by executing the sql-query against the specified database. The second parameter rowset indicates if the rows should be enclosed in a element. The third parameter row indicates if each row should be enclosed in a element. The fourth parameter datasource is either a JDBC connect string (jdbc:oracle:thin:USER-NAME/PASSWORD@HOST:PORT:SID) or a JNDI name for the database. Only Oracle Thin Driver is supported if JDBC connect string is used. Usage: oraext:query-database(sqlquery as string, rowset as boolean, row as boolean, datasource as string). Example: oraext:query-database('select last_name from employee where id=1234',false(),false(),'jdbc:oracle:thin:scott/tiger@localhost:1521:ORCL'.
    This does not require a database adapter .

  • DSN connection not available in connection manager

    Hi -- I am having problems connecting to an ODBC data source with SSIS.
    I am trying to connect to a mysql database.  The connection is set up in "Administrative Tools" as a System DSN, and I can sucessfully connect using "Test" from there.
    But the connection is not shown as available in SSIS.
    In Connection Manager, I create a new ADO.NET connection, choose New, ODBC data provider, but my system DSN connection is not in the dropdown (no ODBC connections are), and if I try to specify it with a connection string
    Dsn=ConnectionName;
    I get:
    Test connection failed because of an error initalizing provider.  Error [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified.
    I have tried recreating it, creating a new data source with a new name, but none of the Dsn's come are seen by SSIS.
    To make it more frustrating, it was working just days ago and I don't know what changed...
    Any help appreciated,
    Mike

    The BIDS development environment is 32 bit. So it looks for the 32 bit providers at design time. However, when the package is run in BIDS, it will use the 64-bit providers, as long as the Use64BitRuntime property of the project is set to TRUE.
    Outside of BIDS, which set of providers is used depends on which version of DTEXEC you run. There is a 32-bit version and 64-bit version - each will load the matching provider. Something else to be aware of - not all providers have 32- and 64-bit versions. The Jet providers (used for Excel and Access) only have 32-bit versions, for example.

  • Set password for database connection at runtime

    Hi there,
    is it possible to set the password and/or the user for the database connection at runtime.
    The use case is to read the values from a file and decrypt them, and the to establish the conenction. So that i don't habe to redeploy everything if there is a change.
    Thanks in advance.

    How exactly do i set these values for the datasource?
    Edited by: Alex on 15.02.2012 09:50
    €: JDeveloper 11.1.1.5.0
    The use case is, that there is a file with an encrypted password. This should be decrypted and then be used for the connection. So when this encrypted passowrd changes, i don't want to edit and deploay the app once again. Instead the new encrypted password should be decrypted via code an then be used.
    Edited by: Alex on 15.02.2012 10:00

  • Automatically create ODBC DSN connection with special port and password. Add-OdbcDsn cmdlet

    Hi,
    I first posted a question in the SQL forum but I'm posting it here instead because its a Powershell question.
    In a non-persitent VDI enviroment we are trying to automatically create a ODBC DSN connection to a SQL server.
    We are using Windows 8.1 so we also have Powershell 4 together with the add-odbcdsn cmdlet. 
    But when trying to add set -SetPropertyValue for network port different than default and a password we get an error.
    here is the command:
    Add-OdbcDsn -Name test -DriverName "SQL Server" -DsnType User -SetPropertyValue @("PWD=test", "SERVER=10.0.0.1")
    and here is the error message:
    Add-OdbcDsn : Attempt to set the {UID or PWD} key of a DSN. These keys should not be stored in the registry for securit
    y reason. Provide the credential information at runtime via SQLDriverConnect, SQLConnect or SQLBrowseConnect.
    At line:1 char:1
    + Add-OdbcDsn -Name test -DriverName "SQL Server" -DsnType User -SetPropertyValue @ ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (MSFT_OdbcDsnTask:Root/Microsoft/...SFT_OdbcDsnTask) [Add-OdbcDsn], Cim
    Exception
    + FullyQualifiedErrorId : MI RESULT 4,Add-OdbcDsn
    NB!:  this command does not contain a port number, but when adding it without a password(PWD string) we just the default port.

    Hi Primeid,
    Agree with Jrv, we cannot store  UID and PWD in an ODBC datasource, For example, you can create a DSN using the user interface but if you look at the DSN stored in the registry the UID and PWD are not stored.
    ODBC it is always required when you connect using a DSN that the caller supply UID and PWD if they want to use standard login during connection time. 
    These similar discussion are for your reference:
    Creating ODBC DSN for SQL Native
    Client fails for not-integrated authentication
    is user name and password required in ODBC admin / User DSN?
    In addition, to read data from a SQL Server database using an ODBC DSN with SQL Authentication via powershell, please refer to this script:
    Open SQL database with ODBC DSN and SQL AuthenticationIf
    there is anything else regarding this issue, please feel free to post back.
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Using predefined JDBC database connection in runtime for BC4J

    I've created an aplication using BC4J context, however I want to have several distinct users acessing this aplication, so I create the connection to the database using stantart JDBC 2.0, and now I want my application to use this connection instead of the one defined for BC4J.
    The database user owner of the objects must be locked.
    Is this possible?
    Many thanks.
    Nuno

    In Forms I used the following code to change the user at runtime. I created 3 char fields 'u','p' and 'c' for username, password and connect string respectively.
    declare
    uname varchar2(10);
    begin
    uname := get_application_property(username);
    -- To display your current username
    message(uname);
    pause;
    logout;
    logon(:u,:p| |'@'| |:c);
    end;
    Have a nice day,
    Abhijith Unnikannan,
    Oracle Support Services

  • Issue with changing database location at runtime

    I am having a similar issue to:
    Re: Issue with changing database location at runtime
    where I am using Crystal Reports 2008 SP 3 fix pack 3.3 and a OLE DB connection to a SQL 2008 R2 server. Running on a computer on the network where the report can see the original development server is fast, other computers where that server is not available are hanging 20 seconds before coming up.
    I am using the same code from the Crystal Sample app to change the connection on each table. I found that the slowness comes the first time the ReportDocument object is accessed to get the collection of database tables, before the connection info is set.
    Fix pack 3.4 was mentioned in that post.  Does fix pack 3.4 fix that issue? I don't see fix pack 3.4 on the downloads page (https://websmp130.sap-ag.de/sap%28bD1lbiZjPTAwMQ==%29/bc/bsp/spn/bobj_download/main.htm)

    I just found on the reports that were having the issue there was a SQL Expression.  Per this thread:
    Re: Report load is slow after changing database servers
    There was an issue with that and the fix is not out til the end of Feb so I found a way not to use the SQL Expression and the speed is much better.
    However, your information provided led me to this post:
    Cannot Change Table Location, but Only for One Report
    And I am also experiencing an issue where the table location is not changing on one subreport and I will look into that as a possible solution.
    Thanks so much for your help.

  • Unable to overwrite the ODBC connection in runtime

    Hi,
    I have a VS2008 application which is using CR2008. Problem is I am not able to change the ODBC connection in runtime to any server other than the one that was used to create the report
    We are using infoobject model to retrive the report form CMC.
    Couple of thing I tried.
    First One:
    ConnectionInfo objConnectionInfo = new ConnectionInfo();
                   objConnectionInfo.ServerName = "Server Name";
                   objConnectionInfo.DatabaseName = "Database Name";
                   objConnectionInfo.UserID = "UserID";
                   objConnectionInfo.Password = "Pwd
                   objConnectionInfo.IntegratedSecurity = true;
                   objConnectionInfo.AllowCustomConnection = true;
                   TableLogOnInfos objTableLogOnInfos = new TableLogOnInfos();
                   TableLogOnInfo objTableLogOnInfo = new TableLogOnInfo();
                   objTableLogOnInfo.ConnectionInfo = objConnectionInfo;
                   objTableLogOnInfos.Add(objTableLogOnInfo);
                    Crv.LogOnInfo = objTableLogOnInfos;
    Second One:
                        ReportLogons logns = ceReport.ReportLogons;
                        ReportLogon logn = logns[1];
                        logn.UseOriginalDataSource = false;
                        logn.CustomServerName = "ServerName";
                        logn.CustomDatabaseName = "Database Name";
                        logn.CustomUserName = "Userid";
                        logn.CustomPassword = "Pwd";
    Above methods I tries but I am unable to change my connection string,Some one please advise on this.

    Make sure you have SP 2:
    https://smpdl.sap-ag.de/~sapidp/012002523100009038092009E/cr2008win_sp2.exe
    Try one of our sample apps:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
    recommend vbnet_win_dbengine
    Do this with a report that has no subreports 1st.
    In your code samples, you are trying to use integrated security in one, not in the other. Is the report designed with Integrated security or not? Re. integrated security, see [this|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b021e47e-be1d-2b10-c6b2-efa9db3abd6b] article.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Different database connections at runtime

    How can I change different database connections at runtime on the same Application Module ?
    I use BC4J as business layer and uiXml as presentation layer.

    Does anyone know how to do this?
    I need the same, but i couldn't find any documentation about it.
    Looking forward to hearing good news.....

Maybe you are looking for