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 / July 2004

Tip: Looking for answers? Try searching our database.

PreparedStatement.execute() failes...

Thread view: 
Georg Andersson - 26 Jul 2004 10:07 GMT
Hi folks

i try to update a mssql-database using the following code

PreparedStatement prstmt=connection.prepareStatement("INSERT INTO
GCP_IMAGE VALUES(?,?,?,?,?,?,?,?");
prstmt.setLong(1,11);
prstmt.setInt(2,4);
prstmt.setBinaryStream(3,fis,(int)file.length());
//fis=FileInputStream
prstmt.setString(4,"11_DRAWING.jpg");
prstmt.setLong(5,file.length());
prstmt.setString(6,"image/pjpeg");
prstmt.setLong(7,1000);
prstmt.setLong(8,1000);
           
prstmt.execute();

running this code results in the following error:
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC][SQLServer]Line 1: Incorrect syntax near '@P8'.

what is this error telling me?? how can i view the syntax of the
statement that is sent to the database to find the error?

best regards
Gerd Nachtsheim - 26 Jul 2004 11:33 GMT
Georg Andersson wrote, On 26.07.2004 11:07:

> Hi folks
>
> i try to update a mssql-database using the following code
>
> PreparedStatement prstmt=connection.prepareStatement("INSERT INTO
> GCP_IMAGE VALUES(?,?,?,?,?,?,?,?");

prstmt.prepareStatement
("INSERT INTO GCP_IMAGE VALUES(?,?,?,?,?,?,?,?)");

HTH

Gerd


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



©2008 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.