问题描述
我如何解析使用Visual C#(Visual Studio 2008速成版),以获得TNSNAMES tnsnames.ora文件?
例如,我的tnsnames.ora文件包含
How I parse tnsnames.ora file using Visual C# (Visual Studio 2008 Express edition) to get the tnsnames ?For instance, my tnsnames.ora file contains
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = shaman)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
BILL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.58)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
如何分析这个文件,以获得TNSNAMES(即ORCL,BILL等)。原谅我,如果这个问题听起来太明显了,我在学习和放大器;想我的手在C#
How can I parse this file to get the TNSNAMES (ie, ORCL, BILL etc). Forgive me if this question sounds too obvious, I'm learning & trying my hand in C#
推荐答案
首先,你需要的规则。
有可能是这是一个黑客,但我会亲自去一个完整的解析器,如结合(ANTLR语法的完整列表的)
There is probably a hack for this, but I would personally go with a full parser, like ANTLR combined with the proper grammar (a complete list of ANTLR grammars can be found here).
这篇关于在Visual C#2008的tnsnames.ora解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!