首页 > 解决方案 > 从命令行/批处理在 SQL Workbench/j 中设置和保存连接配置文件

问题描述

使用指南https://www.sql-workbench.eu/manual/commandline.html#commandline-connect-noprofile
设置为配置文件并保存配置文件以供将来使用。
这可以通过“7.2. 管理配置文件组”手动操作 https://www.sql-workbench.eu/manual/profiles.html#profile-workbench-settings

是否可以通过命令行保存配置文件?

SQLWorkbench64.exe -username=user -password=pass -url=jdbc.. -driver=Redshift driverJar=filepath

标签: sqlbatch-filesql-workbench-j

解决方案


对此没有直接的支持。

但是您可以使用WbStoreProfile命令将当前活动的连接存储为配置文件。

您可以通过-command参数执行此操作。

SQLWorkbench64.exe  -command="WbStoreProfile -name=test" -username=user -password=pass -url=jdbc.. -driver=Redshift driverJar=filepath

这将连接到数据库,然后运行WbStoreProfile命令并再次退出。

配置文件将以名称“test”保存在wb-profiles.properties.

但是wb-profiles.properties手动编辑可能更容易。


推荐阅读