Mercurial > hg > monetdb-java
comparison tests/SQLcopyinto.java @ 479:1c8b9aec43a6
Update usage text to the latest monetdb-jdbc-3.0.jre8.jar
author | Martin van Dinther <martin.van.dinther@monetdbsolutions.com> |
---|---|
date | Wed, 09 Jun 2021 20:28:56 +0200 (2021-06-09) |
parents | bf9f6b6ecf40 |
children | 6aa38e8c0f2d |
comparison
equal
deleted
inserted
replaced
478:e239f02fe8b6 | 479:1c8b9aec43a6 |
---|---|
26 | 26 |
27 public static void main(String[] args) throws Exception { | 27 public static void main(String[] args) throws Exception { |
28 System.out.println("SQLcopyinto started"); | 28 System.out.println("SQLcopyinto started"); |
29 if (args.length == 0) { | 29 if (args.length == 0) { |
30 System.err.println("Error: missing startup argument: the jdbc connection url !"); | 30 System.err.println("Error: missing startup argument: the jdbc connection url !"); |
31 System.err.println("Usage: java -cp monetdb-jdbc-2.29.jre7.jar:. SQLcopyinto \"jdbc:monetdb://localhost:50000/demo?user=monetdb&password=monetdb\""); | 31 System.err.println("Usage: java -cp monetdb-jdbc-3.0.jre8.jar:. SQLcopyinto \"jdbc:monetdb://localhost:50000/demo?user=monetdb&password=monetdb\""); |
32 System.exit(-1); | 32 System.exit(-1); |
33 } | 33 } |
34 String jdbc_url = args[0]; | 34 String jdbc_url = args[0]; |
35 | 35 |
36 // request a connection to MonetDB server via the driver manager | 36 // request a connection to MonetDB server via the driver manager |
116 // now write the row data values as csv data lines to the STDIN stream | 116 // now write the row data values as csv data lines to the STDIN stream |
117 for (int i = 0; i < 40; i++) { | 117 for (int i = 0; i < 40; i++) { |
118 mclOut.write("" + i + ",val_" + i); | 118 mclOut.write("" + i + ",val_" + i); |
119 mclOut.newLine(); | 119 mclOut.newLine(); |
120 } | 120 } |
121 | |
121 mclOut.writeLine(""); // need this one for synchronisation over flush() | 122 mclOut.writeLine(""); // need this one for synchronisation over flush() |
122 | |
123 error = mclIn.waitForPrompt(); | 123 error = mclIn.waitForPrompt(); |
124 if (error != null) | 124 if (error != null) |
125 System.err.println("Received error: " + error); | 125 System.err.println("Received error: " + error); |
126 | 126 |
127 mclOut.writeLine(""); // need this one for synchronisation over flush() | 127 mclOut.writeLine(""); // need this one for synchronisation over flush() |
128 | |
129 error = mclIn.waitForPrompt(); | 128 error = mclIn.waitForPrompt(); |
130 if (error != null) | 129 if (error != null) |
131 System.err.println("Received finish error: " + error); | 130 System.err.println("Received finish error: " + error); |
132 | 131 |
133 System.out.println("Completed sending data via STDIN"); | 132 System.out.println("Completed sending data via STDIN"); |
134 } catch (Exception e) { | 133 } catch (Exception e) { |
135 System.err.println("Mapi Exception: " + e.getMessage()); | 134 System.err.println("Mapi Exception: " + e.getMessage()); |
136 } finally { | 135 } finally { |
137 // close connection to MonetDB server | 136 // close MapiSocket connection to MonetDB server |
138 server.close(); | 137 server.close(); |
139 } | 138 } |
140 | 139 |
141 System.out.println("CopyInto STDIN end"); | 140 System.out.println("CopyInto STDIN end"); |
142 System.out.println(); | 141 System.out.println(); |