Data and sql script files are missing while using WbExport in command line

非 Y 不嫁゛ 提交于 2020-01-16 01:47:12

问题


I am facing one issue while running a sql script which contains WbExport (using Select statement) from command line. The txt file and import sql script is missing from the destination folder The command prompt displays that statements are executed but I think the select statement is not running when I execute the command.

Without using Select statement I am getting the required output files but column names are missing from the Import SQL script thats why I tried Select statement method in WbExport.

command:

java -jar sqlworkbench.jar -profile=New_profile -script=cmd_test.sql 

sql script(cmd_test.sql):

WbExport 
    -type=text
    -file='D:\Migration\CMD_TEST\employee.txt'
    -delimiter='~'
    -quotechar='^'
    -encoding=UTF8
    -quoteCharEscaping=duplicate
    -formatFile=postgres
    -header=true
    -decimal='.'
    -dateFormat='yyyy-MM-dd'
    -replaceExpression='(\n|\r\n)' -replaceWith='';
select * from ces_prj_raymond_poc.dbo.employee; ------------I think this statement is not executing.

Txt data file and import sql script for table


回答1:


This has been cross posted to the SQL Workbench/J support group

The problem is that the new Microsoft JDBC driver treats parameters to some JDBC API calls incorrectly and does not support wildcards any more. SQL Workbench/J escapes standard SQL wildcard characters before calling e.g. DatabaseMetaData.getColumns(). Apparently the Microsoft JDBC driver starting with version 7.4 does not use a LIKE statement anymore and thus the method call (using escaped wildcards) does not return anything.

Escaping wildcard characters can be disabled inside SQL Workbench/J by setting a configuration property. Either by editing workbench.settings manually and adding:

workbench.microsoft_sql_server.metadata.retrieval.wildcards=false

Before editing the file, make sure SQL Workbench/J is closed.


This can also be configured without restaring the application.

When being connected to a SQL Server database, this can also be done from within SQL Workbench/J by running the following Workbench command:

WbSetDBconfig metadata.retrieval.wildcards=false;


来源:https://stackoverflow.com/questions/58622804/data-and-sql-script-files-are-missing-while-using-wbexport-in-command-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!