6

I am trying this:

Provider=MSDASQL.1;Persist Security Info=False;User ID=sys;Password=pwd;Initial Catalog=DATABASE;Data Source=OdbcDataSource;DBA Privilege=SYSDBA

But I get the error:

[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

I'm using Delphi, but answers in any language are welcome.

Clarification: I am able to connect as a normal user. I run into trouble when I try to connect AS SYSDBA.

6 Answers 6

4

You can't connect as SYSDBA using standard System.Data.OracleClient, as stated by this post : http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2245591&SiteID=1.

You can do that using ODP .NET (Oracle Data Provider for .NET), or other third parties library. If you're planning to build serious Oracle Application on .NET, I suggest you at least look at ODP.NET

Sign up to request clarification or add additional context in comments.

1 Comment

We moved from ODP.Net to the excellent third party library - DevArt (formerly CoreLAB)'s OraDirect.Net. They let you connect as SYSDBA or SYSOPER (devart.com/oranet/docs/…) :o)
4

Posting the answer here as this is the top result when looking for an answer for DBA PRIVILEGE connection string

Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = ORCL))); User ID=sys; Password=syspassword; DBA PRIVILEGE=SYSDBA

1 Comment

I approved the improvement. Thank you!
2

using Oracle.ManagedDataAccess, the connection string for sys as sysdba is:

Data Source=myOracleDB;User Id=SYS;Password=SYS;DBA Privilege=SYSDBA;

ref

Comments

1

I'm not sure what you mean by connecting as a SYS, but there here is a link to sweet repository of connection strings. I hope you can find your answer there.

1 Comment

as sys = with the user name of "sys". From sql plus it would be SYS AS SYSDBA.
1

using Oracle.ManagedDataAccess.Client;

var conn = new OracleConnection("data source = localhost:1521/xe; user id = sys; password = 123456789; dba privilege = sysdba");

conn.Open();

Comments

0

Oracle Connection string sample

You must have your Oracle SID defined in your TNSNames file. Which is the data source.

Data Source=oracl;User Id=userID;Password=password;Integrated Security=no

If you are using Visual Studios you can add a data source in the Sever Explore and it will give you the connection string.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.