Tom,
You need to have two prepared statements and make two separate insert
calls, checking the return code for each.
John
Tom Kochanowicz wrote:
>
> In my servlet I used to have one table. For performance reasons
> I broke the table into two tables. I can't get it to work now because
> I'm not sure how to set up the prepared statement. Any Ideas or
> examples
> would be appreciated. Here is an example of BEFORE and AFTER
>
> BEFORE
> registerStatement =
> dbConnection.prepareStatement("insert into Classifieds "
> + "(Name, Address, City, State, Zip, Email, Phone, PayMethod,
> CardNumber, CardMo, CardYr, StartDate, EndDate, AmtForDayMoYr,
> ClassifiedAd, WhatAdSays01, WhatAdSays02, WhatAdSays03, WhatAdSays04,
> WhatAdSays05, WhatAdSays06, WebSite, UniqueDateId)"
> + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
> ?, ?, ?, ?)");
>
> AFTER (this doesn't work with two tables... can you tell me why?)
> // First table
> registerStatement =
> dbConnection.prepareStatement(("insert into CustInfo
> "
> + "(UniqueDateId, Name, Address, City, State, Zip, PayMethod,
> CardNumber, CardMo, CardYr, StartDate, EndDate, AmtForDayMoYr)"
> + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
> // Second table
> + ("insert into AdInfo "
> + "(UniqueDateId, ClassifiedAd, WhatAdSays01, WhatAdSays02,
> WhatAdSays03, WhatAdSays04, WhatAdSays05, WhatAdSays06, Phone, Email,
> WebSite)"
> + " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"));
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html