Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 289
  • Last Modified:

DSN less to connect to MS SQL in Win32ODBC

use Win32::DBIODBC;
use Win32::ADO;
use Win32::OLE;


$cmd = Win32::OLE->new( "ADODB.Command");
$con = Win32::OLE->new("ADODB.Connection");
$rs = Win32::OLE->new("ADODB.Recordset");

$con->Open("DSN=Test;UID=sa;PWD=;DBNAME=fse_sideA");


Above is the way that I connect to the MS SQL Server thru
DSN. My question is how can I use DSN less to connect ?
0
idontknow12002
Asked:
idontknow12002
  • 2
1 Solution
 
clockwatcherCommented:
Try:

$con->Open("Provider=SQLOLEDB;Data Source=SQLSERVERNAME;Initial Catalog=fse_sideA;UID=sa;PWD=;");

where SQLSERVERNAME is the name of your SQL server.
0
 
idontknow12002Author Commented:
what is Initial Catalog ?
0
 
clockwatcherCommented:
Initial Catalog specifies the database within your SQL server that you want to use.
0
 
jmcgOwnerCommented:
Nothing has happened on this question in over 12 months.
I will leave a recommendation in the Cleanup topic area that
the answer by clockwatcher be accepted.

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

jmcg
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now