When using @export the columns I've renamed within the select statement revert back to the actual column names of the table, and not the custom values I'm setting. e.g.
@export on; @export set filename="C:\file.json" format="json"; SELECT DOCUMENT_ID as "documentId" FROM TABLE_NAME; @export off;
The exported results show "DOCUMENT_ID" as the column, not "documentId".
If I remove the @export annotations, the grid shows the custom column names (documentId). Is this a limitation with @export where custom column names cannot be set?
Best Answer
H
Hans Bergsten
said
over 7 years ago
Hi Justin,
I've tested with DB2 9.1 (I don't have access to 9.5) and the bundled JDBC driver (4.22.29).
By default, I get the column name as the grid header even when I specify an alias for a column. I need to set the useJDBC4ColumnNameAndLabelSemantics driver property to false in order to get the alias as the grid header.
When I use @export with the JSON format, I always get the same value as the grid header, i.e. either the column name or the alias depending on the value of the driver property.
Are you using a different JDBC driver version? Do you specify any driver properties?
If this doesn't help, please open Tools->Debug Window and enable debugging for DbVisualizer run the @export again. Then open Help->Contact Support to send a support request, making sure that Attach Logs is enabled. This way we get more info to help figure out what may be wrong.
It works for me with a Sybase ASE 16 database. Which database do you use?
Best Regards,
Hans
J
Justin Rigby
said
over 7 years ago
Thanks for the reply Hans.
We're using DB2 v9.5. The column names are adjusted just fine in the grid view, but when using @export they are the defaults that I'm trying to rename.
Hans Bergsten
said
over 7 years ago
Answer
Hi Justin,
I've tested with DB2 9.1 (I don't have access to 9.5) and the bundled JDBC driver (4.22.29).
By default, I get the column name as the grid header even when I specify an alias for a column. I need to set the useJDBC4ColumnNameAndLabelSemantics driver property to false in order to get the alias as the grid header.
When I use @export with the JSON format, I always get the same value as the grid header, i.e. either the column name or the alias depending on the value of the driver property.
Are you using a different JDBC driver version? Do you specify any driver properties?
If this doesn't help, please open Tools->Debug Window and enable debugging for DbVisualizer run the @export again. Then open Help->Contact Support to send a support request, making sure that Attach Logs is enabled. This way we get more info to help figure out what may be wrong.
Best Regards,
Hans
J
Justin Rigby
said
over 7 years ago
Hans,
Updating the useJDBC4ColumnNameAndLabelSemantics driver property to false did the trick for me, even though the grid was already showing the alias names. I wouldn't have figured that out in a hundred years otherwise, so thank you!
Justin
Roger Bjärevall
said
over 7 years ago
Justin,
Just to let you know there will be the new JSONColumnHeaderIsColumnAlias="<true/false>" parameter for @export set in the upcoming 10.0 version. You then don't need to set the useJDBC4ColumnNameAndLabelSemantics driver property.
Regards
Roger
Roger Bjärevall
said
over 7 years ago
Justin,
We just released DbVisualizer 100.2718, a beta version of the upcoming 10.0. It includes support for the new JSONColumnHeaderIsColumnAlias setting.
Use Help->Check for Update in DbVisualizer to install the new version or visit the download page on our web. The Check for Update will also indicate whether 10.0 is a free upgrade.
Justin Rigby
When using @export the columns I've renamed within the select statement revert back to the actual column names of the table, and not the custom values I'm setting. e.g.
@export on;
@export set filename="C:\file.json" format="json";
SELECT DOCUMENT_ID as "documentId"
FROM TABLE_NAME;
@export off;
The exported results show "DOCUMENT_ID" as the column, not "documentId".
If I remove the @export annotations, the grid shows the custom column names (documentId). Is this a limitation with @export where custom column names cannot be set?
Hi Justin,
I've tested with DB2 9.1 (I don't have access to 9.5) and the bundled JDBC driver (4.22.29).
By default, I get the column name as the grid header even when I specify an alias for a column. I need to set the useJDBC4ColumnNameAndLabelSemantics driver property to false in order to get the alias as the grid header.
When I use @export with the JSON format, I always get the same value as the grid header, i.e. either the column name or the alias depending on the value of the driver property.
Are you using a different JDBC driver version? Do you specify any driver properties?
If this doesn't help, please open Tools->Debug Window and enable debugging for DbVisualizer run the @export again. Then open Help->Contact Support to send a support request, making sure that Attach Logs is enabled. This way we get more info to help figure out what may be wrong.
Best Regards,
Hans
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstHans Bergsten
Hi Justin,
It works for me with a Sybase ASE 16 database. Which database do you use?
Best Regards,
Hans
Justin Rigby
Thanks for the reply Hans.
We're using DB2 v9.5. The column names are adjusted just fine in the grid view, but when using @export they are the defaults that I'm trying to rename.
Hans Bergsten
Hi Justin,
I've tested with DB2 9.1 (I don't have access to 9.5) and the bundled JDBC driver (4.22.29).
By default, I get the column name as the grid header even when I specify an alias for a column. I need to set the useJDBC4ColumnNameAndLabelSemantics driver property to false in order to get the alias as the grid header.
When I use @export with the JSON format, I always get the same value as the grid header, i.e. either the column name or the alias depending on the value of the driver property.
Are you using a different JDBC driver version? Do you specify any driver properties?
If this doesn't help, please open Tools->Debug Window and enable debugging for DbVisualizer run the @export again. Then open Help->Contact Support to send a support request, making sure that Attach Logs is enabled. This way we get more info to help figure out what may be wrong.
Best Regards,
Hans
Justin Rigby
Hans,
Updating the useJDBC4ColumnNameAndLabelSemantics driver property to false did the trick for me, even though the grid was already showing the alias names. I wouldn't have figured that out in a hundred years otherwise, so thank you!
Justin
Roger Bjärevall
Justin,
Just to let you know there will be the new JSONColumnHeaderIsColumnAlias="<true/false>" parameter for @export set in the upcoming 10.0 version. You then don't need to set the useJDBC4ColumnNameAndLabelSemantics driver property.
Regards
Roger
Roger Bjärevall
Justin,
We just released DbVisualizer 100.2718, a beta version of the upcoming 10.0. It includes support for the new JSONColumnHeaderIsColumnAlias setting.
You may give the beta a try by download here: http://www.dbvis.com/download/beta/
Regards
Roger
Roger Bjärevall
Justin,
Use Help->Check for Update in DbVisualizer to install the new version or visit the download page on our web. The Check for Update will also indicate whether 10.0 is a free upgrade.
Regards
Roger
-
Forward Engineering
-
DB2 Database Connection Dropping every 20-30mins or so ?
-
roles are not unfolded
-
Install4j: Java(Tm) VM could not be started
-
Worksheet name default when exporting to Excel?
-
sqlformatter and extract
-
Bug with empty password
-
dbvis 5.0 gives error after opening
-
Saving file makes it incompatible with other SQL tools!!!?!?!?!?
-
Error Schema Name in References view.
See all 1317 topics