[erlang-questions] gen_server and odbc problem about How to share a odbc connection
wenew zhang
wenewboy@REDACTED
Fri Mar 28 12:23:27 CET 2008
Dear All,
Maybe another low-level question,but it's make me confused,
init([]) ->
process_flag(trap_exit, true),
io:format("Authserver init with []~n"),
% {ok,Bin}=file:consult(?AUTHCONF),
% DDsn=element(2,lists:nth(1,Bin)),
% Duser=element(2,lists:nth(2,Bin)),
% Dpwd=element(2,lists:nth(3,Bin)),
%%Ddatabase=element(2,lists:nth(4,Bin)),
% DSNString="DSN="++DDsn++";UID="++Duser++";PWD="++Dpwd,
% {ok,Conn}=odbc:connect(DSNString,[{trace_driver,on}]),%% read the
odbc settings
{ok,Conn}=odbc:connect("DSN=flashpk;UID=flashpk;PWD=flashpk",[{trace_driver,on}]),
{ok,0}.
handle_info({?PLLOGIN,Uid,Pwd},_State) ->
io:format("PLLogin id:~w Uid:~w Pwd:~w~n",[?PLLOGIN,Uid,Pwd]),
odbc:sql_query(Conn,"insert into customer(cno,password) values
('root','123456')"),
{noreply, _State}.
i want share the Conn ,but i get the unbound error,
so How to share a odbc connection?
or anybody have other solutions?
Best Regards
wenew zhang
More information about the erlang-questions
mailing list