Closed shaggi7 closed 5 years ago
Why don't you use MySQL driver directly?
Hi, I was searching "Setting the DSN" to set up a datasource . Well now forget about it.
Why don't you use MySQL driver directly?
well i am now using MySQL/OTP (https://github.com/mysql-otp/mysql-otp) I downloaded it , coppied all file from it's SRC folder to ejabberd SRC folder, Compiled and installed.
But stll i am getting the error.
16:30:09.042 [info] >>>>>>>>>>>>>>>>>>>>>>>>>>>HERE is my MODULE<<<<<<<<<<<<<<<<<<<<<<<<<<<<
16:30:09.047 [critical] Internal error of module mod_search_users has occurred during start:
** Options: #{}
** exception error: undefined function mysql:start_link/1
in function mod_search_users:start/2 (src/mod_search_users.erl, line 16)
Its the piece of code where the error is coming.
start(_Host, _Opts) ->
?INFO_MSG(">>>>>>>>>>>>>>>>>>>>>>>>>>>HERE is my MODULE<<<<<<<<<<<<<<<<<<<<<<<<<<<<", []),
odbc:start(),
{ok, Ref} = mysql:start_link([{host, "localhost"}, {user, "ejabberd"}, {password, "9009"}, {database, ejabberd}]),
?INFO_MSG('Ref========================>',[Ref]),
%odbc:sql_query(Ref, "CREATE TABLE EMPLOYEE (FIRSTNAME char varying(20),
%LASTNAME char varying(20), AGE integer, SEX char(1), INCOME integer)"),
?INFO_MSG('Refs ==============>', [Ref]),
ok.
You don't need to compile or download anything, just do as written in the doc:
./configure --enable-mysql
How to access it. Like I want to perfoem some queries on the database. Right now I am using this code :
start(_Host, _Opts) ->
?INFO_MSG("My message!!!!", []),
?INFO_MSG("Hello, ejabberd world!", []),
{ok, Pid} = mysql:start_link([{host, "localhost"},{user, "root"},{password, "9009"}, {database, "ejabberd"}]),
?INFO_MSG("PID: ", [Pid]),
ok.
I want to get all users in user table.
You don't need to create a MySQL connection by hands, configure mysql in ejabberd.yml, then look into any module with _sql.erl
suffix for an example.
Hi, I am building a custom module to get all registerd user from a list of users . I am trying to coneect to database. ODBC are all set up as i am seeing the output of the following command:
Ejabberd compiling succesfully. But when running the Live command i am gettin the following errors:
What is wrong . please Help!!!!