Mercurial > hg > monetdb-java
comparison example/OnClientExample.java @ 609:6666a9c62460
Cosmetic changes
author | Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com> |
---|---|
date | Tue, 04 Jan 2022 14:44:30 +0100 (2022-01-04) |
parents | c462161504a3 |
children | 6aa38e8c0f2d |
comparison
equal
deleted
inserted
replaced
608:c462161504a3 | 609:6666a9c62460 |
---|---|
19 import java.nio.charset.Charset; | 19 import java.nio.charset.Charset; |
20 import java.nio.charset.StandardCharsets; | 20 import java.nio.charset.StandardCharsets; |
21 import java.nio.file.FileSystems; | 21 import java.nio.file.FileSystems; |
22 import java.nio.file.Files; | 22 import java.nio.file.Files; |
23 import java.nio.file.Path; | 23 import java.nio.file.Path; |
24 import java.sql.*; | 24 import java.sql.Connection; |
25 import java.sql.DriverManager; | |
26 import java.sql.ResultSet; | |
27 import java.sql.SQLException; | |
28 import java.sql.SQLNonTransientException; | |
29 import java.sql.Statement; | |
25 | 30 |
26 public class OnClientExample { | 31 public class OnClientExample { |
27 | 32 |
28 public static void main(String[] args) { | 33 public static void main(String[] args) { |
29 int status; | 34 int status; |
177 } | 182 } |
178 | 183 |
179 private void uploadFileData(MonetConnection.Upload handle, String name, boolean textMode, long linesToSkip) throws IOException { | 184 private void uploadFileData(MonetConnection.Upload handle, String name, boolean textMode, long linesToSkip) throws IOException { |
180 // Validate the path, demonstrating two ways of dealing with errors | 185 // Validate the path, demonstrating two ways of dealing with errors |
181 Path path = securelyResolvePath(name); | 186 Path path = securelyResolvePath(name); |
182 if (path == null || !Files.exists(path)) { | 187 if (path == null || !Files.exists(path)) { |
183 // This makes the COPY command fail but keeps the connection | 188 // This makes the COPY command fail but keeps the connection |
184 // alive. Can only be used if we haven't sent any data yet | 189 // alive. Can only be used if we haven't sent any data yet |
185 handle.sendError("Invalid path"); | 190 handle.sendError("Invalid path"); |
186 return; | 191 return; |
187 } | 192 } |