Thank you for your reply.
I have to develop chatbot using remote database.
I want provided for users by real-time data
I was successful when I installed the Postgres database on the same PC and installed CS chatbot.
However, the remote Postgres database connection appears to be successful, but the result can not be retrieved
If you have a sample .top file, please share it.
=================================================================================================
Using Postgres as file server
Aside from using Postgres to store data for a chatbot to look up, one can also use
Postgres as a replacement for the local file system of the USERS directory. This
allows you to scale CS horizontally by having multiple CS servers all connecting
to a common Postgres DB machine so a user can be routed to any server. To do
this, on the ChatScript command line use:
pguser=“host = 129.22.22.24 port = 5432 user = postgres password = somepassword “
If host is omitted, it defaults to localhost. Localhost might not work as the name
of the host, in which case use 127.0.0.1 .
You do not specify the dbname. The system assumes you have a db named
users. If it doesn’t find it, it will try to open a root database named postgres.
If it can find that, it will then create the users db.
Obviously put the correct data for your postgres machine. CS will automatically
create a users database and a userfiles tables. Each user will get an entry in
the userfiles table. If Postgres is not available, the CS server will quit. Hopefully
you have an automatic restart cron job and it will be able to connect to Postgres
the next time.
Update 2017-10-04
You can now specify the name of the postgres db:
1
pguser=“dbname = mydb host = 129.22.22.24 port = 5432 user = postgres password = somepassword If the dbname is specified, the postgres module will not try to create a new
database or a userfiles table. If dbname is not specified, the postgres module
will provide its original behavior.
The postgres code uses the following parameter queries to read, insert, and
update a user record:
—read a user
SELECT file FROM userfiles WHERE userid = $1::varchar ;
—insert a user
INSERT INTO userfiles (file, userid) VALUES ($1::bytea, $2::varchar) ;
—update a user
UPDATE userfiles SET file = $1::bytea WHERE userid = $2::varchar ;
You can override these queries to support alternate schemas. However, the
postgres module assumes that any sql used to override the default queries will
use the same sequence of arguments. For example, assume you want to store
user data in a table named ‘randomusertable.’ The following parameters can be
used to override the default postgres SQL:
pguserread=SELECT userdata FROM randomusertable WHERE username=$1::varchar ;
pguserinsert=INSERT INTO randomusertable (userdata,username) VALUES ($1::bytea, $2::varchar) pguserupdate=UPDATE randomusertable SET userdata = $1::bytea WHERE username = $2::varchar ;
Note that the default and override queries use the same arguments in the same
order.
=================================================================================================
I would like to have a .top file that implements the above description.