Mark Foley - 2016-04-07

I am logging jdbc output in java using DriverManager.setLogWriter(PrintWriter). This works, but I get a unicode hex-dump of messages. Here is an example of running a query using the Microsoft sqljdbc4.2 driver:

SQLWarning: reason(Changed database context to 'master'.) SQLState(S0001) vendor code(5701)
SQLWarning: reason(Updating [dbo].[spt_fallback_db]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 0 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [dbo].[spt_fallback_dev]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 0 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [dbo].[spt_fallback_usg]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 0 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[queue_messages_1003150619]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [queue_clustered_index], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [queue_secondary_index], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[queue_messages_1035150733]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [queue_clustered_index], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [queue_secondary_index], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[queue_messages_1067150847]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [queue_clustered_index], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [queue_secondary_index], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[syscommittab]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [ci_commit_ts], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [si_xdes_id], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[sqlagent_jobs]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [sqlagent_jobs_clust], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [sqlagent_jobs_nc1_name], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[sqlagent_jobsteps]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [sqlagent_jobsteps_clust], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [sqlagent_jobsteps_nc1], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [sqlagent_jobsteps_nc2], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 3 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[sqlagent_job_history]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [sqlagent_job_history_clust], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    [sqlagent_job_history_nc1], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [sys].[sqlagent_jobsteps_logs]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [sqlagent_jobsteps_logs_nc1], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 1 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [dbo].[spt_monitor]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 0 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Updating [dbo].[MSreplication_options]) SQLState(S0001) vendor code(15650)
SQLWarning: reason(    [_WA_Sys_00000001_6A85CC04], update is not necessary...) SQLState(S0001) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 1 did not require update.) SQLState(S0001) vendor code(15651)
SQLWarning: reason( ) SQLState(S0001) vendor code(0)
SQLWarning: reason(Statistics for all tables have been updated.) SQLState(S0001) vendor code(15005)
SQLState(null) vendor code(0)

And here is an example of the same query using jtds 1.3.1 (partial listing since the dumps make it over 900+ lines):

SQLWarning: reason(Updating [sys].[sqlagent_jobsteps]) SQLState(01000) vendor code(15650)
SQLWarning: reason(    [sqlagent_jobsteps_clust], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    [sqlagent_jobsteps_nc1], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    [sqlagent_jobsteps_nc2], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 3 did not require update.) SQLState(01000) vendor code(15651)
SQLWarning: reason( ) SQLState(null) vendor code(0)
SQLWarning: reason(Updating [sys].[sqlagent_job_history]) SQLState(01000) vendor code(15650)
SQLWarning: reason(    [sqlagent_job_history_clust], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    [sqlagent_job_history_nc1], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 2 did not require update.) SQLState(01000) vendor code(15651)
SQLWarning: reason( ) SQLState(null) vendor code(0)
SQLWarning: reason(Updating [sys].[sqlagent_jobsteps_logs]) SQLState(01000) vendor code(15650)
SQLWarning: reason(    [sqlagent_jobsteps_logs_nc1], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 1 did not require update.) SQLState(01000) vendor code(15651)
SQLWarning: reason( ) SQLState(null) vendor code(0)
SQLWarning: reason(Updating [dbo].[spt_monitor]) SQLState(01000) vendor code(15650)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 0 did not require update.) SQLState(01000) vendor code(15651)
SQLWarning: reason( ) SQLState(null) vendor code(0)
----- Stream #2 read last Reply packet

   0: 04 01 04 04 00 3D 04 00 69 00 63 00 61 00 74 00 |     =  i c a t |
  16: 69 00 6F 00 6E 00 5F 00 6F 00 70 00 74 00 69 00 |i o n _ o p t i |
  32: 6F 00 6E 00 73 00 5D 00 14 44 00 42 00 53 00 45 |o n s ]  D B S E|
  48: 00 52 00 56 00 45 00 52 00 5C 00 4D 00 45 00 4D | R V E R \ M E M|
  64: 00 42 00 45 00 52 00 53 00 4C 00 49 00 4E 00 4B | B E R S L I N K|
  80: 00 0E 73 00 70 00 5F 00 75 00 70 00 64 00 61 00 |  s p _ u p d a |
  96: 74 00 65 00 73 00 74 00 61 00 74 00 73 00 5B 00 |t e s t a t s [ |
 112: FF 01 00 F6 00 00 00 00 00 FF 11 00 C1 00 01 00 |                |
 128: 00 00 FF 01 00 C0 00 00 00 00 00 FF 01 00 C1 00 |                |
 144: 00 00 00 00 FF 01 00 20 00 00 00 00 00 FF 01 00 |                |
 160: C1 00 00 00 00 00 FF 01 00 C0 00 00 00 00 00 FF |                |
 176: 01 00 C0 00 00 00 00 00 FF 11 00 C1 00 01 00 00 |                |
 192: 00 FF 11 00 C1 00 01 00 00 00 FF 11 00 C1 00 01 |                |
 208: 00 00 00 FF 01 00 C0 00 00 00 00 00 AB C6 00 25 |               %|
 224: 3D 00 00 01 00 3B 00 20 00 20 00 20 00 20 00 5B |=    ;         [|
 240: 00 5F 00 57 00 41 00 5F 00 53 00 79 00 73 00 5F | _ W A _ S y s _|
 256: 00 30 00 30 00 30 00 30 00 30 00 30 00 30 00 31 | 0 0 0 0 0 0 0 1|
 272: 00 5F 00 36 00 41 00 38 00 35 00 43 00 43 00 30 | _ 6 A 8 5 C C 0|
 288: 00 34 00 5D 00 2C 00 20 00 75 00 70 00 64 00 61 | 4 ] ,   u p d a|
 304: 00 74 00 65 00 20 00 69 00 73 00 20 00 6E 00 6F | t e   i s   n o|
 320: 00 74 00 20 00 6E 00 65 00 63 00 65 00 73 00 73 | t   n e c e s s|
 336: 00 61 00 72 00 79 00 2E 00 2E 00 2E 00 14 44 00 | a r y . . .  D |
 352: 42 00 53 00 45 00 52 00 56 00 45 00 52 00 5C 00 |B S E R V E R \ |
 368: 4D 00 45 00 4D 00 42 00 45 00 52 00 53 00 4C 00 |M E M B E R S L |
 384: 49 00 4E 00 4B 00 0E 73 00 70 00 5F 00 75 00 70 |I N K  s p _ u p|
 400: 00 64 00 61 00 74 00 65 00 73 00 74 00 61 00 74 | d a t e s t a t|
 416: 00 73 00 AF 00 FF 01 00 F6 00 00 00 00 00 FF 11 | s              |
 432: 00 C1 00 01 00 00 00 FF 01 00 C1 00 00 00 00 00 |                |
 448: FF 01 00 C0 00 00 00 00 00 AB E2 00 23 3D 00 00 |            #=  |
 464: 01 00 49 00 20 00 20 00 20 00 20 00 30 00 20 00 |  I         0   |
 480: 69 00 6E 00 64 00 65 00 78 00 28 00 65 00 73 00 |i n d e x ( e s |
 496: 29 00 2F 00 73 00 74 00 61 00 74 00 69 00 73 00 |) / s t a t i s |
 512: 74 00 69 00 63 00 28 00 73 00 29 00 20 00 68 00 |t i c ( s )   h |
 528: 61 00 76 00 65 00 20 00 62 00 65 00 65 00 6E 00 |a v e   b e e n |
 544: 20 00 75 00 70 00 64 00 61 00 74 00 65 00 64 00 |  u p d a t e d |
 560: 2C 00 20 00 31 00 20 00 64 00 69 00 64 00 20 00 |,   1   d i d   |
 576: 6E 00 6F 00 74 00 20 00 72 00 65 00 71 00 75 00 |n o t   r e q u |
 592: 69 00 72 00 65 00 20 00 75 00 70 00 64 00 61 00 |i r e   u p d a |
 608: 74 00 65 00 2E 00 14 44 00 42 00 53 00 45 00 52 |t e .  D B S E R|
 624: 00 56 00 45 00 52 00 5C 00 4D 00 45 00 4D 00 42 | V E R \ M E M B|
 640: 00 45 00 52 00 53 00 4C 00 49 00 4E 00 4B 00 0E | E R S L I N K  |
 656: 73 00 70 00 5F 00 75 00 70 00 64 00 61 00 74 00 |s p _ u p d a t |
 672: 65 00 73 00 74 00 61 00 74 00 73 00 B5 00 FF 01 |e s t a t s     |
 688: 00 F6 00 00 00 00 00 FF 01 00 2C 00 00 00 00 00 |          ,     |
 704: AB 52 00 00 00 00 00 01 00 01 00 20 00 14 44 00 | R            D |
 720: 42 00 53 00 45 00 52 00 56 00 45 00 52 00 5C 00 |B S E R V E R \ |
 736: 4D 00 45 00 4D 00 42 00 45 00 52 00 53 00 4C 00 |M E M B E R S L |
 752: 49 00 4E 00 4B 00 0E 73 00 70 00 5F 00 75 00 70 |I N K  s p _ u p|
 768: 00 64 00 61 00 74 00 65 00 73 00 74 00 61 00 74 | d a t e s t a t|
 784: 00 73 00 BA 00 FF 01 00 F7 00 00 00 00 00 FF 01 | s              |
 800: 00 C1 00 00 00 00 00 FF 01 00 C0 00 00 00 00 00 |                |
 816: AB A8 00 9D 3A 00 00 01 00 2C 00 53 00 74 00 61 |    :    , S t a|
 832: 00 74 00 69 00 73 00 74 00 69 00 63 00 73 00 20 | t i s t i c s  |
 848: 00 66 00 6F 00 72 00 20 00 61 00 6C 00 6C 00 20 | f o r   a l l  |
 864: 00 74 00 61 00 62 00 6C 00 65 00 73 00 20 00 68 | t a b l e s   h|
 880: 00 61 00 76 00 65 00 20 00 62 00 65 00 65 00 6E | a v e   b e e n|
 896: 00 20 00 75 00 70 00 64 00 61 00 74 00 65 00 64 |   u p d a t e d|
 912: 00 2E 00 14 44 00 42 00 53 00 45 00 52 00 56 00 | .  D B S E R V |
 928: 45 00 52 00 5C 00 4D 00 45 00 4D 00 42 00 45 00 |E R \ M E M B E |
 944: 52 00 53 00 4C 00 49 00 4E 00 4B 00 0E 73 00 70 |R S L I N K  s p|
 960: 00 5F 00 75 00 70 00 64 00 61 00 74 00 65 00 73 | _ u p d a t e s|
 976: 00 74 00 61 00 74 00 73 00 BD 00 FF 01 00 F6 00 | t a t s        |
 992: 00 00 00 00 FF 01 00 2C 00 00 00 00 00 FF 11 00 |       ,        |
1008: C1 00 01 00 00 00 79 00 00 00 00 FE 00 00 E0 00 |      y         |
1024: 00 00 00 00                                     |    |

SQLWarning: reason(Updating [dbo].[MSreplication_options]) SQLState(01000) vendor code(15650)
SQLWarning: reason(    [_WA_Sys_00000001_6A85CC04], update is not necessary...) SQLState(01000) vendor code(15653)
SQLWarning: reason(    0 index(es)/statistic(s) have been updated, 1 did not require update.) SQLState(01000) vendor code(15651)
SQLWarning: reason( ) SQLState(null) vendor code(0)
SQLWarning: reason(Statistics for all tables have been updated.) SQLState(01000) vendor code(15005)

Is there a way to shut off these dumps? Some URL parameter perhaps?