Hello, all

The documentation is not very clear on whether or not it is possible to set initString parameter directly in the connection string when working with ADO.NET

Something like: "server=srv;dbn=database;con=connectionName;initStr={my authentication string}"

I know it is possible to use the initString property, but if there is a problem to change a code, we might want to just change the config file.

Thank you

asked 27 Feb, 02:32

Arcady%20Abramov's gravatar image

Arcady Abramov
861413
accept rate: 0%

AFAIK, you can use the InitString connection parameter for non-ODBC connections as well. There are several questions here dealing with that parameter for different APIs.

(27 Feb, 03:02) Volker Barth

I went over these questions, but they all deal with changes in code, i.e., setting property InitString of SAConnection or using ExecuteCommand function. I did not find anything conclusive regarding connection string for ADO.NET. If anyone has a working example it would be greatly appreciated.

(27 Feb, 03:05) Arcady Abramov
Replies hidden

The following doc page shows a sample for an OLE DB connection using an InitString to provide the authentication information.

AFAIK, you can use such a connection string for any API, and I'm quite sure you can use that as part of a DSN or DSN-less. But note, I have not used this with ADO.Net myself.

(27 Feb, 03:35) Volker Barth

Here is an example:

SAConnection conn = new SAConnection("uid=dba;pwd=sql;eng=A_DB_ENG;
InitString=\"SET TEMPORARY OPTION CONNECTION_AUTHENTICATION='{hidden}'\"");
permanent link

answered 27 Feb, 14:59

Chris%20Keating's gravatar image

Chris Keating
4.7k2578
accept rate: 35%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×21

question asked: 27 Feb, 02:32

question was seen: 182 times

last updated: 27 Feb, 14:59