C#连接进度数据库错误
本文关键字:数据库 错误 连接 | 更新日期: 2023-09-27 18:26:10
我想用c#连接本地的进度数据库。
我的c#代码是:
string connectionString = "DSN=OpenEdge Wire Protocol;Host = localhost; DB = E:''programs''DBs''TrDB''trnakdb; UID = connuser; PWD = 123456; PORT = 11112";
DataTable dt = new DataTable();
int rows;
using (OdbcConnection connection = new OdbcConnection(connectionString))
using (OdbcCommand command = connection.CreateCommand())
using (OdbcDataAdapter adapter = new OdbcDataAdapter(command))
{
connection.Open();
command.CommandText = "SELECT * FROM PUB.FTTEFBAS";
rows = adapter.Fill(dt);
}
Console.WriteLine("adapter.Fill() returned {0}", rows);
Console.WriteLine("The data table contains {0} rows and {1} columns.",
dt.Rows.Count,
dt.Columns.Count
);
foreach (DataRow dataRow in dt.Rows)
{
string babili = dataRow.ItemArray.ToString()+"####";
for (int key = 0; key < dataRow.ItemArray.Length; ++key)
babili += "'t" + key + "=>" + dataRow.ItemArray[key];
Console.WriteLine(babili);
}
但它给出了错误:
System.Data.Odbc.OdbcException (0x80131937): ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Access denied (Authorisation failed) (7512)
我可以用这个用户名连接进度数据字典或数据管理工具。
如果我尝试选择系统表,则不会出现错误。但当我试图列出PUB模式中的任何表时,它都会出错。
感谢
M。Yasin Birer
DBA需要向您的用户ID授予SQL权限。字典等使用4GL权限,默认情况下,这些权限是完全开放的。默认情况下,SQL授权是有限制的。
如果您知道DBA用户ID(通常为"sysprogress")和密码,您可以尝试验证您的连接性。并根据需要授予用户永久权限。
你可能会发现这个知识库很有用:http://knowledgebase.progress.com/articles/Article/20143/p