code_junkie

Java code to import CSV into Access

Nov 10th, 2011
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Connection msConn = getDestinationConnection(mdbFilePath);
  2. try{
  3.  
  4. String strSQL = "SELECT * INTO " + accessTableName + " FROM [Text;HDR=YES;DATABASE=" + csvDirPath + ";].[" + csvFileName + "]";
  5. PreparedStatement selectPrepSt = msConn.prepareStatement(strSQL );
  6. boolean result = selectPrepSt.execute();
  7. System.out.println( "result = " + result );
  8.  
  9. } catch(Exception e) {
  10. System.out.println(e);
  11. } finally {
  12. msConn.close();
  13. }
Add Comment
Please, Sign In to add comment