Crystal Reports Update data source,Show query statement has not changed - crystal-reports

I am using Crystal Reports 11.
I am modifying some crystal reports changing the database name as we are upgrading.
I have set the new datasource location to the new database.
When I review the Show SQL Query the Select statement has not changed.
For example old database was called HR65
The new is called HR72
But the select statement still says
Select * from HR65.EDF
But should say
Select * from HR72.EDF
Am I missing something?

Related

Stored Procedure datasources in Business Objects server

How is data retrieved via a stored procedure datasource when a report is viewed within Business Objects server? It seems retrieve data when any kind of "SELECT" statement gets executed. But other DML statements in a stored procedure, like inserting to a table, get ignored.
When an application calls a stored procedure, it runs in its entirety. But with Crystal Reports in BO Server, it seems that it like it scrapes the data retrieval code out and runs while ignoring other DML statements.
CREATE PROCEDURE dbo.ExampleTestBlahBlah
AS
BEGIN
INSERT TestTable (RandomColumn)
SELECT 'ABC';
SELECT 'ABC' [ReturnValue]
END
When this query is run in Crystal Reports while ReturnValue is added to the report area, the issue can be seen clearly. The procedure runs correctly in the Preview, but if deployed to a BO server the insert statement gets ignored. Why?
Turns out this behavior was caused by "Save Data with Report" option being checked on my test report. That's all it was. Turn that off and the sprocs work as expected

Jasper server community edition installation issues for Postgres

I installed the war file distribution using the install scripts in buildomatic. The installation is successful but when I boot tomcat server it shows some database exceptions
https://gist.github.com/shruti-palshikar/5ae801674dbd2a537518
I checked if the latest postgres driver exists in the tomcat/lib.
I also checked if the database 'jasperserver' has all the necessary tables
However these tables are empty , does anyone know which script loads data into tables?
Any help is appreciated
The actual error from PostgreSQL is:
relation "jiresourcefolder" does not exist
The query seems to be:
select this_.id as id5_0_, this_.version as version5_0_, this_.uri as uri5_0_, this_.hidden as hidden5_0_, this_.name as name5_0_, this_.label as label5_0_, this_.description as descript7_5_0_, this_.parent_folder as parent8_5_0_, this_.creation_date as creation9_5_0_, this_.update_date as update10_5_0_
from JIResourceFolder this_ where (this_.uri=?)
Typically ugly framework generated SQL.
There are only two possibilities:
There is no table "jiresourcefolder", "JIResourceFolder" or any other variation in capitals.
The table was created with quotes to preserve its case and the query is not using quotes.
The following will work:
CREATE TABLE JiReSoRrCeFoLdEr ...
SELECT * FROM jiresourcefolder...
SELECT * FROM JIRESOURCEFOLDER...
SELECT * FROM JIresourceFolder...
Any unquoted table (or column) names are internally mapped to lower-case so will all match.
If however you quote a created table:
CREATE TABLE "JIResourceFolder"
SELECT * FROM "JIResourceFolder" -- works
SELECT * FROM JIResourceFolder -- doesn't
Check your database schema and see if you have this table and whether it is all lower-case. Then, check the documentation for your java framework(s) and see if there is some flag that controls quoting of database tables. It seems likely that the flag is set in one place and not in another.
I just had the same issue in Jasper Studio.
My problem was that a wrong Data Adapter (a DB that did not have such a table) was assigned to the Report.
I had switch to the Design window and select the right Data Adapter in the upper right of that window right beside "Settings".

Query referencing aliased column in order by in SQLServer 2012

I have a SQL Select query that's embedded in a piece of C# code which I don't want to change. My problem is that the query executes fine on SQLServer 2008 but not 2012.
The offending line of code is:
Select code as SiteCode from TimeSheetContracts S order by S.SiteCode
Executed in a database on SQL2008 it works fine. The same database upgraded to SQLServer 2012 errors with the following...
Msg 207, Level 16, State 1, Line 2
Invalid column name 'SiteCode'.
If I edit the query to be
Select code as SiteCode from TimeSheetContracts S order by SiteCode
it works fine. Can anyone explain this?
There is no column in TimeSheetContracts called SiteCode, so a reference to s.SiteCode is not valid. Aliasing in ORDER BY is a little more strict since SQL Server 2000, when the syntax was a little more forgiving. The only way s.SiteCode would have worked on your SQL Server 2008 instance was if your database was in COMPATIBILITY_LEVEL = 80 (go ahead and try it on a different database that is 90 or greater). Once you move to SQL Server 2012, 80 is no longer an option. On a 2005, 2008 or 2008 R2 instance, try this:
CREATE DATABASE floob;
GO
USE floob;
GO
CREATE TABLE dbo.SalesOrderHeader(SalesOrderID INT);
GO
SELECT SalesOrderID AS ID FROM dbo.SalesOrderHeader AS h ORDER BY h.ID; -- fails
GO
ALTER DATABASE floob SET COMPATIBILITY_LEVEL = 80;
GO
SELECT SalesOrderID AS ID FROM dbo.SalesOrderHeader AS h ORDER BY h.ID; -- works
GO
USE master;
GO
DROP DATABASE floob;
If you want to use the column alias, you'll need to (and should always have been) just use the alias. If you want to use the table alias prefix, you'll need to use s.code.

Mirth Question: what does a Run On-Update Statement do?

I am trying to document a Mirth channel with Connector Type: Database Reader. It has a SQL statement that it uses to read input to the Mirth channel. But then it has another box called On-Update SQL with more SQL code. Does that SQL run after the SQL input statement? What does the On-Update Statement do?
On-Update SQL should be used to update a record once it has been read so that it is not read again. For example, if your SQL statement is:
SELECT id, firstName, lastName FROM person WHERE status = 0;
Then should have the On-Update SQL as:
UPDATE person SET status = 1 WHERE id = ${id};
Notice that the ${id} variable is used. This would be replaced with the ID value selected in the original SQL statement. This allows you to update the same record that was selected.
You can use any of the columns in your UPDATE that you retrieve in your SELECT (ex. ${firstName}).
Source

SQL: OPENQUERY Not returning all rows

i have the following which queries a linked server i have to talk to.
SELECT
*
FROM
OPENQUERY(DWH_LINK, 'SELECT * FROM TABLEA ')
It will typically return most of the data but some rows are missing?
The linkeds server is coming from an oracle client
Is this a problem anyone has encountered w/ openquery?
I had exactly the same problem.
The root cause is that you've set up your linked server using ODBC instead of OLE DB.
Here's how I fixed it:
Delete the linked server from SQL Server
Right click on the "Linked Servers" folder and select "New Linked Server..."
Linked Server: enter anything..this will be the name of your new linked server
Provider: Select "Oracle Provider for OLE DB"
Product Name: enter "Oracle" (without the double quotes)
Data Source: enter the alias from your TNSNAMES.ORA file. In my case, it was "ABC.WORLD" (without the double quotes)
Provider String: leave it blank
Location: leave it blank
Catalog: leave it blank
Now go to the "Security" tab, and click the last radio button that says "Be made using this security context:" and enter the username & password for your connection
That should be it!
This seems to be related to the underlying provider capabilities and others have also run into this and similar size/row limitations. One possible work-around would be to implement an iterative/looping query with some filtering built in to pull back a certain amount of rows. With oracle, I think this might be using the rownum (not very familiar with oracle).
So something like
--Not tested sql, just winging it syntax-wise
SELECT * FROM OPENQUERY(DWH_LINK, 'SELECT * FROM TABLEA where rownum between 0 AND 500')
SELECT * FROM OPENQUERY(DWH_LINK, 'SELECT * FROM TABLEA where rownum between 500 AND 1000')
SELECT * FROM OPENQUERY(DWH_LINK, 'SELECT * FROM TABLEA where rownum ...')
BOL:
link
This is subject to the capabilities of the OLE DB provider. Although the query may return multiple result sets, OPENQUERY returns only the first one.
I had this same problem using the Oracle 10 instant client and ODBC. I used this client as I am connecting to an Oracle 10gR2 database. I opened a ticket with Microsoft support and they suggested using the Oracle 11 instant client. Surprise! Uninstalling the 10g instant client, installing the 11g instant client and rebooting resolved the issue.
Ken
I had exact same problem with an SQL 2014 getting data from SQL 2000 through OPENQUERY. Because ODBC compatibility problem, I had to keep generic OLE DB for ODBC driver. Moreover, the problem was only with SQL non-admin account.
So finally, the solution I found was to add SET ROWCOUNT 0:
SELECT * FROM OPENQUERY(DWH_LINK, 'SET ROWCOUNT 0 SELECT * FROM TABLEA ')
It seems the rowcount might been change somewhere through the SQL procedure (or for this user session), so setting it to 0 force it to return "all rows".