[erlang-questions] ODBC driver

Robert Raschke <>
Sat Jan 17 16:25:35 CET 2009


On Fri, Jan 16, 2009 at 7:11 PM, Jose Enrique Benitez Jimenez
<> wrote:
> Hi,
>
> I want to connect to an SQL database, I receive the follow error
>
> 7> odbc:start().
> ok
> 8> odbc:connect("DNS:localhost",[]).
> {error,"No SQL-driver information available. Connection to database failed."}
>
>
> SQL server 2000 is already intalled, Do I need the ODBC driver or SQL server 2000 have it ?, in the first case, how can i get it??
> (I'm using Windows XP)
>

You have to specifiy an ODBC DSN. Either you have already set up one
using Start ->Administrative Tools -> Data Sources (ODBC), in which
case to say something along the lines of

odbc:connect("DSN=DataSourceName;UID=login;PWD=password",
[{scrollable_cursors, off}]).

Or you know the driver, server, database, etc, then you can specifiy
the DSN as a connection string (see for example
http://www.connectionstrings.com/sql-server#7 ) like this:

odbc:connect("Driver={SQL
Server};Server=localhost;Database=database;UID=login;PWD=password",
[{scrollable_cursors, off}]).

I always set scrollable cursors off, since so many odbc drivers don't
appear to support that feature,

Robby



More information about the erlang-questions mailing list