Dates are coming back invalid using openNTF jdbc driver for Domino - database

I'm creating reports utilizing openNTF's domSQL/JDBC driver for Domino (powered by SQLite). It enables us to use Domino's databases as SQL database views. One of the features of this driver is that it converts all the Domino db date fields to text fields. Somehow, in doing this, it sometimes converts the date 'xxxx-02-28 xx:xx:xx' to 'xxxx-02-29 xx:xx:xx'. Not only is the date incorrect, but 2/29 is a leapyear date being assigned to non-leapyears. This is causing an additional error when we attempt to store this invalid date into a date field.
More info on DomSQL can be found here

We installed a hotfix for Domino that solved this issue. The hotfix was:
HF 391 for 9.0.1FP2

Related

Oracle Date format exception in SQL Server Reporting Services

Earlier my client was using SSRS 2008R2 with Oracle as transaction database. Recently they have upgraded to SSRS 2017 and now many reports are throwing following error:
ERROR: Throwing
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException:
[AbnormalTermination:ReportProcessing],
Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException:
An error has occurred during report processing. --->
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException:
Query execution failed for dataset 'Ds_Main'. --->
Oracle.ManagedDataAccess.Client.OracleException: ORA-01830: date
format picture ends before converting entire input string
After closely looking into report query, I have noticed that this error is for all those reports where oracle function TO_DATE(<Date Value>) has been used without date format. For example:
To_date(:Date_Parameter) -> this syntax throws above mentioned error
To_Date(:Date_Parameter,’MM/DD/YYYY’) -> this syntax works perfectly
I am willing to know:
what has changed in SSRS 2017 vs SSRS 2008 R2 that is causing this issue because same reports are working as expected in SSRS 2008 R2 and it is throwing above error in SSRS 2017.
Is there is any suggestions to fix this issue without updating bunch of reports?
what has changed in SSRS2017 vs SSRS2008R2
SSRS 2008 used the old System.Data.OracleClient. In SSRS 2016 and later you have to install the Oracle ODP.NET provider, built and supported by Oracle. So probably just a difference in how the NLS_DATE_FORMAT session parameter is set by the two drivers.
You can see your setting if you add a dataset to your report with this query:
select parameter, value
from nls_session_parameters
where parameter like 'NLS%'
order by parameter
Unfortunately there doesn't appear to be a way to globally change the client date format in Oracle.ManagedDataAccess, so you'll have to make all the changes in the report dataset queries.
Alternatively you can try to ensure that you are passing Date parameters and not string parameters. If you pass a date to Oracle's to_date() function, you don't need to specify a format.
The docs for SSRS 2014
"This built-in data source type is based on the .NET Framework Managed Provider for Oracle and requires an Oracle client software component."
And for SSRS 2016 "This built-in data source type uses the Oracle Data Provider directly and requires an Oracle client software component."
Trying to figure out the issue
I don't think the issue is related to the Visual Studio upgrade. It is related to the date format passed as a parameter to TO_DATE() function.
Based on the official documentation of the Oracle / PLSQL: ORA-01830 Error Message:
Cause: You tried to enter a date value, but the date entered did not match the date format.
In Oracle, the default date format is generally DD-MON-YYYY. If you try to enter a date value that does not comply with this format.
You seem to have passed the date parameters in the dd-MMM-yyyy format and now they are passed as MM/dd/yyyy.
First of all, check that the regional setting or the applications Culture information didn't change.
Possible workarounds
You can fix the issue using several approaches:
(1) Handling the parameters date format
If you do not want to edit all code, then it is easier to force the parameter data string format, make sure that all parameters passed to TO_DATE() function are in following format (or try to change the default date format from the OS regional settings):
dd-MMM-yyyy example: 01-AUG-2019
(2) Adding the date format to TO_DATE function
If you are sure that the date parameters format is fixed and will not change then you can edit your code as you mentioned in the question:
To_Date(:Date_Parameter,’MM/DD/YYYY’)
(3) Pass the date and format as parameters
This also requires changing the code, but you will pass the date and format as parameters.
To_Date(:Date_Parameter,:DateFormat_Parameter)
SQLFiddle demo for parsing dates
You may find other methods at the following link:
ORA-01830: date format picture ends before converting entire input string / Select sum where date query
Update 1 - Making common change in multiple reports
While searching I found the following link providing a method to loop over reports and make changes. You have to only replace To_Date(:Date_Parameter) with To_Date(:Date_Parameter,’MM/DD/YYYY’):
SSRS - Make common change in multiple reports in one click
Update 2 - Other possible workarounds
Forcing Culture info by editing ReportViewer.aspx
You can edit the ReportViewer.aspx file is located in the SQL Server reporting services directory, and force the culture info used within reports. Check out the following question it will give you more details:
I want Datetime Parameter in DDMMYYYY Format in ssrs report
Changing the browser language settings
Check the following link (read Mike Honey and Nick St Mags answers):
SSRS Datetime Parameter value should display in DD/MM/YYYY format
Update 3 - Issue cause
In addition of what #DavidBrownie posted i found the SQL Server 2008 R2 documentation:
Oracle Connection Type (SSRS 2008 R2)
Where they mentioned:
This built-in data source type is based on the .NET Framework Managed Provider for Oracle and requires an Oracle client software component.
Also if you take a look at SQL Server 2017 documentation:
Oracle Connection Type (SSRS 2017)
This built-in data source type uses the Oracle Data Provider directly and requires an Oracle client software component.
In addition, referring to Microsoft OLE DB Provider for Oracle documentation (which is the old used provider). They mentioned that:
This feature will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, use Oracle's OLE DB provider.
Which is the reason for changing the provider used to connect to Oracle in Reporting Services.

azure web service app date format issue

Im developing an app thats hosted up in Azure. On my development machine when i edit and save dates (UK format - saving to local sql server 2012) theres no problem. When I deploy the same code base to Azure (same database structure & sql server version - db hosted in VM in Azure) Im getting an error
'the value 23/01/2014' is not valid for contract date
has anyone else experienced anything like this and could give me some pointers ?
Ive set the os on the VM machine to be uk region and the underlying dates in the tables both locally and remotely are exactly the same format. Is there anything obvious I could be missing ?
the value 23/01/2014' is not valid for contract date
Please run dbcc useroptions to check the language and dateformat. And by default, the date format for SQL server is in U.S. date format MM/DD/YY, unless a localized version of SQL Server has been installed.
You could try to use the international format YYYYMMDD for sending the datetime data to SQL Server or pass the date in date format being used on the SQL Server.

Fun with US and UK dates on a new server

I have just had the task of moving an old ASP website / SQL DB to a new dedicated OVH server (French - all defaults set to US-Eng).
The DB has moved from SQL 2005 to SQL 2012 (web edition 64 bit).
I am having the old issue of date formats showing up as US format on the website e.g 8/3/2016 instead of 03/08/2016. This is even though in the database they are stored as ISO Date 2016-08-03 etc.
I enter the dates on the ASP Classic, website as UK format
e.g. 03/08/2016 and convert them to ISO format 2016-08-03 in the SQL that is passed to the Stored Procedure that has SET DATEFORMAT YMD at the top of it.
If I check the tables in the DB they are all stored correctly as ISO dates.
I have made sure all the SQL Logins to the DB have "British English" selected as their "Default Language".
If I view the database properties under options the Default Language is British English.
If I view the server properties under General->Language it's English (United States) but under Advanced->Default Language it's British English.
The dates are getting stored as ISO correctly as if I do a DATEDIFF(DAY,Stamp,GETDATE())=0 I can see all the records even though they are showing up on the website as US format 8/3/2016 (Why there are no zeros in front of US dates I don't know).
The ASP code hasn't changed or the DB code it was just ported into this new dedicated server and now I am getting these issues. I am sure I solved something like this ages ago just by changing the default login language but that doesn't seem to work on this box.
I am getting lots of Primary Key/Index errors due to duplicate insertions due to the dates (mixing up US/UK) from a .NET app I have that uses the Betfair API to get racing data e.g
EXEC dbo.usp_net_insert_betfair_market_selection #MarketID = 125932808, #SelectionID = 10593225, #Racedatetime = '2016-08-03 15:10:00', #MarketType = 'WIN', #HorseName = 'She Done Good';
Violation of PRIMARY KEY constraint 'PK_BETFAIR_MARKET_SELECTIONS'. Cannot insert duplicate key in object 'dbo.BETFAIR_MARKET_SELECTIONS'. The duplicate key value is (719859, WIN, Mar 8 2016 3:10PM).
However if I copy that EXEC statement and run it direct in a query analyser window it runs WITHOUT ANY ERROR.
I have been searching the web and I have seen someone suggest putting this code at the top of all ASP pages that show dates to force it show in UK format > https://www.webwiz.co.uk/kb/asp-tutorials/date-time-settings.htm
'* Set the server locale to UK
Session.LCID = 2057
This has worked on SOME pages but I have never had to do this before.
On pages with long lists of records and dates in one column I have wrapped the date in CONVERT(varchar, GETDATE(),103) in the SQL and it returns correctly on the page.
I am confused though as I have never had to do this on the old set up and it seems like there must be some setting that needs to change to fix all this on the new server (SQL and Web IIS 8) on same box.
I have tried going into the .NET Globalization for the site and changing Culture and UI Culture to English (en). However that didn't fix everything.
The "Language" preferences on the machine are set to English (UK) although I wouldn't have though that would have made a difference.
If I run this code in a query analyser either RD into the box, or through my local SQL console connected to the machine over the network
select name ,alias, dateformat
from syslanguages
where langid =
(select value from master..sysconfigures
where comment = 'default language')
In a query window (Remote Desktop into server) I get back
Name Alias dateformat
British British English dmy
Question
So it seems like something to do with the connection between the ASP website or .NET app and the server/database. Something I have missed or need to change as this all worked fine on the old WebServer -> Database Server setup we had.
Is there something I have overlooked to ensure dates are shown as UK on the website without editing every ASP page and SQL that contains dates as I never had to do that for the old setup.

Date format on Reporting Services causing Parameter Type Mismatch

We are using Microsoft SQL Server Reporting Services, whether is it SQL Server 2005, 2008, 2012 or 2014, even on Microsoft Dynamics CRM Online SSRS we have same problem.
We are using English display language, however we use our local region format (Croatian) which has date format dd.mm.yyyy. And SSRS rdl file is configured in this way.
Problem is that report (.rdl) parametar for date is by default in incorrect format. Original date picker writes date in format: dd.mm.yyyy which is correct, however then we have error - rsReportParameterTypeMismatch
The temporary solution is to manually override text box by user for date parameter and remove latest character (period) so date than looks like dd.mm.yyyy, and then report works.
Is there any solution how to fix this from report.rdl side, so that users can use default date picker (with or without last character - period after year) without rsReportParameterTypeMismatch error ?
Since the problem persists on CRM Online SSRS (cloud) also, I am not able to modify any server settings there.
Have you tried changing the Report language property on the Report Element? This will change the formats of dates and integers but will not translate strings.

Conversion of Datetime from server to another server

I have SQL Server 2000 in both server. We have imported existing data to new server. And also we use vb application. Now we changing our data to new server. When we run application to retrieve date wise details it shows error
'The Conversion of Datetime to varchar is out of range'
And we pass our datetime from application is dd/mm/yy but values get inserted as mm/dd/yyyy. Is there any solution. please. thanks in advance
They are likely to be English and British English as mm/dd/yyyy and dd/mm/yyyy respectively.
Open the login properties under security in ssms object explorer on the new server and set it to British English.
You should check the default language of the login running the queries.
Probably is configured in English in the new server and not English (maybe Spanish?) in the old server.

Resources