フィルターのクリア

Setting up of Port forwarding to PostgreSQL from MATLAB

1 回表示 (過去 30 日間)
Manoj
Manoj 2023 年 1 月 13 日
コメント済み: Manoj 2023 年 2 月 8 日
Hi,
I have a MATLAB script that I used to run by connecting to the postgres database that is hosted on the server(Openshift).
I used to do port forwarding using database toolbox and hardcode the port number (see below 60733) in the MATLAB script each time to connect to the database
I'd like to automate this process so that when I open MATLAB I can directly run the script without having to generate the port manually all the timet. Is there any way to automare this DB connection ?
Note : I'm using Openshift PostgreSQL databse server hence I need to port forward from my machine to connect to this server
I have used database toolbox to connect the server DB using below credentials
databasename = 'employeedb';
username = 'user';
password = 'user123';
driver = 'org.postgresql.Driver';
url = 'jdbc:postgresql://localhost:60733/employeedb';
conn = database(databasename,username,password,driver,url);
countSqlquery = "SELECT COUNT(*) as count_pet FROM employees";
rowCount = select(conn,countSqlquery);
  2 件のコメント
Luca Ferro
Luca Ferro 2023 年 2 月 8 日
what do you mean by generate the port?
Manoj
Manoj 2023 年 2 月 8 日
To connect to a database hosted on server, there's a port number that we use. This is generated manually when the connection is established

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDatabase Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by