2 Attachment(s)
HELP! Connect to database & export text file content to microsoft access database
Hi all,
I need some help:
1. How to connect to ms access?
2. How to export the content of text file to ms access database?
Now I already manage to read text file, just left other 2 steps. Anybody please help (provide me some example of codes if possible) because I really don't know how to do these.
package textfiles;
import java.io.IOException;
public class Dictionary {
public static void main(String[ ] args) throws IOException{
String file_name = "C:/Users/King/Desktop/Table A.txt";
try{
ReadFile file = new ReadFile( file_name );
String[ ] aryLines = file.OpenFile( );
int i;
for ( i=0; i < aryLines.length; i++ ) {
System.out.println( aryLines[ i ] ) ;
}
}
catch ( IOException e ) {
System.out.println( e.getMessage() );
}
}
}
Here I attached my Table A text file & screen shot of my database table. Thanks!
Re: HELP! Connect to database & export text file content to microsoft access database
This should get you started on connecting to a MS Access DB
http://www.codeproject.com/Articles/...ases-from-Java
As for importing (not exporting) I can't help you there but really you should try and learn the basics first, i.e. create your MS Access DB first and be able to read, insert, delete rows and run queries before you attempt to import data in directly, which is the more complicated way to do it.