Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / June 2005

Tip: Looking for answers? Try searching our database.

JDBC and Access

Thread view: 
Sharp Tool - 13 Jun 2005 11:12 GMT
Hi

I have a strange problem with JDBC and Access.
Im trying to create a table and insert values into it,
but i'm getting an error saying it doesn't like the syntax, and is "expected
1".

for example:

s.execute("create table tblTest(id text, description memo)");
s.execute("insert into tblTest values(123,123)"); //works fine
s.execute("insert into tblTest values(AB123,123)"); //does not work

even tried:
s.execute("insert into tblTest values("AB123",123)"); // still does not work

please help on this strange problem.

Cheers
Sharp tool
Bjorn Abelli - 13 Jun 2005 14:09 GMT
"Sharp Tool" wrote...

> I have a strange problem with JDBC and Access.

The errors you're getting aren't strange at all...

> Im trying to create a table and insert values into it,
> but i'm getting an error saying it doesn't like the
[quoted text clipped - 11 lines]
>
> please help on this strange problem.

The SQL syntax states that literal values of character types needs to be
enclosed within "single" quotation marks, e.g.:

 insert into tblTest values('AB123','123')

Some DB's can "convert" numerical values into their string equivalents,
which is why you *don't* get an error at this line.

 insert into tblTest values(123,123)

...but in this line it runs into something that is neither a string literal
or a numerical value:

 insert into tblTest values(AB123,123)

// Bjorn A


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.