What is System DSN? how to use it in ASP for connecting to DATABASE
This article tells all about Data Source Name(DSN) DSN types uses.this also describes how to create a DSN to SQL server Database and make a connection to Database using this DSN in ASP.
DSN stands for Data Source Name.DSN is used for making a connection to a number of databases(Sql,mysql,Access,excel,Dbase,foxpro what not) using ODBC Driver
There are various types of DSN
These DSN differs in terms of
Where DSN info is being stored?
Who can Access that Particular DSN?
File DSN Access- Any user who has access to the File System. Storing Way-DSN information is stored In a text file with .DSN extension.
System DSN Access- Any user on that system. Storing Way- DSN information is stored in Local Machine Section of System Registry.
User DSN Access- Only for the user who created that Data Source. if that machine has more than one user you are logged in deifferent user than you cant see User DSN from this new account. Storing Way- DSN information is stored in current section of System Registry.
UDL (Universal Data Link) Access- Any user who has access to the File System. Storing Way-DSN information is stored In a file with .UDL extension.
DSN-less Access- Any one who has access to the database files (i.e. mdb,.xls) if it is Sql aerver then you must know username and password. Storing Way-connection information is not stored in file or registry you have to make a connection to your database from your code using connection string
Here we are trying to explain it by making a connection from our ASP program to a SQL Server using System DSN.
DSN should be created on the server where your Sqlserver Database is residing.
Steps to create a DSN for SQL server
1. GOTO 'Control Panel'.
2. Then GOTO 'Administration Tools'.
3. Then GOTO 'Data Sources ODBC'.
4. GOTO System DSN tab.
5. Click on Add.
6. 'Create A new Data Source' dialog Box appear Select a driver in this case SQl server and click finish.
7. 'Create a new data source to SQL' dialog box will appear.Give Name of DSN and select SQL server from list Click next.
8. in next screen you can provide which authintication you are going to use ie windows based or SQL Serevr based.
9. By using Sql server authorization all database will be listed in next screen if that user is authorised to do that.
Once your DSN is created you can access that Database through this DSN from our ASP Code.
in connection String we provided DSN name mydsn , username and password
Dim conn,rs
Set conn=Server.CreateObject("ADODB.Connection")
Set rs=Server.CreateObject("ADODB.RecordSet")
connect_string="DSN=mydsn;uid=abc;pwd=abc;"
conn.Open connect_string
dim query
query ="select emp_num,emp_name,dob where emp_status='A'"
set rs=conn.execute(query)
Happy Coding.
Nothing Found!
Why not submit your own content? Signup here.
-
Javascript functions for : trim, right trim, left trim, no Apostrophe, is Empty , is Digit , VarChar To Number , is integer , check Is Zero , Get Que | By xxris | in Programming
Javascript functions for : trim, right trim, left trim, no Apostrophe, is Empty , is Digit , VarChar To Number , i...
-
How to access and use a Window's command line | By MaxwellPayne | in Programming
Learn about the Window's command line in DOS and how to use it....
-
How to Learn to Program Your Computer | By dsj8760 | in Programming
This article is about learning to program a computer. It is a general article giving tips on how to learn about pro...
-
Jailbroken iPhones get RickRolled | By explorer | in Programming
First iPhone worm, attacks via SSH and does the classic rick roll gag on the user....
-
iPhone Core Data Tutorial Part 2 | By eh9212 | in Programming
How to use relationships between entities, edit attributes, and insert images into a database....
-
Howto use QueryString in ASP.NET for passing info between pages | By rajeshchoudhary | in Web Development
The QueryString in ASP.NET is used to pass information between pages....
-
Custom error pages in asp.net using configuration file | By rajeshchoudhary | in Web Development
In ASP.NET you can handle page level errors using OnError method of page object or Application level errors using A...
-
Using remote desktop in windows XP | By rajeshchoudhary | in Computers
if you want to connect to a machine remotly using Remote Desktop Connection, remote Desktop in target machine needs...
-
setting password wisely for your accounts | By rajeshchoudhary | in Computers
Incidents of information phishing and hacking are happening every now and then. One fine day morning you wake up to...
-
Web.config –configuration file for ASP.NET web application. | By rajeshchoudhary | in Web Development
This article tells what web.config file is, how to write this and how this file is used by run time to apply settin...







No comments yet.