How can I automatically increment an auto incremented column?

Hello!
I have a table with an auto incremented "id" field.
It looks like this:
id (PK, auto_increment) name address phone
I would like to make an insertion like:
INSERT INTO Person (name, address, phone) VALUES (?,?,?)
...but it says that all fields have to be used.
I get
java.sql.SQLException: Field 'id' doesn't have a default value
How can I bypass this?
I have looked at [this example|http://blog.taragana.com/index.php/archive/java-how-to-get-auto-increment-values-after-sql-insert/] , but it didn´t work for me, it still says the "id" column has not a default value:

Sorry, it is a MySQL database.
The table consists of 4 columns:
id (PK, auto_increment)
name (Varchar)
address (Varchar)
phone (Varchar)
If I use PHPMyAdmin to insert a new row, then this query works:
INSERT INTO `mydb`.`person` (
`id` ,
`name` ,
`address` ,
`phone`
VALUES (
NULL , 'Test', 'Roxxor', 'Europe', '12345'
);{code}I tested to use the method setNull() on the first column in the preparedStatement but it didn´t work.
Do you need more info from me to be able to help me?
I have tried this (but got the error that the "Field 'id' doesn't have a default value"):
[code]con.setAutoCommit(true);
            String query = "INSERT INTO person(id, name, address, phone) VALUES (?, ?, ?, ?)";
            PreparedStatement stmt = con.prepareStatement(query);
            stmt.setNull(1, java.sql.Types.NULL);
            stmt.setString(2, name); 
            stmt.setString(3, address);     
            stmt.setString(4, phone); 
            stmt.executeUpdate(); 
            stmt.close();[/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • How can I automatically close a dialog box using Javascript after I click the OK button to submit it?

    How can I automatically close a dialog box using Javascript after I click the OK button to submit it? I don't want to have to X out of the dialog box after I am done.
    Thanks
    Linda

    JS can not interact with open dialogs in any way, unless it's a dialog
    created in JS using the Dialog object.
    On Thu, Jul 24, 2014 at 11:13 PM, lindaeliseruble <[email protected]>

  • How can I tell what is "Auto Launching"

    User's (me) tech background:
    Fairly technical user here, but getting pretty rusty. In a past life (late '90s) I was a network administrator as well as server admins for NT 4, Novell (up to 4.11), AIX, and HP-UX servers. Used to be really good at a command prompt ($ or #) in AIX and HP-UX as well as MS DOS. I do have ROOT enabled on my Macs and I am not afraid to use it. However, I know how severe the consequences can be (trashed a customer's AIX server once using a -R switch in the root directory), so I am extremely cautious and must be confident of the instruction. Can probably fix most anything with some guidance........
    Here is the problem........ I have recently developed an error on boot, say within the last couple of weeks, where it tells me that some Vista application won't run because VM Ware will not initialize. The problem is VM Ware is not loaded on this computer (15" MBP model 8.2, i7 processor, 16MB of RAM, OS 10.7.4........ bought as a "refurb", never had a problem, have used this workstation for several months now). Boot Camp is not configured on this machine either. Nothing is in the Dock that would knowingly trigger this. When I go into System Information, I find nothing set as a "Startup Item" (screen shot attached) , making me think that I am looking in the wrong place. Where should I be looking?
    Interesting enough, when I go to System Information, and look under "Applications", I do see a lot of Vista items, including apps from an older MBP that I do not connect to (on same network, they have "rights" to connect, I just never do as there is nothing on there I need). I have attached a screen shot of this as well.
    Please, someone, can you give me some advice here?
    How can I tell where this auto loading of this Vista app is coming from
    How do I get rid of it
    Why did it happen "suddenly"?
    Can I go into System Info/Applications and delete any Vista or VM Ware apps?
    If I cannot do this via "System Info" can I remove (rm OR mv) the files from whichever system directory stores this data?
    This is puzzling and quite concerning. I would be deeply grateful if there is a "Yoda" out there that knows how to fix this.......
    Thanks in advance,
    Bill

        Managing your data usage is very important Bag02231958. I would like to thank ttipgem for the great suggestion to see what is using data on your phone. However, when you access the internet, social media apps, stream data, videos, music, etc. that uses data on your phone. Unfortunately, we do not have a list of what specifically is being accessed on the device to incur data. You do have the ability to view data records and time frames online via My Verizon http://bit.ly/xB4iTc
    Thank You,
    MichelleL_VZW
    VZW Support
    Follow us on Twitter @VZWSUPPORT

  • How can I stop safari from auto completing url's on my iphone 4 and ipad2?

    How can I stop safari from auto completing url's on my iphone 4 and ipad2?  On both devices I have cleared history, I have gone into settings-safari-and cleared history and cleared cookies & data, tried turning my devices on and off and I also have private browsing turned on. Both devices are operating on iOS 5.  When I type in a url I don't want anything to show and auto complete.  Any suggestions?

    This indicates corrupt files.
    A restore should resolve.

  • How can I (automatically) import new photos of the photostream on my local disc (Mac)? Don't want to use new icloud service. Simply import.

    New Photo app on Mac.
    How can I (automatically) import new photos of the photo stream on my local disc (Mac)? Don't want to use new icloud service. Simply import.
    With iPhoto every new photo was automatically imported and saved on my local disk (with "full resolution" that's what I only need). In the new photo app I have still my photo stream and when I move a photo (drag and drop from the photo stream) to a new album it indicates a (plus). My understanding is that the photo is now copied to my local disk. But when I deleted the photo in the photo stream it was also deleted in the album !?
    If that is the case I can use the photo stream only until I reach the max of 1.000 photos, then I have to delete photos and I will have no copy left.
    How can I "physically" copy a photo of the photo stream to my local disk? I just want to "transfer" all pictures taken with Ipads, Iphones to my central storage on the Mac. Please don't propose to connect it via iTunes (cable) to the Mac.
    Any other suggestions?
    thx
    -Tom

    The amazing device cannot do it because no amazing developer has written an app for it.  There is some interest, others have asked, but i have a hunch that the market is fairly limited, and no developer has jumped at the chance just yet.
    Any sort of tethered approach means try to feed the material to the pad thru the cck.  Which means the app would have to use the allowed/existing cck pathway in a manner that does not violate the sandbox rules.  That may be the problem.

  • How can i stop iTunes from Auto rating my songs??

    How can i stop iTunes from auto rating my songs in my library?? I have my library very organized and 90% of the time when i listen to music i play "My Top Rated" Playlist on shuffle. The only time i give stars ratings to my songs is for my favourite songs which i give 5 star and every other song is just left with no stars. For some reason iTunes is giving songs i have never played or i dont like 5 Stars and rewining my playlists. I have tried erasing all the stars from my entire library and since doing this a week ago, again (for the 4th time in a year) having a library with not 1 song with any star ratings, all of a sudden i now have 329 random songs with 5 stars again??????
    This is really getting to me as i love my music and love iTunes and everything apple but seriously there has to be away to stop this so i can have my old playlists back!
    Thanks hope some one can help

    One reason itunes will start "at regular intervals" will be if you have an iphone that has sync via wifi enabled. I had the problem following an upgrade to iOS 5.

  • When using Mavericks, how can I automatically replace 'i' with 'I' when typing?

    When using Mavericks, how can I automatically replace 'i' with 'I' when typing?
    It was easy to do prior to mavericks using system preferences (language and text), but now I can only submit a 2 letter word to replace, not a 1 letter word. I have tried using a space but it doesn't allow that. I would assume that most people would love to be able to type quickly without having to make uppercase I all the time (first world problem i know), so I can't understand why apple have removed this feature.

    There is the shift key, or text replacement approach, providing you have enabled two things:
    Edit > Substitution > √ Text Replacement
    System Preferences > Keyboard > TextClick + to add a replacement
    Replaceii[spacebar]
    With
    I[spacebar]
    Press return
    Quit System Preferences
    Now, when you type ii, you will see a pop-up offering I.
    In the OS X App Store, search for WordService. This free collection of Services will enable you to just type your content, select it, and then choose the Service item, “Initial Caps of Sentences.” It does what it says.

  • FireFox won't auto-refresh specific site, other browsers do. How can I get FF to auto-refresh?

    I have a Help Desk application (everything HelpDesk) with a web interface. I keep my queue screen open so I can see new tickets come in and check status of existing tickets. FireFox does not auto-refresh this queue page so that new items or status changes show up. The page must be manually re-loaded in FireFox. However, other browsers (Chrome, IE, Safari) auto-refresh the queue page just fine. How can I get FireFox to auto-refresh this page?

    See:
    *Firefox/Tools > Options > Advanced > General : Accessibility : [ ] "Warn me when web sites try to redirect or reload the page"
    The setting in "Tools > Options > Advanced > General" is meant as an accessibility feature, as you can see by the label of that section, so that people with disabilities or people who use screen readers do not get confused and is not meant as a safety protection to stop redirecting.
    See also:
    *https://support.mozilla.com/kb/Options+window+-+Advanced+panel#General_tab
    *http://kb.mozillazine.org/accessibility.blockautorefresh
    *http://kb.mozillazine.org/Accessibility_features_of_Firefox

  • How can i automate .pdf output and organize by color/bw?

    how can i "automate" multi-page .pdf output to preflight/imposition software workflow, organized by color/bw?
    basically what i'm trying to do is create a simple output function from InDesign that allows the user to just export a multi-page .pdf into a hot folder and on through preflight and imposition software. i want to be able to tell the hot folder which pages are color -so it can separate, rename and direct color pages to a color queue and b/w pages to a b/w queue.
    i've researched indesign distiller presets and the Acrobat JDF but the JDF isn't really meant for this exact purpose and doesn't help reduce the number of steps currently necessary to manually output/rename/etc.
    is there another way that i can embed information into a .pdf that could be read by a hot folder?

    You might check out this third-party plug-in for InDesign. It may or may not help you (I've never used it). I just saw it on the new Adobe Exchange (beta in Adobe Labs). Here's the description:
    Output Factory automates printing and exporting from Adobe InDesign. Export as single pages with variable file names, output layer versions, update modified links on the fly, preflight InDesign files before output, output to several format at once and much more.
    Just select the documents, adjust settings and Output Factory will do the rest for you. Keep working with other programs while Output Factory processes InDesign files in the background. Or leave it working overnight to output hundreds of documents, and the job will be done when you return in the morning.
    Key features:
    • Output multiple InDesign files automatically
    • Output as single pages
    • Automate printing and exporting to PDF, PostScript, EPS, Flash, IDML, EPUB and several image formats
    • Output files to multiple formats at once
    • Layer versioning: output layer combinations as single files
    • Update modified links automatically
    • Variable output file names
    • Preflight InDesign files and final PDFs
    • Supports books and booklet printing
    • Send output files over Internet and locally
    • Detailed output history
    System Requirements:
    - Adobe InDesign CS3-CS6
    - Mac OS X 10.5 and later, Intel-based Mac

  • How can i install shockwave with auto updates disabled?

    how can i install shockwave with auto updates disabled?
    i need to push out shockwave to all our machines and i need to have autoupdates disabled? whats the trick?

    I ran with native io enabled and now i need to see how things happen with native io disabled.I am trying to understand the various aspects of the server.
    Can you help me? How to set the default queue and application specific queues , and oofcourse socket readers in the case native performance packs are not used?
    Please, I will be very grateful.

  • How can I turn off app auto start from last status? At OS X 10.8.3

    How can I turn off app auto start from last status? At OS X 10.8.3

    system preferences >general > close windows when quitting an application

  • How can i turn off an auto renewing subscription to Netflix ?

    How can i turn off an auto renewing subscription to Netflix ?

    Interesting turn of phrase.   Are you suggesting that Netflix has none standard terms and conditions that could activate penalties if the user casually unsubscribes.
    I am not familiar with their terms - I've never had a subscription with Netflix. Personally, I will always check the terms of any business I do business with and know how to cancel before committing to a contract.
    Edit: I just took the time to browse through their terms which appear rather straight up:
    https://signup.netflix.com/TermsOfUse
    From the OP's post, I also did not assume that their subscription was through an iTunes app as a direct subscription was/is available. I do not know if the terms might differ if going through iTunes (which would make sense if Netflix would be losing money by offering their service through iTunes?).

  • How can I turn off the auto renewal for Hulu plus?

    How can I turn off the auto renewal for Hulu Plus?  I can not seem to follow the instructions given...I can not launch I tunes and have a menu appear.......
    My special needs son accidentally signed up for this trial offer and I want it cancelled immediately.  I have received an email from them, but can not get it to work and I have been trying for over a week.......feeling frustrated.

    How/where are you trying to stop the subscription ?
    If you are using iTunes on a PC and the drop-down menus aren't showing at the top of iTunes then see if control-B gets them to show, or try alt-S and see if that gets the Store drop-down menu to show. You should also be able to cancel subscriptions by tapping on your id in Settings > iTunes & App Store on your iPod Touch an logging into your account.
    Auto-renewing subscriptions : Manage your auto-renewing subscriptions

  • How can we automate the Depreciation keys based on production for business

    How can we automate the Depreciation keys based on production for business u2013 this is currently not an optimised process if we expect business to manually change the keyu2019s on a monthly basis.
    The end user updates the table, transaction AO25, manually on month end after the production calculations are completed. The question is, is it possible when the PP is completed, that the system updates the Period Unit table for that period?
    Thanks.
    Regards,
    PS PS

    Hi,
    I am new at this, so I need a explanation on how will this help me, and how do I get about doing this?
    Thanks a lot.
    Regards,
    PS PS

  • How can I automate the multi-step process of looking up a caller's contact details when a telephone call comes in with caller ID?

    How can I automate the multi-step process of looking up a caller's contact details when a telephone call comes in with caller ID. I want to be able to see more than just the first & last name when a client calls me. I would like the caller ID to pull up the same information that shows up when you search for and find a contact name and then click on the right arrow.
    My workaround is to force/enter both the last name and the address in the last name field since then the address will show up.
    The only computerized way to look up this additional information is to put the client on hold, memorize the first and last name and correctly enter it in the search field of the contact database and hopefully find it before the client gets tired of waiting.
    Note that I go to about 48 small jobs per week. So far I have about 9,000 contacts. It's easy to make a mistake and have the client wondering what I'm doing and what's taking so long.
    The second workaround is to use paper and pencil and ask the client for name, address, cross street and phone number again, repeating what I did some time previously.
    Please help meautomate this process.

    You don't have to put anyone on hold. When the call comes in, tap the Home button, then tap contacts, go to the contact. Tap Home button when finished, tap the top banner to return to the call screen.

  • How can I automatically have a new tab always be a copy of the current active tab?

    The add-on extension "NewTabURL" (by "sogame") provided the option I want and used for a number of years. But it stopped working when Firefox was updated to version 16.0. When I click for a new tab, all I get is a completely blank tab. How can I automatically have the new tab always be a copy of the current active tab?
    Can the extension "NewTabURL" be revised to work in version 16 and/or version 17? If not, how else can I get the new tab functionality that I desire? I can't seem to find any other extension that provides that functionality.
    Milt Beychok

    My trackball has 4 buttons and a scroll wheel. Each of the 4 buttons is programmable. The 4 buttons are normally pre-programmed for single-click, double-click, drag and right-click by simply pressing on them
    Each of the 4 buttons may be programmed to also have other functions. For example, I programmed "control/single-click" to produce a middle click. I could also have used "shift/single-click" or "alt/single-click" to produce the middle-click. Or I could have similarly programmed double-click or drag or right-click. The Kensington Expert Mouse is quite versatile ... once you get the hang of programming it.
    I have had it for about 4 years and I had never had the need to program one of them until you told me about using a middle-click.
    Milt Beychok

Maybe you are looking for

  • Read Image from client

    I am trying to import the picture from the client, using WEBUTIL (v 1.0.2) Procedure looks like: DECLARE FILE_NAME VARCHAR2(200); File_Filter varchar2(30):='JPEG Files (*.jpg)|*.jpg|'; BEGIN FILE_NAME:=CLIENT_GET_FILE_NAME(NULL,NULL,File_Filter,NULL,

  • Bluetooth connected - no sound

    I've been googling this for quite a while and all I managed to find was - lots of questions with no answers. No answers at all, not even suggestions... Anyway, here it is. I have 8900 which I can pair with any BT headset but when I place a call or wh

  • HT2204 how can i connect from pc to my iphone ?

    can you help me how to upgrade my iOS 6 , update my iTunes to version 10.6.3 hope you can help me about this problem thanks ^_^

  • Making region items read only.

    I have a default single column that corresponds to a VO that uses a single select statement in my page. This page is used for inserting into table. When user enter the details and press continue button, i need to use forwardImmediatelyToCurrentPage()

  • Could not find the artifact type for property kind

    Team Foundation Server 2013 Update4  on Win Server 2008 R2, this message has suddenly started appearing. Team foundation error: Could not find the artifact type for property kind '77951f77-f29d-4a9b-8311-1b13e4b89c42'. The property kind was not prope