How do i increase my key ID +1 for every new user

what iam trying to do is that for every new user that register on my app will get a key id.. that is +1 higher then the old highest id.. i have done this i JavaDB but in mysql i get an exception
here is my sql Q:
sql = "insert into " + mytest_TABLE + "(" + mytest_ID + ", " + mytest_NAME
+ ") values ((case when (select max(" + mytest_ID + ") from " + mytest_TABLE + ")"
+ "IS NULL then 1 else (select max(" + mytest_ID + ") from " + mytest_TABLE + ")+1 end), "
+ encodeSQL(firstName) + ")";
here is my exception:
by the way mytest is my table..
java.sql.SQLException: You can't specify target table 'mytest' for update in FROM clause
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3250)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1355)
at com.mysql.jdbc.Statement.executeUpdate(Statement.java:1270)
at cont.tt.updateContact(tt.java:49)
at cont.tt.jButton3ActionPerformed(tt.java:179)
at cont.tt.access$200(tt.java:6)
at cont.tt$3.actionPerformed(tt.java:140)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
sry for my bad english..
really hope someone can help me out

You need an 'Identity' column. In MySQL, you need to enable autoincrement and don't insert a value in the column while adding records; MySQL will auto increment the value.
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
(Yes I know it's on JavaRanch but I think it applies everywhere)
----------------------------------------------------------------

Similar Messages

  • How can I set the default home page for all new users in Firefox 4

    I'm trying to deploy FF 4.0rc1 in a corporate environment but I can't find a way to set the default home page or any other settings for that matter.
    Is there a way to set the default home page for all new users and lock it so that the users can't change home page?
    Best regards
    Jonas

    In Firefox 4 the template folder for new profiles (C:\Program Files\Mozilla Firefox\defaults\profile\
    ) doesn't exist. You can create that \defaults\profile\ folder and place a file user.js in it with the prefs that you want to initialize.
    See:
    *http://www-archive.mozilla.org/catalog/end-user/customizing/briefprefs.html
    You can also use a mozilla.cfg file to set the default value for prefs.<br />
    See: http://kb.mozillazine.org/Locking_preferences
    defaultPref(); // set new default value
    pref(); // set pref, but allow changes
    lockPref(); // lock pref, disallow changes

  • HT4863 How can I increase the file size limit for outgoing mail. I need to send a file that is 50MB?

    How can I increase the file size limit for outgoing mail. I need to send a file that is 50MB?

    You can't change it, and I suspect few email providers would allow a file that big.  Consider uploading it to a service like Dropbox, then email the link allowing the recipient to download it.

  • How to create a jobsteps for a new user to run a report on portal

    Hello Experts,
    Is there any program that automatically creates a jobsteps for the new users for
    a role??
    My company BW roles are mapped with R/3. so whenever a new user is created in a R/3 role
    it comes and maps with BW Role and creates that users automatically in BW.
    Now the problem is if any new users are created in r/3 and mapped with BW. the report
    fails to run for the new users unless and until they really login in to the system.
    For ex: I have 5 new users which are created in R/3 and properly mapped with BW. But
    report fails to runs for the new users.
    ERROR: Jobs step fails for the User X
    Is there any programe that automatically creates a jobsteps for the new users??
    Please advice.
    Thanks in advance,
    Harish

    Hello Kedar,
    Do you manually add a new users to the role??
    How the reports run for new users in your company??
    Thanks,
    Harish

  • Is there somewhere in iTunes that tells me how many GB of songs is in my LIBRARY? New user - I'm a bit clueless :)

    Is there somewhere in iTunes that tells me how many GB of songs is in my LIBRARY? New user - I'm a bit clueless

    Yes
    In iTube under View in the pull Down menu click Show Status Bar
    This will add a bar to the bottom of the window with albums, p-lay time amd disk space

  • How do I translate word perfect old files for my new iMac?

    How do I translate Word Perfect old files for my new iMac?  They are transferred from a 13-year-old Dell.  My McLink did not work.
    Thanks.

    The current version of the free LibreOffice continues to support Word Perfect documents. OpenOffice had to drop this support due to licensing issues. LO installs in two places: /Applications and your local Library/Application Support directory. Simple to install. Simple to remove. Good PDF documentation from their site. It is a capable MS Office replacement.
    I just opened a wpd legal deposition in LO and it looked fine.

  • How do I reformat a MacBook for a new user?

    I have a previously used MacBook that I am taking to Haiti and giving to a new user there.  How do I wipe it clean?  I know how to set it up for the new user, but am unsure how to wipe out the previous data, user info, etc.  Thanks for your help.

    Prepare Your Mac for Sale
    Boot from the OS X Installer Disc One that came with the computer.  After the installer loads select your language and click on the Continue button.  When the menu bar appears select Disk Utility from the Utilities menu.  After DU loads select the startup volume from the left side list then click on the Erase tab.  Set the format type to Mac OS Extended (Journaled) then click on the Options button.  Select the one pass Zero Data option and click on the OK button.  Then click on the Erase button.
    Note: You can skip the Zero Data option if you are not concerned about removing sensitive personal data from the hard drive.  If you choose to skip this part of the process then it is possible for others to recover data from the hard drive.  The Zero Data procedure will prevent others from getting access to your personal information.
    This process will take 30 minutes to several hours depending upon the size of the hard drive.  After formatting has completed quit DU and return to the installer.  Now complete the OS X installation.  At the completion of the installation do not restart the computer.  Instead just shut it off.  The next user will be presented with the Setup Assistant when they turn on the computer just as it would if new out of the box.

  • The font size in the menu bar is too small (unreadable). How can I increase font size. I have a new Samsung PC with high resolution screen.

    Hi the fnt size in the menu bar is too small (unreadable). How can I increase the font size. I have a new Samsung PC with high resolution screen.

    You must mean Photoshop Elements 11, not Photoshop.
    There is no ability to change the size of the menu font in PSE 11.
    note to mod:
    Please move to the Photoshop Elements forum.

  • How do you increase your IP Address pool for static IP addresses?

    I have an address pool from 192.168.200.1 to 192.168.200.250, the entire pool is being used by DCHP. How do I increase my address pool, so that I can assign static IP addresses for printers etc?
    Say: 192.168.200.251
    But not allow DCHP to use it?
    I will assign the static IP address using DNS.
    I hope that makes sense?
    Thanks

    Please re-read responses in your earlier thread for some related background on this question.
    If your DHCP address pool is from .1 to .250 inclusive, then you have four addresses left for static hosts in the typical /24 subnet.  You have .251. .252, .253 and .254 available.  One of those addresses will probably be your gateway router, and one will be your server host. 
    You don't need to do anything to the DHCP pool to use those four addresses, because the static addresses are inherently outside of the DHCP pool.
    DHCP address pools are not the same thing as the IP subnet address block, and DHCP-assigned addresses do not control what (other) IP hosts and addresses that a DHCP-addressed host can connect to. 
    DHCP servers do provide local and usually somewhat transient clients access to a pool of shared IP addresses, and they provide clients with information on the local network including the gateway router address, the subnet mask, and the DNS server address(s).
    And in general, do you really have 200+ dynamic-addressed hosts in your network?   If you do have 200-some transient hosts, then you're headed for either a bigger netblock (eg: a /22 configuration), or you're headed toward configuring multiple submets and routing among the various subnets.
    The /24 configuration is another and shorter nomenclature for the subnet mask 255.255.255.0 that's common.

  • How to change the theme in the default profile so new users get a different theme

    How can I change the theme (background picture, etc) for the default profile, so that when new users log in and get a new profile created, they get a different theme than the one they currently receive?

    Hi,
    If you want to get a different theme for new users, based on my understanding, it’s not easy, we can load the specific theme for all user because we can control OS to load this specific theme file.
    The default location of theme file is:
    C:\Windows\Resources\Themes
    To configure OS load different theme for different user, I think this cannot be controlled by a registry key. It’s complicated to make OS choose different theme pack for different user, even more, the theme pack files are limited.
    Here is some different but similar discussion about changing theme programmatically:
    How do I change the current Windows theme programatically?
    http://stackoverflow.com/questions/546818/how-do-i-change-the-current-windows-theme-programatically
    Please Note: Since the website is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    If you have any feedback on our support, please click
    here
    Alex Zhao
    TechNet Community Support

  • How do I permanently STOP the Bing Suggested Sites icon from being in the IE 9 toolbar for everyone and make it the default for all new users

    Non of the other post on this subject were correctly answered and they are now old so here is a new thread for a question that a Microsoft Engineer should have answered a long time ago in one of the other threads.
     I have IE 9 installed.
    I am setting up my default profile which will be used for ALL users to configure their profile when they log on. All profiles are destroyed on system reboot. All PCs are frozen.
    Every time I log in as a new user and open IE 9, the favorites bar shows up as I want it with NO BING Suggested Site crapware in site. Then about .5 secs after IE starts and the Favorites bar is shown, the EVIL "Bing Suggested Sites" button appears.
     I can delete it and it seems to stay away until I delete the users profile folder etc and have them log in again. When the profile is recreated the Favorites folder does not have a "Suggested Sites" option in the c:\users\username\favorites\links"
    folder. (I have deleted the hidden .ini files in the default folder) Nor does one exist in the "c:\users\default\favorites\links" folder from which the newly created user profile folder comes. But as soon as I start IE 9, one is created and placed
    in the users favorites links folder. This MUST STOP!!!!!!!!!!!!! This is UNACCEPTABLE. AND IT MUST BE STOPPED!!!!! Where in the Windows 7 x64 Enterprise OS is the location of this evil action and how do I PERMANENTLY delete it.
    I don't EVER want to see the EVIL BING Suggested Sites button anywhere on the PC especially in the Favorites Tool bar on IE 9. An I expect/demand that Microsoft tell us how to 100% cannot fail get rid of it for ALL USERS FOREVER NO MATTER WHAT!!!!!!!!!!!! I
    have spent a lot of time perfecting my default profile making sur that ALL options are decide by me NOT MICROSOFT. I NEVER USE SYSPREP as that will destroy ALL custom defaults every time.
    When a user logs in in to one of my PCs and they start IE 9 they get REAL Google for the default search engine, not the version Microsoft will give you which first sends all search requests to Microsoft so they can spy on what you searched in Google for etc.,
    but real Google, not sent to Microsoft 1st. (I'll bet more than 90% of the readers of this site did not notice how if you let Microsoft set your default search provider to Google, they fix it so that all search requests go to Microsoft 1st, before it gets
    sent to Google. Look at the search string under manage your search providers, in IE 7 & 8. In IE 9 it is hidden, but still there. HOW EVIL OF MICROSOFT)
    With my default profile IE does not ask how you want to set it up, I have already made those decisions. I have made all those decisions for my users. But as of recently I have started installing IE 9 and now this unacceptable BING Suggested Sites junk ware
    keeps showing up. HOW DO I STOP IT. Do I have to put a line in my HOSTS file to send all request for Bing.com to 127.0.0.1 just to make sure that it can't be used. There by removing all possibility of my users ever being able to use Bing FOREVER.
    I would rather not do that but unless a Microsoft representative will tell me how to keep that useless Bing Suggested Sites button from appearing on the Favorites tool bar I will have to. I would love to let my user decide if they want to use Bing and waist
    their time trying to find good search results, but I will not have it forced on them and I will not allow it to be on the Favorites tool Bar ever. So will a Microsoft Engineer please tell us how to put a permanent end to the "Bing Suggested Sites"
    button for ALL users ALWAYS FOREVER.
    Thanks,
    Ralph

    Hi,
    I suggest you try the steps in this thread for test:
    Disable Suggested Sites does not work.
    http://answers.microsoft.com/en-us/ie/forum/ie9-windows_7/disable-suggested-sites-does-not-work/4ba064b1-1c6e-43f1-939e-2db1d335b2ef
    Regards,
    Vincent Wang
    TechNet Community Support

  • How do i stop my ipad from asking for a new email password

    My work email is on my ipad.  I changed my password at work and it is asking for the new password on my ipad.  It won't take my new password and it won't let me out of the loop to even use my ipad for anything, including disconnecting my email.  How do I by pass the email password question so I can use my ipad?

    OK, thanks much. Checked  andadjusted setting and now all works like before. And you introduced me to a nice security setting I did not know existed and one I can set up easily if i need to . Thanks again.

  • How to move iTunes library from time machine backup to new user

    I recently pruchased a new imac and woiuld like to move my entire itunes and iphoto library to a new user I set up for the new computer. I used time machine to backup my old computer (a Macbook pro I purchased in 2007), but it just transferred the exact dektop I had on the laptop, and I cannot access any of my files from the new user. So at this point I need to start with transferring the two previously mentioned sets of files to the new user, and then I also need to know how to set my computer to default to the new user when it first boots up instead of it starting up with the time machine backed up user as it does now. Thanks!

    I forgot to mention the iMac is running snow leopard and macbook pro is Mountain Lion

  • How can I see the Query view created for a different user

    Hi All,
    How can a user see the View of a query created for a different user??
    I would like some info about how to give access ( if it is a access problem) or tell me the steps to do that.
    Regards, Federico

    Hi all,
    Maybe I didn't explain me as i should or maybe you dont know what is a Query View. Lets try again, showing you the steps to open a "Query view".
    This way is from Bex Analyzer (Excel)
    I open the Bex Analyzer and connect to the system -> Open query -> Under "Type" choose "Query View"...this is just a different view of the original query (more or least columns/rows).
    This way is from Bex Web:
    Once you open/execute the query, you have a ComboBox to choose the view (previously saved)
    The problem that we have is that the views created for a user, can NOT be found by other user. The only user who can is the owner.
    Could it be an authorization problem? or is ther any configuration possible to see it?
    Thanks in advance, Federico

  • How to Run a Report automatically in Background for every night

    Hi,
    How to run a report program in Background automatically for every nigh.
    Thanks
    Ramesh

    Hi Ramesh,
    You can use SM36 and use the "Job Wizard" to define a background job in simple step by step procedure
    Or
    Goto SM37 and specify a job name.
    Next specify the ABAP Program Name of the report you want to execute under Job Step.
    Then click on "Extended Job Selection" and goto the Period Tab.
    There select "Only Periodic Jobs" and then specify the frequency of execution based on Months, Weeks, Days, Hours or Minutes.
    Hope this helps,
    Regards,
    Madhur
    Message was edited by: Madhur Chopra

Maybe you are looking for

  • HP Printer Assistant is not working ...keeps loading...

    Hello, I have purchased a HP Officejet Pro 6830  All in One printer and have installed the software from the CD, installed updates and already used the HP Docter software but the Printer Assistant does not load. It keeps on with a blank screen, with

  • How to find an XML message ID with a wildcard QueueID

    Hi, My scenario is: transfer purchase orders from SAP SRM to marketplace(3rd party system) The QoS is EOIO, therefore my POs are transferred with Queues but each queue has a leading prefix which are all registered. The project is already go-live for

  • Pass parameter between programs

    Hi, I need to pass one parameter between 3 programs : That is the actual flow of my parameter. SAPF110V -> RFFOBE_I -> which include ZRFFORI99B) get param   <- RFFOBE_I <- set param with statments SET PARAMETER ID 'ZDBL' FIELD p_doublon. GET paramete

  • JSTL  Condition Evaluation for single character string

    I am facing a weird problem. For example my JSP code is like this: <c:set var="myString" value="S"> <c:if test="${myString=='S'}"> MyString value is S </if> When i execute this code it suppose to display: MyString value is S But it is not displaying

  • Maven - FileNotFoundException

    Hi All, Hope you are fine and great too. I am extremely sorry if I had post this in a wrong forum. I am deploying from application in tomcat and i use maven as my build tool.While deploying my application I get the following Exception (FileNotFoundEx