473,670 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ 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 &
dataConfigurati on.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
dataConfigurati on 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 dataConfigurati on file. When the Enterprise Library reads the
dataConfigurati on.config file it passes the following connection string to
SQL Server:

data source=sql123;i nitial catalog=MyDb;pe rsist security info=true;packe t
size=4096
Instead of this one:
data source=SQL123;i nitial catalog=MyDb;pe rsist security info=False;user
id=youruid;;pac ket size=4096; password=yourpw d"

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

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

string sqlCommand = "autoApInput_ge tFile";
DBCommandWrappe r dbCommandWrappe r =
db.GetStoredPro cCommandWrapper (sqlCommand);

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

db.ExecuteNonQu ery(dbCommandWr apper);

And the following is the ConnectionStrin g block I have in my
dataConfigurati on.config file:

<connectionStri ng name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="fa lse"/>
<parameter name="initial catalog" value="MyDB"
isSensitive="fa lse" />
<parameter name="persist security info" value="False"
isSensitive="fa lse" />
<parameter name="uid" value="userid" isSensitive="tr ue" />
<parameter name="packet size" value="4096" isSensitive="fa lse" />
<parameter name="pwd" value="password " isSensitive="tr ue" />
</parameters>
</connectionStrin g>

Thanks,
Sep 18 '06 #1
2 3173
SAL wrote:
>
data source=sql123;i nitial catalog=MyDb;pe rsist security info=true;packe t
size=4096
Instead of this one:
data source=SQL123;i nitial catalog=MyDb;pe rsist security info=False;user
id=youruid;;pac ket size=4096; password=yourpw d"
And the following is the ConnectionStrin g block I have in my
dataConfigurati on.config file:

<connectionStri ng name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="fa lse"/>
<parameter name="initial catalog" value="MyDB"
isSensitive="fa lse" />
<parameter name="persist security info" value="False"
isSensitive="fa lse" />
<parameter name="uid" value="userid" isSensitive="tr ue" />
<parameter name="packet size" value="4096" isSensitive="fa lse" />
<parameter name="pwd" value="password " isSensitive="tr ue" />
</parameters>
</connectionStrin g>
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:

<connectionStri ng name="BeddingTe st">
<parameters>
<parameter name="database" value="database "
isSensitive="fa lse" />
<parameter name="Password" value="password "
isSensitive="tr ue" />
<parameter name="server" value="server" isSensitive="fa lse"
/>
<parameter name="User Id" value="user" isSensitive="fa lse" />
</parameters>
</connectionStrin g>

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;i nitial catalog=MyDb;pe rsist security info=true;packe t
size=4096
Instead of this one:
data source=SQL123;i nitial catalog=MyDb;pe rsist security info=False;user
id=youruid;;pac ket size=4096; password=yourpw d"
And the following is the ConnectionStrin g block I have in my
dataConfigurati on.config file:

<connectionStri ng name="SQL Connection String">
<parameters>
<parameter name="data source" value="SQL123" isSensitive="fa lse"/>
<parameter name="initial catalog" value="MyDB"
isSensitive="fa lse" />
<parameter name="persist security info" value="False"
isSensitive="fa lse" />
<parameter name="uid" value="userid" isSensitive="tr ue" />
<parameter name="packet size" value="4096" isSensitive="fa lse" />
<parameter name="pwd" value="password " isSensitive="tr ue" />
</parameters>
</connectionStrin g>

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:

<connectionStri ng name="BeddingTe st">
<parameters>
<parameter name="database" value="database "
isSensitive="fa lse" />
<parameter name="Password" value="password "
isSensitive="tr ue" />
<parameter name="server" value="server" isSensitive="fa lse"
/>
<parameter name="User Id" value="user" isSensitive="fa lse" />
</parameters>
</connectionStrin g>

Sep 18 '06 #3

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

Similar topics

6
3574
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 machine I get... Microsoft OLE DB Provider for ODBC Drivers (0x80004005) Not a valid password.
1
2135
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 support the ASP development environment. Their server is a Win2K3 server. She is writing an ASP module to connect to an MS Access 2000 database and is having problems connecting. In this database there is only one table. She has tried many...
9
17020
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 access any of the Oracle tables on another machine but now I am having problems. Unfortunately, I don't remember the correct syntax for the ODBC connect string and I am hoping that is my whole problem. I am trying to connect to an Oracle 9...
5
3208
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 my code. TIA Roy
6
1244
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 web.config file. However, I want to dyamically set the login info, from a prompted box. I'm aware of the security issues here, but I'll ignore that for now. The kb article I saw set the following info in the connection string of the sql...
5
1693
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: 'Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.'
0
3458
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 found at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconblockingclientsocketexample.asp as templates (they have to be asynchronous, because application must not freeze if connection fails). I have converted the...
3
2567
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 reaching the remote SQL server either from SQL Enterprise manager or in VS 2003 design-time (using the SQL authentication in both cases) - all the connections work and I can preview data while building
0
1604
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 to install some type of IIS component to run databases from Visual Studio 2003. Since then, I've installed Visual Studio 2005. I know VS 2005 has some component so that IIS is not required. Here's the two errors:
5
5629
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 configure users, roles, but when I try the option 'Select a single provider for all site management data' AspNetSqlProvider test, I receive the message: 'Could not establish a connection to the database. If you have not yet created the SQL Server...
0
8468
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8386
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8901
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8591
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8660
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6213
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4390
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2799
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 we have to send another system
2
1792
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.