Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

DAAB and Connection to SQL 2000

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
<M> - 31 Oct 2007 21:42 GMT
Hi,

I'm having difficulty connecting my .NET web app to my SQL2000
database via the DAAB. I'm using VS2003 with .NET 1.1.

I'm currently trying names such as Initial Catalog, Data Source, User
ID and Password. But i have previously attempted server, database,
user, uid, Pwd, etc. all to no avail.

The user and password i've supplied do provide access to the database
in question as I can log into QA using those credentials. But I can't
seem to configure the DAAB to accept them.

In my new web page I have created a db object using the
DataFactory.CreateDatabase method and can retreive the
ConfigurationName, so I must be on the right lines somewhere.

Any tips on how I should configure my DAAB so that I no longer get a
[SqlException: SQL Server does not exist or access denied.] error?

Cheers,

<M>
sloan - 31 Oct 2007 21:53 GMT
Are you using the DAAB?  or the EnterpriseLibrary.Data?

//DataFactory.CreateDatabase//

That exists only in the EnterpriseLibrary.Data I believe.

...............

Which version of the EnterpriseLibrary(.Data) are you using?

There are several permutations involved, and I think you may be using the
wrong name(s) for things.

Throw out a little more (detailed) information please.

> Hi,
>
[quoted text clipped - 19 lines]
>
> <M>
sloan - 31 Oct 2007 22:08 GMT
If you're using the EnterpriseLibrary.Data...and the 1.1 version.

What does your dataConfiguration.config file look like??

> Are you using the DAAB?  or the EnterpriseLibrary.Data?
>
[quoted text clipped - 34 lines]
>>
>> <M>
<M> - 31 Oct 2007 22:10 GMT
Good questions. In short I'm not too sure.

I created a DAAB configuration and saved it to the project. I then
added references to the EnterpriseLibrary to the project for Data,
Configuration and Common. I was attempting to follow the help files
that came with the Microsoft Patterns and Practices (June 2005)
install, but my interpretation of them lead me to my current position.

According to the properties pane in VS the EnterpriseLibrary(.Data)
version is v1.1.4322.

Any thoughts as to what additional information may be of use? I.e.
contents of dataconfiguration.config, code on the web page, etc?

<M>
sloan - 31 Oct 2007 22:25 GMT
Below is my dataConfiguration.config.

It'll get you started for google searching;

If you call the
DataFactory.CreateDatabase(); //no value passed in
you'll get the defaultInstance of "pubsInstance1".  YOU CARE ABOUT THE
INSTANCE NAME, not the connection string name.

DataFactory.CreateDatabase("pubsInstance2") ; // youll get the the second
string, because you're explicitly telling it which one you want.

You also need to google
   <databaseType name="Sql Server"
type="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase,
Microsoft.EntLib.Data" />
(or at least the first half)

Because I think I shorted the filenames some.....aka ... my
"Microsoft.EntLib.Data" is too short from the default name.  Find the
correct one thru google or sample code.
Basically, Microsoft.EntLib.Data is the dll name without the ".dll" with it.
Microsoft.EntLib.Data.dll is mine.  The default is different.
..

Last tip.
If you're in webforms (which I assume you are because of this newsgroup),
then you put dataConfiguration.config in the root directory where web.config
is.
If you're in winforms, YOU NEED TO DO A POST BUILD EVENT, putting the
dataConfiguration.config file into the running folder /bin/ usually. (Just
mentioned for non web people)

Remember, the INSTANCE name is important.  Not the connectionstring name,
not the connection string itself, just the instance name. (the
DataFactory.CreateDatabase method )

All of this should be in the quickstarts.  But now you know what youre'
looking for.

start dataconfiguraiton.config file...

<?xml version="1.0" encoding="utf-8" ?>
<dataConfiguration>
<xmlSerializerSection
type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
Microsoft.EntLib.Data, Version=1.1.0.0, Culture=neutral,
PublicKeyToken=null">
 <enterpriseLibrary.databaseSettings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  defaultInstance="pubsInstance1"
xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/data">
  <databaseTypes>
   <databaseType name="Sql Server"
type="Microsoft.Practices.EnterpriseLibrary.Data.Sql.SqlDatabase,
Microsoft.EntLib.Data" />
   <databaseType name="OleDB"
type="Microsoft.Practices.EnterpriseLibrary.Data.OleDbLib.OleDbDatabase,
Microsoft.EntLib.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" />
  </databaseTypes>
  <instances>
   <instance name="pubsInstance1" type="Sql Server"
connectionString="pubsConnectionString1" />
   <instance name="pubsInstance2" type="Sql Server"
connectionString="pubsConnectionString2" />

-->
  </instances>
  <connectionStrings>
   <connectionString name="pubsConnectionString1">
    <parameters>
     <parameter name="database" value="pubs" isSensitive="false" />
     <parameter name="Integrated Security" value="True" isSensitive="false"
/>
     <!--
     <parameter name="password" value="mypassword" isSensitive="true" />
     <parameter name="user id" value="myusername" isSensitive="false" />
     -->
     <parameter name="server" value="SERVER1" isSensitive="false" />
    </parameters>
   </connectionString>

   <connectionString name="pubsConnectionString2">
    <parameters>
     <parameter name="database" value="pubs" isSensitive="false" />
     <parameter name="Integrated Security" value="True" isSensitive="false"
/>
     <!--
     <parameter name="password" value="mypassword" isSensitive="true" />
     <parameter name="user id" value="myusername" isSensitive="false" />
     -->
     <parameter name="server" value="SERVER2" isSensitive="false" />
    </parameters>
   </connectionString>

  </connectionStrings>
 </enterpriseLibrary.databaseSettings>
</xmlSerializerSection>
</dataConfiguration>

end dataConfiguration.data file

start entries need to ADD to web.config

<configSections>
<section name="enterpriselibrary.configurationSettings"
type="System.Configuration.IgnoreSectionHandler, System, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<enterpriselibrary.configurationSettings
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 applicationName="Application"
xmlns="http://www.microsoft.com/practices/enterpriselibrary/08-31-2004/configuration">
 <configurationSections>
  <configurationSection name="dataConfiguration" encrypt="false">
   <storageProvider xsi:type="XmlFileStorageProviderData" name="XML File
Storage Provider" path="dataConfiguration.config" />
   <dataTransformer xsi:type="XmlSerializerTransformerData" name="Xml
Serializer Transformer">
    <includeTypes />
   </dataTransformer>
  </configurationSection>
 </configurationSections>
 <includeTypes />
</enterpriselibrary.configurationSettings>
<M> - 31 Oct 2007 22:18 GMT
Ah,

Think I may have solved it.
Both my IIS and SQL server services are running on the same
(development) PC. I had assumed (Doh!) that therefore my Data Source
would be (local). Wrong. I needed to replace this value with that of
the name of my PC for it to succeed.

Thanks for your assistance, i'll try not to be so assuming next
time :-)

<M>
sloan - 31 Oct 2007 22:27 GMT
Ok.

Stop calling the Enterprise.Data stuff "DAAB".  (please).

That's where you'll get wires crossed.

DAAB 2.0 was the last one, and was sql server specific.

EnterpriseLibrary.Data is more abstract, and allows multiple backend rdbms.

> Ah,
>
[quoted text clipped - 8 lines]
>
> <M>

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.