java - Load data Query hive using file path in windows -


i trying load data in hive through java program. loading file machine.

stmt.executequery("load data local inpath  'file:///c:/sample/documents/sample1.txt'  table " + tablename); 

when execute program getting following exception

caused by: java.lang.runtimeexception: java.net.urisyntaxexception:expected scheme-specific part @ index 2: c:     @ java.net.uri$parser.fail(uri.java:2829)     @ java.net.uri$parser.failexpecting(uri.java:2835)     @ java.net.uri$parser.parse(uri.java:3038)     @ java.net.uri.<init>(uri.java:753) 

however when execute program in ubuntu machine

stmt.executequery("load data local inpath  '/home/sample/sample1.txt'  table " + tablename); 

the data loaded correctly hive database.

when execute program in windows getting exception. how can solve this?

path(uri) syntax in windows different ubuntu. in ubuntu use forward slash in windows use backslash.

windows: c:\users\system\desktop\db

linux: /home/sample/sample1.txt'

so try changing syntax of uri.


Comments