[Freeswitch-dev] Trouble Accessing DB Table in C-module Via ODBC

Rupa Schomaker rupa at rupa.com
Wed Nov 17 09:00:48 PST 2010


I don't see how this is an ODBC issue.  Are you using the same user in your
module as with psql?  Have you tried the same query with isql (odbc equiv to
psql)?   Are you SURE you are connecting to the same db instance?

On Mon, Nov 15, 2010 at 2:01 PM, Jerry Richards
<jerry.richards at teotech.com>wrote:

> Hi Rupa,
>
>
>
> Yes, I'm using postgresql.  When I run the C-module using the schema.table
> format it gets this error:
>
>
>
> 2010-11-15 11:11:18.431977 [ERR] switch_core_sqldb.c:806 SQL ERR: [select
> sip_presence.status, sip_presence.rpid from ts_sofia_internal.sip_presence
> where sip_presence.sip_user='1003'] no such table:
> ts_sofia_internal.sip_presence
>
>
>
> If I execute the select statement from the psql command line, it works as
> shown:
>
>
>
> teo=# select sip_presence.status, sip_presence.rpid from
> ts_sofia_internal.sip_presence where sip_presence.sip_user='1003';
>
> status | rpid
>
> --------+------
>
> Away   | away
>
> (1 row)
>
>
>
> Could this have something to do with accessing the DB via ODBC?  Do you
> have another suggestion?
>
>
>
> I did try adding 'ts_sofia_internal' to the search path (i.e. set
> search_path to ucm, ts_sofia_internal), but it also did not work.
>
>
>
> Thanks,
>
> Jerry
>
>
>
>
>
>
>
> *From:* freeswitch-dev-bounces at lists.freeswitch.org [mailto:
> freeswitch-dev-bounces at lists.freeswitch.org] *On Behalf Of *Rupa Schomaker
> *Sent:* Monday, November 15, 2010 11:06 AM
> *To:* freeswitch-dev at lists.freeswitch.org
> *Subject:* Re: [Freeswitch-dev] Trouble Accessing DB Table in C-module Via
> ODBC
>
>
>
> What database engine?  That looks like postgresql.  If so, add the schema
> you are interested in working with into the search path or explicitly use
> the schema in your query.
>
>
>
> schema.function(args) rather than just function(args)
>
>
>
> You can set the search path using alter user ...
>
> On Mon, Nov 15, 2010 at 10:56 AM, Jerry Richards <
> jerry.richards at teotech.com> wrote:
>
> Hello,
>
>
>
> I need to access a database using two different schemas.  During
> initialization the default schema is set as follows:
>
>
>
> set schema 'ucm';
>
>
>
> Then later, I need to get data from a table in another schema
> 'ts_sofia_internal', so I tried the following, but it returns an error as
> shown:
>
>
>
> teo=# select * from sip_presence('ts_sofia_internal') where
> sip_presence.sip_user='1003';
>
> ERROR:  function sip_presence(unknown) does not exist
>
> LINE 1: select * from sip_presence('ts_sofia_internal') where sip_pr...
>
>                       ^
>
> HINT:  No function matches the given name and argument types. You might
> need to add explicit type casts.
>
> teo=#
>
>
>
> Does anyone know how I can do this?  By the way, I will actually implement
> the query in C and connect to the DB via ODBC.
>
>
>
> Thanks,
>
> Jerry
>
>
>
>
>
>
>
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>
>
>
> --
> -Rupa
>
> _______________________________________________
> FreeSWITCH-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org
>
>


-- 
-Rupa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-dev/attachments/20101117/0f6eb666/attachment-0001.html 


More information about the FreeSWITCH-dev mailing list