How to write Rowloader JAVA code to inject data from sample.csv
file into GenfireXD database.
Asked
Active
Viewed 96 times
2 Answers
1
The GemFireXD distribution includes a JDBCRowLoader source example. Look in the examples directory. In your case you will have to determine which field of your CSV you want to consider as primary keys, parse the CSV and return rows as needed.

Sunil Jigyasu
- 101
- 3
-
in JDBCRowLoader example source code, there is information about retreiving data from GemFireXD database....but we need to load data from csv file or database to GemFireXD through rowloader... Help on this @ Sunil Jigyasu.... Thanx in advance – nagarjuna Apr 21 '15 at 10:26
-
1As @markito suggested, the recommended way is to use the import_data* procedures. But if you insist on using the row loader, basically you need to implement the RowLoader interface as mentioned in the documentation. In the init() you could load the file from the file system and open an input stream (say a FileReader wrapped inside a BufferedReader). In getRow(), you could read a line from the CSV file, split by the delimiters, stuff the elements into a list and return. – Sunil Jigyasu Apr 22 '15 at 04:47
1
You can check IMPORT_DATA_EX and IMPORT_TABLE_EX procedures to load data into GemFireXD.
Since you mentioned csv format IMPORT_DATA_EX might be the recommend way to do it since you can also tweak the number of threads and constraints while loading the data. It's definitely one of the fastest ways to do it but please note that the csv file but be available from the node you're issuing the command.
You might also want to consider starting a peer member with host-data=false.

William Markito
- 65
- 1
- 6