473,788 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dsn connection

In my code i'm pointing to a SQL server name and SQL database name on the
server, etc.
Instead of that how can i point to a DSN connection on the web server that
points to the SQL Server and DB?

Nov 18 '05 #1
9 1408
Why on earth would you want to do that? You're adding an unnecessary layer
of processing and file IO to accomplish the same thing. All a DSN does is
store information that you can put right into your Connection String. In
addition, it uses ODBC, which is a wrapper for OLE DB, and using the native
SQL Data classes is much faster.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
In my code i'm pointing to a SQL server name and SQL database name on the
server, etc.
Instead of that how can i point to a DSN connection on the web server that
points to the SQL Server and DB?

Nov 18 '05 #2
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside on the
web server? If I create a DSN who cares what servers its on, i just need to
point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
Why on earth would you want to do that? You're adding an unnecessary layer
of processing and file IO to accomplish the same thing. All a DSN does is
store information that you can put right into your Connection String. In
addition, it uses ODBC, which is a wrapper for OLE DB, and using the native SQL Data classes is much faster.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
In my code i'm pointing to a SQL server name and SQL database name on the server, etc.
Instead of that how can i point to a DSN connection on the web server that points to the SQL Server and DB?


Nov 18 '05 #3
Jon
<<...doesn't the SQL Server DB have to reside on the web server? >>

No - the SQL Server can exist anywhere. If you refer to it by name, then the
DNS system will resolve the name to the SQL Server's IP address;
alternatively you can specify the IP address of the SQL Server in your
connection string.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside on the web server? If I create a DSN who cares what servers its on, i just need to point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
Why on earth would you want to do that? You're adding an unnecessary layer
of processing and file IO to accomplish the same thing. All a DSN does is store information that you can put right into your Connection String. In
addition, it uses ODBC, which is a wrapper for OLE DB, and using the

native
SQL Data classes is much faster.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
In my code i'm pointing to a SQL server name and SQL database name on

the server, etc.
Instead of that how can i point to a DSN connection on the web server that points to the SQL Server and DB?



Nov 18 '05 #4
Here's my string

MyConnection = New
SqlConnection(" server=(servern ame);database=i ssues;Trusted_C onnection=yes")

is this the best way to connect in the .NET world?
In "classic asp" I always used a DSN name.

DSN=DB;UID=;PWD =;

whats the best way in .NET

"Jon" <fa*********@gl enhelendealerse ries.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
<<...doesn't the SQL Server DB have to reside on the web server? >>

No - the SQL Server can exist anywhere. If you refer to it by name, then the DNS system will resolve the name to the SQL Server's IP address;
alternatively you can specify the IP address of the SQL Server in your
connection string.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside on

the
web server? If I create a DSN who cares what servers its on, i just need

to
point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
Why on earth would you want to do that? You're adding an unnecessary layer of processing and file IO to accomplish the same thing. All a DSN does is store information that you can put right into your Connection String. In addition, it uses ODBC, which is a wrapper for OLE DB, and using the

native
SQL Data classes is much faster.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
> In my code i'm pointing to a SQL server name and SQL database name
on the
> server, etc.
> Instead of that how can i point to a DSN connection on the web
server that
> points to the SQL Server and DB?
>
>
>



Nov 18 '05 #5
Jon
Things are different in .NET. Your connection string won't work. check out
this link:

http://msdn.microsoft.com/library/de...ClassTopic.asp

Note that in .NET...
Instead of "database=" , you specify "initial catalog="
Instead of "server=" you specify "source=" and the value of source can be
an IP address, a server name, or "localhost"

-Jon

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Here's my string

MyConnection = New
SqlConnection(" server=(servern ame);database=i ssues;Trusted_C onnection=yes")
is this the best way to connect in the .NET world?
In "classic asp" I always used a DSN name.

DSN=DB;UID=;PWD =;

whats the best way in .NET

"Jon" <fa*********@gl enhelendealerse ries.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
<<...doesn't the SQL Server DB have to reside on the web server? >>

No - the SQL Server can exist anywhere. If you refer to it by name, then the
DNS system will resolve the name to the SQL Server's IP address;
alternatively you can specify the IP address of the SQL Server in your
connection string.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
why do want to do want? Setup a DSN or how i'm doing it now in the code?
'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside
on
the
web server? If I create a DSN who cares what servers its on, i just
need to
point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
> Why on earth would you want to do that? You're adding an unnecessary

layer
> of processing and file IO to accomplish the same thing. All a DSN
does is
> store information that you can put right into your Connection

String. In > addition, it uses ODBC, which is a wrapper for OLE DB, and using the
native
> SQL Data classes is much faster.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "Mike" <an*******@disc ussions.microso ft.com> wrote in message
> news:O5******** ******@TK2MSFTN GP12.phx.gbl...
> > In my code i'm pointing to a SQL server name and SQL database name on the
> > server, etc.
> > Instead of that how can i point to a DSN connection on the web server that
> > points to the SQL Server and DB?
> >
> >
> >
>
>



Nov 18 '05 #6
actually that string does work, i pulled it out of my asp.net/vb.net app.
and i connect to the db just fine, but i'll check out the URL
"Jon" <fa*********@gl enhelendealerse ries.com> wrote in message
news:ev******** ******@tk2msftn gp13.phx.gbl...
Things are different in .NET. Your connection string won't work. check out
this link:

http://msdn.microsoft.com/library/de...ClassTopic.asp
Note that in .NET...
Instead of "database=" , you specify "initial catalog="
Instead of "server=" you specify "source=" and the value of source can be
an IP address, a server name, or "localhost"

-Jon

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Here's my string

MyConnection = New

SqlConnection(" server=(servern ame);database=i ssues;Trusted_C onnection=yes")

is this the best way to connect in the .NET world?
In "classic asp" I always used a DSN name.

DSN=DB;UID=;PWD =;

whats the best way in .NET

"Jon" <fa*********@gl enhelendealerse ries.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
<<...doesn't the SQL Server DB have to reside on the web server? >>

No - the SQL Server can exist anywhere. If you refer to it by name, then
the
DNS system will resolve the name to the SQL Server's IP address;
alternatively you can specify the IP address of the SQL Server in your
connection string.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
> why do want to do want? Setup a DSN or how i'm doing it now in the code? >
> 'Server=servern ame;Database=DB Name"
>
> If i keep it like it is now doesn't the SQL Server DB have to reside on the
> web server? If I create a DSN who cares what servers its on, i just need to
> point to a DSN on the web server.
>
>
>
>
> "Kevin Spencer" <ks******@takem pis.com> wrote in message
> news:Ob******** ******@tk2msftn gp13.phx.gbl...
> > Why on earth would you want to do that? You're adding an
unnecessary layer
> > of processing and file IO to accomplish the same thing. All a DSN does is
> > store information that you can put right into your Connection

String.
In
> > addition, it uses ODBC, which is a wrapper for OLE DB, and using the > native
> > SQL Data classes is much faster.
> >
> > --
> > HTH,
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > "Mike" <an*******@disc ussions.microso ft.com> wrote in message
> > news:O5******** ******@TK2MSFTN GP12.phx.gbl...
> > > In my code i'm pointing to a SQL server name and SQL database

name on
> the
> > > server, etc.
> > > Instead of that how can i point to a DSN connection on the web

server
> that
> > > points to the SQL Server and DB?
> > >
> > >
> > >
> >
> >
>
>



Nov 18 '05 #7
> why do want to do want? Setup a DSN or how i'm doing it now in the code?

Why would you want to use an ODBC DSN?

Us the native DSQL Data classes instead.

If you're having a problem formulating your Connection String, check out:
http://www.connectionstrings.com/

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:#w******** ******@TK2MSFTN GP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside on the web server? If I create a DSN who cares what servers its on, i just need to point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
Why on earth would you want to do that? You're adding an unnecessary layer
of processing and file IO to accomplish the same thing. All a DSN does is store information that you can put right into your Connection String. In
addition, it uses ODBC, which is a wrapper for OLE DB, and using the

native
SQL Data classes is much faster.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
In my code i'm pointing to a SQL server name and SQL database name on

the server, etc.
Instead of that how can i point to a DSN connection on the web server that points to the SQL Server and DB?



Nov 18 '05 #8
I have my connection string working fine.
The reason i was thinking of DSN is because I have ran into a scenriao that
the SQL server name changed so I had to make a change to my code then build
it back out to the server. If i had a DSN I would only have to change the
pointer of the DSN on the web server without making changes to my code then
going through our process in putting dll's/files to our web servers.

Just curious which area is beter
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:uo******** ******@tk2msftn gp13.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?


Why would you want to use an ODBC DSN?

Us the native DSQL Data classes instead.

If you're having a problem formulating your Connection String, check out:
http://www.connectionstrings.com/

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:#w******** ******@TK2MSFTN GP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside on

the
web server? If I create a DSN who cares what servers its on, i just need

to
point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
Why on earth would you want to do that? You're adding an unnecessary layer of processing and file IO to accomplish the same thing. All a DSN does is store information that you can put right into your Connection String. In addition, it uses ODBC, which is a wrapper for OLE DB, and using the

native
SQL Data classes is much faster.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:O5******** ******@TK2MSFTN GP12.phx.gbl...
> In my code i'm pointing to a SQL server name and SQL database name
on the
> server, etc.
> Instead of that how can i point to a DSN connection on the web
server that
> points to the SQL Server and DB?
>
>
>



Nov 18 '05 #9
Use the native SQL classes, and put your Connection String into your
Web.Config file.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:OR******** ******@TK2MSFTN GP10.phx.gbl...
I have my connection string working fine.
The reason i was thinking of DSN is because I have ran into a scenriao that the SQL server name changed so I had to make a change to my code then build it back out to the server. If i had a DSN I would only have to change the
pointer of the DSN on the web server without making changes to my code then going through our process in putting dll's/files to our web servers.

Just curious which area is beter
"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:uo******** ******@tk2msftn gp13.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

Why would you want to use an ODBC DSN?

Us the native DSQL Data classes instead.

If you're having a problem formulating your Connection String, check out:
http://www.connectionstrings.com/

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Mike" <an*******@disc ussions.microso ft.com> wrote in message
news:#w******** ******@TK2MSFTN GP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the
code?
'Server=servern ame;Database=DB Name"

If i keep it like it is now doesn't the SQL Server DB have to reside
on the
web server? If I create a DSN who cares what servers its on, i just
need to
point to a DSN on the web server.


"Kevin Spencer" <ks******@takem pis.com> wrote in message
news:Ob******** ******@tk2msftn gp13.phx.gbl...
> Why on earth would you want to do that? You're adding an unnecessary

layer
> of processing and file IO to accomplish the same thing. All a DSN
does is
> store information that you can put right into your Connection

String. In > addition, it uses ODBC, which is a wrapper for OLE DB, and using the
native
> SQL Data classes is much faster.
>
> --
> HTH,
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "Mike" <an*******@disc ussions.microso ft.com> wrote in message
> news:O5******** ******@TK2MSFTN GP12.phx.gbl...
> > In my code i'm pointing to a SQL server name and SQL database name on the
> > server, etc.
> > Instead of that how can i point to a DSN connection on the web server that
> > points to the SQL Server and DB?
> >
> >
> >
>
>



Nov 18 '05 #10

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

Similar topics

3
3938
by: G-Fit | last post by:
Hello group, I have several servers hosting SQL databases. On each of them, I have several databases. All those databases have the same structure (even those on different servers), only the data changes. I made a winforms application that allows me to manage those databases easily, and used several SqlDataAdapter to achieve this, all of them filling the same Dataset which has relations, and this Dataset being the DataSource of a...
11
2437
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a database through Connection.open() method, and I do not use Connection.close() method, will garbage collector collect the connection object just because i am not using it any more. 2) I am using a dataset, in which i make some modifications to the...
6
2344
by: Chris Szabo | last post by:
I've created a data access layer for a .NET web application. I'm using C# and framework 1.1. I'm getting an error from time to time when I close a connection saying: System.InvalidOperationException: A connection pooling error has occurred. It doesn't happen each time, the exception is thrown randomly. The big problem is that the connection is left active in the pool. After a short period of time, the pool is filled up and people...
18
3251
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection which must be closed first." As suggested, I was closing the connection in the Finally part of the outer Try but I wasn't closing the data reader as well so I assume that if the following happens, the above error could occur
35
11422
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing Then CType(cn, IDisposable).Dispose() End If I have to admit, I'm not sure what happens here. Will someone explain this line of code (the middle one, not the if statement LOL) to me please?
3
10298
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
20
3300
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how many connection has been used ? 2. If the maximum pool size has been reached, what happens when I call the method Open to open the connection ? Will I get an error ? MSDN says the request is queued, but will I get an error in the open method ? ...
3
4893
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable g_sConnectionString and leave this connection open and not close it until it exits the application. Then on each thread/each subsequent sub that needs the connection I create a local OleDBConnection variable, open the connection using the exact...
0
1982
by: Robert Avery | last post by:
In VBA/VB6, I had a class (incomplete sample below) that watched and displayed for the user all connection events, so that I could easily see what SQL was taking a long time, and when it freezes, I could see what is the SQL that freezes the program. I wanted to replicate this for VB.NET, but the SqlConnection object does not seem to support nearly as rich a set of events as the ADODB.Connection object. Any ideas where these events went,...
0
9498
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
10172
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9967
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
7517
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
6750
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.