我已经在我的计算机上创建了一个本地Postgres Db,从那里我也运行Matlab R2021b。我试图设置连接字符串以连接到我的数据库,但没有成功。下面是我尝试的方法(dbName =“myDbName”,user =“myUser”,passw =“myPassw”)
Settings:
datasource = "PostgreSQLDataSource";
dbname = "myDbName"; % = datasource
username = "postgres";
password = "admin";
server = "127.0.0.1"; % localhost; %'server' = 'hostname'
port = 5432;
vendor = "PostgreSQL";
drivertype = "native";
%drivertype = "jdbc";
driver = "C:\Program Files (x86)\PostgreSQL\pgJDBC\postgresql-42.5.1.jar"; % = "org.postgresql.Driver";
url = ['jdbc:postgresql://' server ':' num2str(port) '/' dbname];
%opts = databaseConnectionOptions(drivertype, vendor);
%status = testConnection(opts,"","")
Connection:
%conn = postgresql(dbname, username, password)
%conn = postgresql(datasource, username, password)
%conn = database(datasource, username, password)
%conn = database(dbname, username, password)
%conn = database(dbname, username, password, hostname, port)
%conn = database(dbname, username, password, driver, url)
这里有什么提示吗?谢谢你的好意…
1条答案
按热度按时间h9vpoimq1#