csv-to-db
is a Java-based utility that automates the process of reading CSV files from a specified directory, creating corresponding tables in a PostgreSQL database, and uploading the data into these tables. This project streamlines the data migration process and ensures that data stored in CSV format can be easily transferred to a structured database system.
- Automated CSV Reading: Batch reads multiple CSV files from a designated folder.
- Dynamic Table Creation: Generates a new table for each CSV file with text data type.
- Data Upload: Efficiently uploads CSV data into the PostgreSQL database tables.
- Error Handling: Provides robust error handling during the read and upload processes.
- Java JDK 22
- PostgreSQL Database
- Maven (for building and managing the project)
- Clone the repository: git clone https://github.com/rgsharma745/csv-to-db.git
- Navigate to the project directory: cd csv-to-db
- Build the project with Maven:
- mvn clean install
- Update the
application.properties
file with your PostgreSQL database credentials and the path to the CSV directory. - Run the application: java -jar target/csv-to-db-1.0.0.jar
The application.properties
file contains the following configurations:
csv.folder.path
: The path to the folder containing the CSV files.spring.datasource.url
: The JDBC URL of the PostgreSQL database.spring.datasource.jdbcUrl
: The JDBC URL of the PostgreSQL database.spring.datasource.username
: The username for the database.spring.datasource.password
: The password for the database.
Contributions are welcome! Please feel free to submit pull requests or create issues for bugs and feature requests.
This project is open source and available under the MIT License.