473,325 Members | 2,712 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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 1390
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*******@discussions.microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.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=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.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*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.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=(servername);database=issues ;Trusted_Connection=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*********@glenhelendealerseries.com> wrote in message
news:%2****************@TK2MSFTNGP10.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*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.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*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Here's my string

MyConnection = New
SqlConnection("server=(servername);database=issues ;Trusted_Connection=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*********@glenhelendealerseries.com> wrote in message
news:%2****************@TK2MSFTNGP10.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*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?
'Server=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
> news:O5**************@TK2MSFTNGP12.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*********@glenhelendealerseries.com> wrote in message
news:ev**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Here's my string

MyConnection = New

SqlConnection("server=(servername);database=issues ;Trusted_Connection=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*********@glenhelendealerseries.com> wrote in message
news:%2****************@TK2MSFTNGP10.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*******@discussions.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> why do want to do want? Setup a DSN or how i'm doing it now in the code? >
> 'Server=servername;Database=DBName"
>
> 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******@takempis.com> wrote in message
> news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
> > news:O5**************@TK2MSFTNGP12.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*******@discussions.microsoft.com> wrote in message
news:#w**************@TK2MSFTNGP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.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******@takempis.com> wrote in message
news:uo**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:#w**************@TK2MSFTNGP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the code?

'Server=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:O5**************@TK2MSFTNGP12.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*******@discussions.microsoft.com> wrote in message
news:OR**************@TK2MSFTNGP10.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******@takempis.com> wrote in message
news:uo**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
news:#w**************@TK2MSFTNGP09.phx.gbl...
why do want to do want? Setup a DSN or how i'm doing it now in the
code?
'Server=servername;Database=DBName"

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******@takempis.com> wrote in message
news:Ob**************@tk2msftngp13.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*******@discussions.microsoft.com> wrote in message
> news:O5**************@TK2MSFTNGP12.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
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...
11
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...
6
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: ...
18
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...
35
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...
3
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...
20
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...
3
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...
0
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.