I need to update a table using bulk update in Eclipse. The query is as follows:
BULK INSERT test_db.temp_accounts FROM 'test_file.txt' WITH (FIELDTERMINATOR = ' ', ROWTERMINATOR = '\n')
But the problem is, when I use this in Eclipse after connecting to database using JDBC connection, what I get is a syntax error.
Code snippet is below:
Connection c = DriverManager.getConnection(CONNECTION,p);
PreparedStatement stmt = c.prepareStatement("BULK INSERT test_db.temp_accounts FROM 'test_file.txt' WITH (FIELDTERMINATOR = ' ', ROWTERMINATOR = '\n')");
try
{
}catch (Exception e) {
e.printStackTrace();
}finally {
stmt.close();
c.close();
}
The file 'test_file.txt' is in the same directory as the java class file. Could somebody please point out the correct syntax here, thanks.