Sunday 23rd of November 2008

DSN/DSNless ODBC Connection

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ... Posted on: April 3rd, 2008 by admin

Opening a database is straight forward. For the most part you only need to use the same code which i normally leave in an include directory.

ODBC/DSN Database Connection 

 var dbSub = new ActiveXObject(”ADODB.Connection”) ;
 dbSub.Open( “dsn=my_dsn_name;uid=my_name;pwd=my_password;”);

ODBC/DSNless Database Connection 

 var dbSub = new ActiveXObject(”ADODB.Connection”) ;
 dbSub.Open( “Driver={SQL Server};Server=srv\\myinst; Database=mydb;UID=me;PWD=mypw;”);

Using a DSNless connection is fine (and quicker) if you have one production/development environment. However, it is always a good idea to use DSN’s as the code doesent change if you move between databases. This is all taken care of by the system administrator.

    Related posts

Leave a Reply

You must be logged in to post a comment.

Headlines

Feeds