can you connect to the database from outside freeswitch? Using the isql command?
Try that first

Plus:
run odbcinst -j on my system, it shows me 3 files:
/usr/local/etc/odbc.ini
/usr/local/etc/odbcinst.ini
/root/.odbc.ini

When all these files are identical, i can successfully esatcblish the connection through my JS script

Please go through: http://www.unixodbc.org/odbcinst.html
--
Regards,
Gayatri Kulkarni

On Mon, Oct 20, 2008 at 12:28 PM, Baskar <yudha2008@gmail.com> wrote:
Hi,

When i load the mod_spidermonkey command i get all mod_spidermonkey loaded successfully 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 likefreeswitch@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


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org