Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8350227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:15:09+00:00 2026-06-09T08:15:09+00:00

I am using Spring 3.1.2 and Hibernate 4.1.5_SP1. I am trying to import CSV

  • 0

I am using Spring 3.1.2 and Hibernate 4.1.5_SP1. I am trying to import CSV files into dynamically created Access files. The code looks similar to this:

    final SingleConnectionDataSource ds = new SingleConnectionDataSource();
    ds.setUrl(myBean.getMicrosoftAccessDriverUrl() + file.getAbsolutePath());
    final JdbcTemplate jdbcTemplate = new JdbcTemplate(ds);
    final String strSQL = "SELECT * INTO " + accessTableName + " FROM 
         [Text;HDR=YES;DATABASE=" + csvFile.getPath()+ ";].[" + 
         csvFile.getName() + "]";
    jdbcTemplate.execute(strSQL);
    ds.getConnection().close();

Which generates an error like:

 org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad 
 SQL grammar 
  [SELECT * INTO myTable 
  FROM [Text;HDR=YES;DATABASE=C:\somePath;].[myAccessFile.accdb]]; 
 nested exception is java.sql.SQLException: [Microsoft][ODBC Microsoft 
 Access Driver]  Cannot update. Database or object is read-only.

My Datasource URL is similar to:

jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\somePath\myAccessFile.accdb

I checked the files and they are NOT read-only. Any suggestions on how to solve this?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T08:15:10+00:00Added an answer on June 9, 2026 at 8:15 am

    The FROM clause does not look correct to me.

    SELECT * INTO myTable 
    FROM [Text;HDR=YES;DATABASE=C:\somePath;].[myAccessFile.accdb]
    

    I thought you intended to import from CSV into an Access table. If so, I think you should be using the CSV file name in place of the Access file (myAccessFile.accdb).

    SELECT * INTO myTable 
    FROM [Text;HDR=YES;DATABASE=C:\somePath;].[YourFile.csv]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Spring with Hibernate as a JPA provider and are trying to get
Using Hibernate 3.6.8.Final and Spring 3.0.5.RELEASE , I'm trying to add some Common DAO
I am trying to develop an application using Spring 2.5.5 Flex/J2EE and Hibernate 3.1.3.
We have created a spring web app. using: Spring 3.1.0 Hibernate 3.5.4 final tomcat
Running JBoss 4.2.3.GA and trying to deploy a WAR that is using Spring/Hibernate/JPA. I'm
I'm using spring(3.0.4.RELEASE) and hibernate (3.4.0.GA) and deploying into a glassfish (web_3.1) container. I
Im trying to create an application that access a sql server database using Spring,
I am working on an application using Spring 3 and Hibernate 3.5 with Java
I am using spring/hibernate stand alone application. if i dont configure Transactions i am
I'm using Spring and Hibernate. I'm uploading images using commons-fileupload-1.2.2 as follows. String itemName

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.