我正在创建一个使用 Oracle 数据库的 C# MVC 项目。尝试连接数据库时,出现以下错误:
ORA-00604: error occurred at recursive SQL level 1
ORA-01882: timezone region not found.

当我尝试通过 SQL 开发人员连接时,它工作正常。有什么办法可以解决这个问题吗?
注意:我正在使用 IIS express 来测试
我在 Pivotal Cloud Foundry 上使用 ODP.NET for .NET Core 时遇到了同样的问题。核心问题是缺少时区信息。
通过为我的实例设置 "TZ" 环境变量添加了一个时区。这为我解决了这个问题。
实际上,这个错误是因为您使用的应用程序 Oracle 驱动程序和数据库的 Oracle 版本存在问题。
注意:请检查它们并为您的应用程序使用更新的 Oracle 版本。
ORA-01882: 未找到时区
在带有控制器的 .Net Core 3.1 API 中遇到了同样的问题。
在调试时出现错误,并解决了它在 \\\\\\\\Properties\\\\\\\\launchSettings.json 上添加 TZ:
2 3 4 5 6 | ... "environmentVariables": { "TZ":"WET" } } |
此代码不提供答案,但它可能有助于找到您的问题。
代码太大,无法评论。
请执行这个程序。输出是什么?哪里出错了?
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | { Console.WriteLine("OracleGlobalization.TimeZone = {0}", Oracle.DataAccess.Client.OracleGlobalization.GetClientInfo().TimeZone); Console.WriteLine(String.Empty); Console.WriteLine("TimeZone.CurrentTimeZone.StandardName = {0}", TimeZone.CurrentTimeZone.StandardName); Console.WriteLine("TimeZone.CurrentTimeZone.DaylightName = {0}", TimeZone.CurrentTimeZone.DaylightName); Console.WriteLine(String.Empty); Console.WriteLine("TimeZoneInfo.Local.DisplayName = {0}", TimeZoneInfo.Local.DisplayName); Console.WriteLine("TimeZoneInfo.Local.Id = {0}", TimeZoneInfo.Local.Id); Console.WriteLine("TimeZoneInfo.Local.StandardName = {0}", TimeZoneInfo.Local.StandardName); Console.WriteLine("TimeZoneInfo.Local.DaylightName = {0}", TimeZoneInfo.Local.DaylightName); Console.WriteLine(String.Empty); var str = new Oracle.DataAccess.Client.OracleConnectionStringBuilder(); str.UserID ="<username>"; str.Password ="<password>"; str.DataSource ="<database name>"; using ( var con = new Oracle.DataAccess.Client.OracleConnection(str.ConnectionString) ) { con.Open(); Console.WriteLine("Oracle.DataAccess: OracleConnection -> SessionInfo.TimeZone = {0}", con.GetSessionInfo().TimeZone); Console.WriteLine("Oracle.DataAccess: Version = {0}", FileVersionInfo.GetVersionInfo(con.GetType().Assembly.Location).FileVersion.ToString()); var tz = new Oracle.DataAccess.Client.OracleCommand("SELECT SESSIONTIMEZONE FROM dual", con).ExecuteScalar(); Console.WriteLine("Oracle.DataAccess: SESSIONTIMEZONE = {0}", tz.ToString()); con.Close(); } Console.WriteLine(String.Empty); var strm = new Oracle.ManagedDataAccess.Client.OracleConnectionStringBuilder(); str.UserID ="<username>"; str.Password ="<password>"; str.DataSource ="<database name>"; using ( var con = new Oracle.ManagedDataAccess.Client.OracleConnection(str.ConnectionString) ) { con.Open(); Console.WriteLine("Oracle.ManagedDataAccess: OracleConnection -> SessionInfo.TimeZone = {0}", con.GetSessionInfo().TimeZone); Console.WriteLine("Oracle.ManagedDataAccess: Version = {0}", FileVersionInfo.GetVersionInfo(con.GetType().Assembly.Location).FileVersion.ToString()); var tz = new Oracle.ManagedDataAccess.Client.OracleCommand("SELECT SESSIONTIMEZONE FROM dual", con).ExecuteScalar(); Console.WriteLine("Oracle.ManagedDataAccess: SESSIONTIMEZONE = {0}", tz.ToString()); con.Close(); } } |
更新
根据您的个人资料,您在斯里兰卡。斯里兰卡的时区似乎相当"不稳定",请参阅 IANA 时区数据库中的文本:
Sri Lanka
From Paul Eggert (2013-02-21):
Milne says"Madras mean time use from May 1, 1898. Prior to this Colombo
mean time, 5h. 4m. 21.9s. F., was used." But 5:04:21.9 differs considerably
from Colombo's meridian 5:19:24, so for now ignore Milne and stick with
Shanks and Pottenger.From Paul Eggert (1996-09-03):
"Sri Lanka advances clock by an hour to avoid blackout"
(http://www.virtual-pc.com/lankaweb/news/items/240596-2.html, 1996-05-24,
no longer available as of 1999-08-17)
reported"the country's standard time will be put forward by one hour at
midnight Friday (1830 GMT) 'in the light of the present power crisis'."From Dharmasiri Senanayake, Sri Lanka Media Minister (1996-10-24), as quoted
by Shamindra in Daily News - Hot News Section
(1996-10-26):
With effect from 12.30 a.m. on 26th October 1996
Sri Lanka will be six (06) hours ahead of GMT.From Jesper N??rgaard Welen (2006-04-14), quoting Sri Lanka News Online
http://news.sinhalaya.com/wmview.php?ArtID=11002 (2006-04-13):
0030 hrs on April 15, 2006 (midnight of April 14, 2006 +30 minutes)
at present, become 2400 hours of April 14, 2006 (midnight of April 14, 2006).From Peter Apps and Ranga Sirila of Reuters (2006-04-12) in:
http://today.reuters.co.uk/news/newsArticle.aspx?type=scienceNews&storyID=2006-04-12T172228Z_01_COL295762_RTRIDST_0_SCIENCE-SRILANKA-TIME-DC.XML
[The Tamil Tigers] never accepted the original 1996 time change and simply
kept their clocks set five and a half hours ahead of Greenwich Mean
Time (GMT), in line with neighbor India.From Paul Eggert (2006-04-18):
People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
as that zone has agreed with the Tamil areas since our cutoff date of 1970.From Sadika Sumanapala (2016-10-19):
According to http://www.sltime.org (maintained by Measurement Units,
Standards & Services Department, Sri Lanka) abbreviation for Sri Lanka
standard time is SLST.From Paul Eggert (2016-10-18):
"SLST" seems to be reasonably recent and rarely-used outside time
zone nerd sources. I searched Google News and found three uses of
it in the International Business Times of India in February and
March of this year when discussing cricket match times, but nothing
since then (though there has been a lot of cricket) and nothing in
other English-language news sources. Our old abbreviation"LKT" is
even worse. For now, let's use a numeric abbreviation; we can
switch to"SLST" if it catches on.
我假设您的数据库无法识别您计算机当前的本地时区。可能有三种可能的解决方案:
根据这个和这个:
在
如何在ruby中调用C#dll? 最佳答案 我能想到几种可能性:为您的DLL编写(或找人编写)一个COM包装器,如果它还没有,则使用Ruby的WIN32OLE库来调用它;看看RubyCLR,其中一位作者是JohnLam,他继续在Microsoft从事IronRuby方面的工作。(估计不会再维护了,可能不支持.Net2.0以上的版本);正如其他地方已经提到的,看看使用IronRuby,如果这是您的技术选择。有一个主题是here.请注意,最后一篇文章实际上来自JohnLam(看起来像是2009年3月),他似乎很自在地断言RubyCL
我正在尝试在Ruby中复制Convert.ToBase64String()行为。这是我的C#代码:varsha1=newSHA1CryptoServiceProvider();varpasswordBytes=Encoding.UTF8.GetBytes("password");varpasswordHash=sha1.ComputeHash(passwordBytes);returnConvert.ToBase64String(passwordHash);//returns"W6ph5Mm5Pz8GgiULbPgzG37mj9g="当我在Ruby中尝试同样的事情时,我得到了相同sha
C#实现简易绘图工具一.引言实验目的:通过制作窗体应用程序(C#画图软件),熟悉基本的窗体设计过程以及控件设计,事件处理等,熟悉使用C#的winform窗体进行绘图的基本步骤,对于面向对象编程有更加深刻的体会.Tutorial任务设计一个具有基本功能的画图软件**·包括简单的新建文件,保存,重新绘图等功能**·实现一些基本图形的绘制,包括铅笔和基本形状等,学习橡皮工具的创建**·设计一个合理舒适的UI界面**注明:你可能需要先了解一些关于winform窗体应用程序绘图的基本知识,以及关于GDI+类和结构的知识二.实验环境Windows系统下的visualstudio2017C#窗体应用程序三.
我在我的rails应用程序中安装了来自github.com的acts_as_versioned插件,但有一段代码我不完全理解,我希望有人能帮我解决这个问题class_eval我知道block内的方法(或任何它是什么)被定义为类内的实例方法,但我在插件的任何地方都找不到定义为常量的CLASS_METHODS,而且我也不确定是什么here,并且有问题的代码从lib/acts_as_versioned.rb的第199行开始。如果有人愿意告诉我这里的内幕,我将不胜感激。谢谢-C 最佳答案 这是一个异端。http://en.wikipedia
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visitthehelpcenter指导。关闭9年前。我最近开始学习Ruby,这是我的第一门编程语言。我对语法感到满意,并且我已经完成了许多只教授相同基础知识的教程。我已经写了一些小程序(包括我自己的数组排序方法,在有人告诉我谷歌“冒泡排序”之前我认为它非常聪明),但我觉得我需要尝试更大更难的东西来理解更多关于Ruby.关于如何执行此操作的任何想法?
我在Ruby中遇到了一个关于Dir[]和File.join()的简单程序,blobs_dir='/path/to/dir'Dir[File.join(blobs_dir,"**","*")].eachdo|file|FileUtils.rm_rf(file)ifFile.symlink?(file)我有两个困惑:首先,File.join(@blobs_dir,"**","*")中的第二个和第三个参数是什么意思?其次,Dir[]在Ruby中有什么用?我只知道它等价于Dir.glob(),但是,我对Dir.glob()确实不是很清楚。 最佳答案
我如何做Ruby方法"Flatten"RubyMethod在C#中。此方法将锯齿状数组展平为一维数组。例如:s=[1,2,3]#=>[1,2,3]t=[4,5,6,[7,8]]#=>[4,5,6,[7,8]]a=[s,t,9,10]#=>[[1,2,3],[4,5,6,[7,8]],9,10]a.flatten#=>[1,2,3,4,5,6,7,8,9,10 最佳答案 递归解决方案:IEnumerableFlatten(IEnumerablearray){foreach(variteminarray){if(itemisIEnume
我最近从C#转向了Ruby,我发现自己无法制作可折叠的标记代码区域。我只是想到做这种事情应该没问题:classExamplebegin#agroupofmethodsdefmethod1..enddefmethod2..endenddefmethod3..endend...但是这样做真的可以吗?method1和method2最终与method3是同一种东西吗?还是有一些我还没有见过的用于执行此操作的Ruby惯用语? 最佳答案 正如其他人所说,这不会改变方法定义。但是,如果要标记方法组,为什么不使用Ruby语义来标记它们呢?您可以使用
什么是Linq聚合方法的ruby等价物。它的工作原理是这样的varfactorial=new[]{1,2,3,4,5}.Aggregate((acc,i)=>acc*i);每次将数组序列中的值传递给lambda时,变量acc都会累积。 最佳答案 这在数学以及几乎所有编程语言中通常称为折叠。它是更普遍的变形概念的一个实例。Ruby从Smalltalk中继承了这个特性的名称,它被称为inject:into:(像aCollectioninject:aStartValueinto:aBlock一样使用。)所以,在Ruby中,它称为inj
1.回顾.TransportServicepublicclassTransportServiceextendsAbstractLifecycleComponentTransportService:方法:1publicfinalTextendsTransportResponse>voidsendRequest(finalTransport.Connectionconnection,finalStringaction,finalTransportRequestrequest,finalTransportRequestOptionsoptions,TransportResponseHandlerT>