Yes I have. Assuming your table looks like this:
id int auto_increment not null, bla varchar(128), blabla varchar(128) My insert would be: INSERT INTO tablename VALUES(\N,"blablabla","blablabla") The \N or NULL creates the auto_increment stuff. It can then be retrieved like this: org.gjt.mm.mysql.Statement stmt = (org.gjt.mm.mysql.Statement)con.createStatement(); count = stmt.executeUpdate("INSERT INTO tablename VALUES(NULL,'blablabla','blablabla')"); last_id = (int)stmt.getLastInsertID(); String str_last_id = "" + last_id; /Christopher > -----Original Message----- > From: Carl [mailto:[EMAIL PROTECTED]] > Sent: den 24 september 2002 13:32 > To: Tomcat Users List > Subject: Re: So what database and script language do you use? > > > Keith, > > I use MySQL with autincrement fields in essentailly all of my > tables. I > keep all database activities in beans associated with the jsp > pages. I use > a home rolled connection pooling process (actually copied > from somewhere.) > Below is an insert from one of the beans: > String query="insert into assigning_preferences set " > +"item_serial="+item_serial+"," > +"weeks_of_month="+weeks_of_month+"," > +"always_use_this="+always_use_this+"," > +"last_person_serial="+personSerial; > > > In this case the autoincrement field is called > assigning_preferences_serial... note that it is left out of > the insert query > thereby telling MySQL to create a value for the field. Works > flawlessly and > has been very stable. > > Thanks, > > Carl Kabbe > > > > ----- Original Message ----- > From: "Keith Pemberton" <[EMAIL PROTECTED]> > To: "Tomcat Users List" <[EMAIL PROTECTED]> > Sent: Tuesday, September 24, 2002 7:20 AM > Subject: RE: So what database and script language do you use? > > > > Do you use auto_increment fields in any of your tables in > MySQL. If so, > > have you found a good way to put entries into the table that has an > > auto_increment field. Everything I try will not > automatically generate > > that field when I insert something from either a JSP page or servlet > > > > Keith > > > > On Tue, 2002-09-24 at 05:58, Cato, Christopher wrote: > > > > Apache + TomCat / MySQL / JSP > > Apache + mod_perl / MySQL / Perl > > > > are the two combinations I use > > > > /christopher > > > > > -----Original Message----- > > > From: Keith Pemberton [mailto:[EMAIL PROTECTED]] > > > Sent: den 24 september 2002 12:39 > > > To: [EMAIL PROTECTED] > > > Subject: So what database and script language do you use? > > > > > > > > > Hi everyone... > > > > > > I have been trying to use MySQL and JSP,Servlets > to interact > with > > > my tomcat server. So far I have had a lot of > frustration and little > > > luck. Anyway, I was just wonder what the majority of ppl are > > > using as a > > > database and scripting language. Your input is much > appreciated! > > > > > > Keith > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > > > > > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>