[erlang-questions] odbc DBMS

Jan Jacobs hpjcon@REDACTED
Sat Apr 25 11:42:46 CEST 2009


Hi Rene,

Use the Erlang ODBC,  switching between DBs is easy, just change the 
connection string.
Look at  http://www.connectionstrings.com/ for the connection strings. 
See examples below:

SQL Server: ( MSSQL 2000, 2005 and 2008)
Str = "Driver={SQL 
Server};Server=JAN03;Database=TestDB;Uid=test;Pwd=testpassword;".
f(Ref), {ok,Ref} = (catch odbc:connect( Str, [{timeout, 75000}, 
{scrollable_cursors, off}] )).
{selected, ColList, ValueList} = (catch odbc:sql_query( Ref, "select * 
from tbl_system;", 45000 )).
odbc:disconnect( Ref ).

MySQL:
Str = "Driver={MySQL ODBC 3.51 
Driver};Server=JAN03;Port=3306;Database=TestDB;User=test;Password=testpassword;Option=3;".
f(Ref), {ok,Ref} = (catch odbc:connect( Str, [{timeout, 75000}, 
{scrollable_cursors, off}] )).
{selected, ColList, ValueList} = (catch odbc:sql_query( Ref, "select * 
from tbl_system;", 45000 )).
odbc:disconnect( Ref ).

Firebird:
Str = "Driver=Firebird/InterBase(r) 
driver;Uid=SYSDBA;Pwd=masterkey;DbName=C:\DeepBlue\TestDB.FDB".
f(Ref), {ok,Ref} = (catch odbc:connect( Str, [{timeout, 75000}, 
{scrollable_cursors, off}] )).
{selected, ColList, ValueList} = (catch odbc:sql_query( Ref, "select * 
from tbl_system;", 45000 )).
odbc:disconnect( Ref ).

Postgre:
Str = "Driver={PostgreSQL 
ANSI};Server=JAN03;Port=5432;Database=TestDB;Uid=test;Pwd=testpassword;".
f(Ref), {ok,Ref} = (catch odbc:connect( Str, [{timeout, 75000}, 
{scrollable_cursors, off}] )).
{selected, ColList, ValueList} = (catch odbc:sql_query( Ref, "select * 
from tbl_system;", 45000 )).
odbc:disconnect( Ref ).

I actively using SQL Server, MySQL,  Firebird.
I occasionally use Postgre  Oracle, Interbase, Access and Excel

Cheers
Jan

Rene Villalta Soto wrote:
>  
>  
>
> Hi I need some help , I have other problem now with Postgres
>
>
> {ok, Ref} = odbc:connect("Driver={SQL Server};Server=10.36.2.199;Port=3306;Database=testLazy;Uid=postgres;Pwd=postgres;", []).
> ** exception error: no match of right hand side value {error,
>                                                        "No SQL-driver information available. Connection to database failed."}
>
> and how I can conform connections strings  to others DBMS?
>
> greetings Rene
>
>
>
>  
>
>  
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list