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.

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

  • 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

  • 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

  • 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.

  • 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.....

  • Change database connection for FRS Report

    currently we are using ASO BSO model and all FRS reports are retrieve against BSO Database.Now we are converting to ASO only model. can i use the same report against ASO database .
    There is a option of chang database connection under tool in workspace . will this work or do i have to make all reports again
    can you please help me with this
    thank you

    IN some cases even if the report has additional dimensions it will work. After you change the connection. Open the report in designer. The new dimensions will automatically update. Save the report and you should be good to go. If dimensionality is exactly the same you don't even have to do that, just change the connection, point ot the new database and run the report.

  • Dynamically Changing Database Connections Information

    Post Author: Robert Flaherty
    CA Forum: .NET
    USing Crystal 2008 and Visual Studio 2008 in C#:
    Below is the code that I am using to set the database connection at runtime.  This does not work when the Server/Database is different from the Server/Database that was used when the report was generated.  What happens is a dialog box appears with the original connection information,  The textbox for the server and the database are disabled.
    public partial class ViewOrder : Form
    string sqlStmt;
    public ViewOrder(string SqlStmt)
    InitializeComponent();
    GlobalVaribles gv = GlobalVaribles.Instance;
    sqlStmt=SqlStmt;
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.ServerName = gv.Server;
    connectionInfo.DatabaseName = gv.Database;
    connectionInfo.UserID = gv.UserID;
    connectionInfo.Password = gv.Password;
    crystalReportViewer1.SelectionFormula = sqlStmt;
    string reportPath = Util.BuildFileName(gv.ReportPath, "Order001.Rpt");
    crystalReportViewer1.ReportSource = reportPath;
    crystalReportViewer1.ShowGroupTreeButton = true;
    crystalReportViewer1.EnableDrillDown = false;
    SetDBLogonForReport(connectionInfo);
    private void SetDBLogonForReport(ConnectionInfo connectionInfo)
    TableLogOnInfos tableLogOnInfos = crystalReportViewer1.LogOnInfo;
    foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
    tableLogOnInfo.ConnectionInfo = connectionInfo;

    Post Author: Robert Flaherty
    CA Forum: .NET
    USing Crystal 2008 and Visual Studio 2008 in C#:
    Below is the code that I am using to set the database connection at runtime.  This does not work when the Server/Database is different from the Server/Database that was used when the report was generated.  What happens is a dialog box appears with the original connection information,  The textbox for the server and the database are disabled.
    public partial class ViewOrder : Form
    string sqlStmt;
    public ViewOrder(string SqlStmt)
    InitializeComponent();
    GlobalVaribles gv = GlobalVaribles.Instance;
    sqlStmt=SqlStmt;
    ConnectionInfo connectionInfo = new ConnectionInfo();
    connectionInfo.ServerName = gv.Server;
    connectionInfo.DatabaseName = gv.Database;
    connectionInfo.UserID = gv.UserID;
    connectionInfo.Password = gv.Password;
    crystalReportViewer1.SelectionFormula = sqlStmt;
    string reportPath = Util.BuildFileName(gv.ReportPath, "Order001.Rpt");
    crystalReportViewer1.ReportSource = reportPath;
    crystalReportViewer1.ShowGroupTreeButton = true;
    crystalReportViewer1.EnableDrillDown = false;
    SetDBLogonForReport(connectionInfo);
    private void SetDBLogonForReport(ConnectionInfo connectionInfo)
    TableLogOnInfos tableLogOnInfos = crystalReportViewer1.LogOnInfo;
    foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
    tableLogOnInfo.ConnectionInfo = connectionInfo;

  • 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 .

  • 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

  • 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

  • ADF Database Connection at Runtime

    Hi,
    I have developed a ADF based Web Application, deploy the code into different appServers [connecting to Different Databases] but unable to connect to the Required Database at Runtime.
    I have the following in my dataSources.xml & web.xml which looks like this.
    dataSources.xml
    <managed-data-source connection-pool-name="AIAQueryConnectionPool" jndi-name="jdbc/AIAQueryDataSource" name="AIAQueryDataSource"/>
    <connection-pool name="AIAQueryConnectionPool">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="aia" password="aia" url="jdbc:oracle:thin:@//occf09.techmahindra.com:1521/ftsit"/>
    </connection-pool>
    web.xml
    <resource-ref>
    <description>AIA data source connection for FastTelco</description>
    <res-ref-name>jdbc/AIAQueryDataSource</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>
    deployed the web Application "TestTransaction" and created ConnectionPool & DataSources for this Application "TestTransaction"
    when i run the Application i am unable to connect to the required Database/(s)
    Is that correct what i was doing ?
    BUT If i have the entry of that specific Database in ./model/common/bc4j.xcfg file i am able to Connect to the Database
    and if i remove the entry from ./model/common/bc4j.xcfg file, I am unable to Connect to the Database.
    Why is it so ??
    Can anybody give me the process / code to Connect to the Database in web based ADF Application at Runtime.
    or
    Pick up the Database Configuration Values from a Properties file and establish a Database Connection ??
    thanks in Advance...
    regards,
    anvv sharma

    Hi,
    I got it working today and not yes'day to the modifications suggested by arun...the only difference being i have stop / start the Application then it started with the working what i have done yes'day
    also thanks for shay....... it was useful link
    regards,
    anvv sharma

  • Change database connection in SQL-Worksheet to a not connected db

    Hi,
    change the active database connection of a SQL-Worksheet to a currently not connected database does not work. The login window pops up, but the password entry field cannot be activated to enter the password. On dragging the login window the screen does not get refreshed correctly. The only way to get back to work is to kill the sqldeveloper.exe process.
    The affected version is 3.2.09.23 on the 32 bit MS Windows plattform.
    sincerely yours
    Matthias

    Hi Matthias,
    Thanks for reporting this. It is caused by a deadlock between Java threads. I will log a bug for it.
    Regards,
    Gary
    SQL Developer Team
    Edited by: Gary Graham on Aug 23, 2012 4:26 PM
    Bug 14532491 - FORUM - DEADLOCK OCCURS WHEN SWITCHING WORKSHEET CONNECTIONS
    Edited by: Gary Graham on Aug 23, 2012 4:27 PM
    Bug 14534488 - DEADLOCK OCCURS WHEN OPENING WORKSHEET CONNECTION FOR A SQL FILE

  • Changing Database connection on webservice deployment

    Hi All,
    I am having a problem changing the Database connection when deploying a PL/SQL generated webservice.
    What I have done is to use the WebService wizard to create a webservice based on a database Pl/SQL procedure. During this you have to specify the database connection (which initially is our dev server).
    When I come to deploy the service to our production platform I want to change the database descriptor name to point to an existing App Server data source.
    This is the problem - the Database Connection information is protected in the properties of the webservice - which means I cannot deploy to our production platform with the connection names I need.
    I can change the names of the Connections defined in the Connections tab - but then I cannot access the webservice in JDev.
    Everytime I deploy to our production platform I keep getting the development data sources created.
    Basically I need to develop a PL/SQL webservice using a Development connection (with a unique connection name), and then deploy to a production application server (10g AS) with a different connection name that points at our production env.
    I could create generic names, but that then would make my development system very confusing with the potential of messing up the production platform.
    Anyone got any ideas????
    Thanks and Regards
    Neil

    When you deploy the web service to the app server, if the connection to the other database is available from JDev at deployment time, the data sources xml file should be set up correctly with the db connection info. Otherwise this will have to be modified by hand on the app server to contain the connection details for the other DB.
    There are 3 files that will also have to be hand modified to reflect the different db connection details. 2 deployment descriptors, web.xml and oracle-webservices.xml which have references to the connection's jndi name, and also one of the JPublisher generated classes (the one whose name ends in 'Base') also has references to the jndi name (to look up the connection from the data source file) which will have to be modified, recompiled and redeployed.
    The simplest way to change the connection would actually be to leave everything alone and just modify the data sources xml file on the server such that the same jndi lookup points to a new connection, but it looks like the customer wants to change the name as well.
    An alternative to all this hand editing is to regenerate the service against the producion DB connection, test & then deploy the service.
    dai
    JDev devt. team

  • Changing database connection details aftre WAR file deployment

    Hello,
    I create a WAR deployment file and distribute this to a Tomcat web container. The package unpacks as expected however the production database details are different from my devlopment environment. The database connection name is the same. I thought if I simply change the connection details in the connections.xml file and restart the web app this would do the trick. It does not. What am I missing?

    Maybe your application is using a connection as defined in data-sources.xml. Check there.

Maybe you are looking for

  • Can you manually disable the headphone jack on Macbook Pro?

    I recently got the tip of a speaker plug stuck into the headphone jack of my 13' Macbook Pro. I tried various things and finally decided that I'd take it in to get repaired. I took it into a store called Jump+ which is an official apple retailer in m

  • Vertical Text in PowerPoint saved as a PDF

    I just created a document in PowerPoint with vertical text.  When I saved the document, some of the vertical text and rotated back to horizontal changing the format of my document. Is there a way to save a PowerPoint document as PDF without changing

  • Printing in 2-color + upgrade problems

    My company just recently upgraded systems, going from CS to CS 6, and a 10 year old mac to a new PC. Quite a leep. The prolem is, there was a program called Creo's "PowerTone" and it was a plugin for Photoshop which took full color images and made a

  • Zen Micro: changing volume through programmi

    Does anyone know a way to change the volume of a Zen Micro other than using the scroll bar? Can it be done through Creative Media Explorer or some other computer program rather than through the Zen itself? As I said in a previous post, I'm having scr

  • HT204406 Album purchase not downloaded

    I purchased an album last week from itunes through my iphone 4. I cannot view the album on any playlist, album, artist etc but if I go back into itunes store the album is marked as purchased. Can someone tell me how I can download this purchase? Than