On 11-Feb-2002 Jeff Urlwin wrote:
>> What is the correct environment syntax to specify driver= instead of
>> DSN.  As you can see, we are all newbies.
>> Current Environment settings:
> 
> Actually, that's highly dependant upon your database server/connection
> libraries.
> 
> I'm not sure what SQLServer parameters you'll need on your system, that
> depends upon the actual driver.  Since you are probably using a "bridge"
> product to get to SQLServer, then it depends upon that.
> 
> I have an example for MS Access on Win32, but not other platforms.  When you
> figure it out, i'd be happy to put details like that in the DBD::ODBC pod
> documentation.
> 
> I'd also check, if you've setup a DSN, the values inside the odbc.ini, as
> that should have the information you need.
> 

One way to get what you need is to run some code using SQLBrowseConnect because
this has to return in the final OutConnectionString a string which can be used
to connect to the data source again. odbctest that comes with the MS ODBC SDK
does that. e.g. for MS SQL Server it goes something like this:

SQLDrivers - returns a driver list and we pick SQL Server.
SQLBrowseConnect("DRIVER=SQL Server;")
 returns
   
"SERVER:Server={servera,serverberb};UID:LoginID=?;PWD:Password=?;*APP:AppName=?;
*WSID:WorkStationID=?"

which means you need to pick a Server attribute, UID and PWD but APP and WSID
are optional. i.e. call SQLDriverConnect with:

"Driver=SQL Server;Server=servera;UID=dbusername;PWD=dbpassword;" and
optionally add WSID=xxx and APP=yyy.

<snipped most of Alex's mail except the errors in the make test>

>> > > DBI->connect(database=onetoone;host=64.78.148.124;port=1071)
>> > > failed: [iODBC][Driver Manager]Invalid string or buffer
>> length (SQL-S1090)

This happens because DBD::ODBC tries to use SQLDriverConnect first and if that
fails it uses SQLConnect. SQLConnect in the ODBC spec is defined as taking a
Server string (the first arg to SQLConnect) no longer than SQL_MAX_DSN_LENGTH
which is usually 32.

>> > > [iODBC][Driver Manager]Data source name not found and no default
>> > > driver specified. Driver could not be loaded (SQL-IM002)(DBD:
>> > > db_login/SQLConnect err=-1) at t/02simple.t line 13

You did not appear to specify a driver in the connect string. You need to
specify one of DSN=, DRIVER= or FILEDSN=.

Martin
--
Martin J. Evans
Easysoft Ltd, UK
Development

Reply via email to