[Freeswitch-users] ODBC through JS

Baskar yudha2008 at gmail.com
Sun Oct 19 23:58:15 PDT 2008


Hi,

When i load the mod_spidermonkey command i get all mod_spidermonkey loaded
successfully

freeswitch at hp30094686650.optimus.co.in>* load mod_spidermonkey*
2008-10-20 12:29:46 [CONSOLE] mod_spidermonkey.c:944 sm_load_file()
Successfully Loaded [/usr/local/freeswitch/mod/mod_spidermonkey_teletone.so]
2008-10-20 12:29:46 [CONSOLE] mod_spidermonkey.c:944 sm_load_file()
Successfully Loaded [/usr/local/freeswitch/mod/mod_spidermonkey_core_db.so]
2008-10-20 12:29:46 [CONSOLE] mod_spidermonkey.c:944 sm_load_file()
Successfully Loaded [/usr/local/freeswitch/mod/mod_spidermonkey_socket.so]
2008-10-20 12:29:46 [CONSOLE] mod_spidermonkey.c:944 sm_load_file()
Successfully Loaded [/usr/local/freeswitch/mod/mod_spidermonkey_odbc.so]
2008-10-20 12:29:46 [CONSOLE] switch_loadable_module.c:789
switch_loadable_module_load_file() Successfully Loaded [mod_spidermonkey]
2008-10-20 12:29:46 [NOTICE] switch_loadable_module.c:238
switch_loadable_module_process() Adding Application 'javascript'
2008-10-20 12:29:46 [NOTICE] switch_loadable_module.c:258
switch_loadable_module_process() Adding API Function 'jsrun'
2008-10-20 12:29:46 [NOTICE] switch_loadable_module.c:258
switch_loadable_module_process() Adding API Function 'jsapi'
API CALL [load(mod_spidermonkey)] output:
+OK

when i try to run a sample odbc code from freeswitch console like
freeswitch at hp30094686650.optimus.co.in>* jsrun odbc.js*
freeswitch at hp30094686650.optimus.co.in> API CALL [jsrun(odbc.js)] output:
OK

2008-10-20 12:29:50 [ERR] switch_odbc.c:160 switch_odbc_handle_connect()
STATE: IM002 CODE 0 ERROR: [unixODBC][Driver Manager]Data source name not
found, and no default driver specified

2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [NOTICE] odbc.js:1 console_log()
==============================
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:235 odbc_exec() Database
is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:266 odbc_num_rows()
Database is not connected!
2008-10-20 12:29:50 [ERR] mod_spidermonkey_odbc.c:314 odbc_next_row()
Database is not connected!
2008-10-20 12:29:50 [NOTICE] odbc.js:1 console_log()
==============================

*code is:*
use("ODBC");

var people = {};
people["authur"] = 30;
people["ford"] = 42;
people["trillian"] = 29;
people["zaphod"] = 304;
people["marvin"] = 1000001;


db = new ODBC("freeswitch", "optimus", "optimus");
db.connect();

db.exec("create table demo (name varchar(255), age varchar(80));");

for (var i in people) {
    sql = "insert into demo values('" + i + "', " + people[i] + ");";
    console_log("debug", sql + "\n");
    db.exec(sql);
}

sql = "select * from demo;";
var line = "==============================\n";

console_log("notice", line);

db.exec(sql);

console_log("debug", "row count: " + db.numRows() + "\n");

while(db.nextRow()) {
    var row = db.getData();

    for (var i in row) {
        console_log("debug", "[" + i + "] = [" + row[i] + "]\n");
    }

    console_log("debug", "\n");
}

console_log("notice", line);

what should i specify in DSN.here i gave freeswitch which is a database
name.please assist me to solve this problem

-- 
Warm Regards,
N.Baskar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20081020/6a5b8bb6/attachment-0002.html 


More information about the FreeSWITCH-users mailing list