473,466 Members | 1,290 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems with my SQL Server connection string

SAL
Hello,

I am working with Framework 1.1 and Microsoft Enterprise Library 2005. I've
used the Enterprise Library Configuration utility to create my app.config &
dataConfiguration.config files.

My question is, why is the Enterprise Library stripping out my User Id and
Password from my SQL Server connection string, that I have in the
dataConfiguration file? This is an internal app that has no UI and is an
automated process that runs Store procedures which is why I have the UID and
PWD in my dataConfiguration file. When the Enterprise Library reads the
dataConfiguration.config file it passes the following connection string to
SQL Server:

data source=sql123;initial catalog=MyDb;persist security info=true;packet
size=4096
Instead of this one:
data source=SQL123;initial catalog=MyDb;persist security info=False;user
id=youruid;;packet size=4096; password=yourpwd"

Is following C# code I have missing a step that is causing my issue:

Database db = DatabaseFactory.CreateDatabase("SQL Server");

string sqlCommand = "autoApInput_getFile";
DBCommandWrapper dbCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand);

// Add paramters
// Input parameters can specify the input value
dbCommandWrapper.AddInParameter("@visitor", DbType.Int32, 1);
dbCommandWrapper.AddInParameter("@po", DbType.String, "0018487402");
dbCommandWrapper.AddInParameter("@poAmount", DbType.String, "$156.25");

db.ExecuteNonQuery(dbCommandWrapper);

And the following is the ConnectionString block I have in my
dataConfiguration.config file:

<connectionString name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="false"/>
<parameter name="initial catalog" value="MyDB"
isSensitive="false" />
<parameter name="persist security info" value="False"
isSensitive="false" />
<parameter name="uid" value="userid" isSensitive="true" />
<parameter name="packet size" value="4096" isSensitive="false" />
<parameter name="pwd" value="password" isSensitive="true" />
</parameters>
</connectionString>

Thanks,
Sep 18 '06 #1
2 3159
SAL wrote:
>
data source=sql123;initial catalog=MyDb;persist security info=true;packet
size=4096
Instead of this one:
data source=SQL123;initial catalog=MyDb;persist security info=False;user
id=youruid;;packet size=4096; password=yourpwd"
And the following is the ConnectionString block I have in my
dataConfiguration.config file:

<connectionString name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="false"/>
<parameter name="initial catalog" value="MyDB"
isSensitive="false" />
<parameter name="persist security info" value="False"
isSensitive="false" />
<parameter name="uid" value="userid" isSensitive="true" />
<parameter name="packet size" value="4096" isSensitive="false" />
<parameter name="pwd" value="password" isSensitive="true" />
</parameters>
</connectionString>
IIRC, the parameter names need to be named the same as they will appear
in the connection string.

I think the problem is caused by the naming you use for the user id and
password parameters. Instead of uid, try User Id and instead of pwd,
try Password.

Here is the configuration we use:

<connectionString name="BeddingTest">
<parameters>
<parameter name="database" value="database"
isSensitive="false" />
<parameter name="Password" value="password"
isSensitive="true" />
<parameter name="server" value="server" isSensitive="false"
/>
<parameter name="User Id" value="user" isSensitive="false" />
</parameters>
</connectionString>

Sep 18 '06 #2
SAL
Hi Chris,

Thanks. You were partially correct, however it wasn't in the parameter name
but in the value itself. They changed my Initial Catalog value to include an
underscore (_) in the value and I wasn't aware of it. Why, I have no clue.
As soon as I changed it, it worked like a charm.

Thanks again for your help.

"Chris Dunaway" wrote:
SAL wrote:

data source=sql123;initial catalog=MyDb;persist security info=true;packet
size=4096
Instead of this one:
data source=SQL123;initial catalog=MyDb;persist security info=False;user
id=youruid;;packet size=4096; password=yourpwd"
And the following is the ConnectionString block I have in my
dataConfiguration.config file:

<connectionString name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="false"/>
<parameter name="initial catalog" value="MyDB"
isSensitive="false" />
<parameter name="persist security info" value="False"
isSensitive="false" />
<parameter name="uid" value="userid" isSensitive="true" />
<parameter name="packet size" value="4096" isSensitive="false" />
<parameter name="pwd" value="password" isSensitive="true" />
</parameters>
</connectionString>

IIRC, the parameter names need to be named the same as they will appear
in the connection string.

I think the problem is caused by the naming you use for the user id and
password parameters. Instead of uid, try User Id and instead of pwd,
try Password.

Here is the configuration we use:

<connectionString name="BeddingTest">
<parameters>
<parameter name="database" value="database"
isSensitive="false" />
<parameter name="Password" value="password"
isSensitive="true" />
<parameter name="server" value="server" isSensitive="false"
/>
<parameter name="User Id" value="user" isSensitive="false" />
</parameters>
</connectionString>

Sep 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Tom D. | last post by:
I just got a new computer. I transfered my web site files over and setup my access database system ODBC driver. I've compared settings on both computers. But when I run my web site code on new...
1
by: Brad Pears | last post by:
Our graphic designer is developing our new company website. We have switched providers and currently she is working on the new website which currently ressides on the new providers server as they...
9
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to...
5
by: Roy Gourgi | last post by:
Hi, I just installed VS 2005 Express with SQL Server and when I try to run the code that was working with VS 2003 is no longer working. Is it not backward compatible. What has changed. Below is...
6
by: Andrew | last post by:
Hell-hohoho to all... Just begun working with asp.net linking to sqlServer 2000, had some problems with the (null) user, but previous posts have got me past that by storing an identity in the...
5
by: Bendik Engebretsen | last post by:
Developed this personal WEB site with the new ASP.NET 2.0 Beta: http://www.techsoft.no/bendik/ It has got this problem: After a while browsing through pictures on the site, an error occurs: ...
0
by: ZR | last post by:
I am writing two applications which needs to (among other things) communicate through network, so one of them is a client and the other one is a server. I have used asynchronous socket examples...
3
by: Hrvoje Vrbanc | last post by:
Hello all! Scenario: - web server at one location (domain) with VS 2003 - SQL server at a remote location (domain) - VPN connection on port 1433 between the two domains I have no troubles...
0
by: Jonathan Wood | last post by:
I seem to be having errors creating and accessing an SQL database. Unfortunatley, I am brand new to SQL setup and administration issues so this really is not my area of expertise. I know I had...
5
by: Claudio M. E. Bastos Iorio | last post by:
Hi, anyone using VS2008 (final) on windows Vista? I have a problem. The ASP.NET web site administration tool on any site created by VS2008, running on Vista, is not working as it should. I can...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.