Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JDBC and Microsoft Access

 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The statement

is giving me the error


The string is "INSERT INTO document_event (start,end) VALUES ('2015-12-15',NULL)" and it works fine when I use it directly in ACCESS. I am trying with Java 6, 7 and 8.
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to this the format for a date String uses # as a delimiter, not quotes.

Seems a bit obtuse to me, but oh well. I suspect it's down to how Access expects these things.

Couldn't you bind the date in? it looks like you;re concatenating a query together, which is normally a mistake.
 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your help. The application had been using the code with "'" for years; who knows when this changed.
 
Tim Holloway
Saloon Keeper
Posts: 18365
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:it looks like you;re concatenating a query together, which is normally a mistake grave security error.


Fixed it.

Incidentally, you DON'T want to use MS Access as your database for web applications. Web applications are inherently multi-user and Access doesn't have the data integrity interlocks needed to keep multiple concurrent users from potentially corrupting the database.

For a webapp, consider SQL Server, MySQL or one of the many other server-based DBMS's. Anything that uses the JDBC-ODBC bridge isn't safe for web use.
 
Tushar Goel
Ranch Hand
Posts: 927
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim, I am not database guy but just wondering about this:

Anything that uses the JDBC-ODBC bridge isn't safe for web use.

That means we should not use JDBC in web apps. I have learnt to access database using JDBC only. Do you mean we have to use
other approaches like Hibernet or others things?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
He did not say not to use JDBC. Please read his reply again.
 
Tushar Goel
Ranch Hand
Posts: 927
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. He is talking about JDBC-ODBC which is different layer..
 
Dave Tolls
Ranch Hand
Posts: 2103
15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:
Dave Tolls wrote:it looks like you;re concatenating a query together, which is normally a mistake grave security error.


Fixed it.




Tim Holloway wrote:
Anything that uses the JDBC-ODBC bridge isn't safe for web use.


UCanAccess isn't JDBC-ODBC.
But other than that, yes, Access really won't be happy.
In fact, according to the UCanAccess site, under "Limitations":
"
Poor multiprocess access support. Nevertheless it tries to synchronize data when a concurrent process modifies the access file.
"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic