Why do i get the UnsupportedOperationException

Hello
with the code below i get the UnsupportedOperationException. Why? Is it because i (have to) use MS-Access 2000?
If yes, can someone tell me how to do it another way?
I am pretty new to JDBC so help would be a nice gift.
Sincerely
Matthias
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
conn = DriverManager.getConnection(jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\test.mdb);
String sql="INSERT INTO Material (Name,Size,price,Category) VALUES (?,?,?,?);";
PreparedStatement ps=conn.prepareStatement(sql,PreparedStatement.RETURN_GENERATED_KEYS);
ps.setString(1,mat.getName());
ps.setString(2,mat.getSize());
ps.setDouble(3,mat.getPrice());
ps.setInt(4,mat.getCategory());
ps.executeUpdate();
rs=ps.getGeneratedKeys();
int id=-1;
if (rs != null)
     if (rs.next())
          id=rs.getInt("ID");
mat.setId(id);

The JDBC-ODBC bridge driver doesn't support getting
generated keys - that's why you got it.Is there another driver that is able to work with MS-Access DB�s and that suports generated keys?
You can get it yourself - follow your INSERT w/a
SELECT with a WHERE clause that will only bring back
the key that you just created:
SELECT MAX(ID) FROM MATERIAL;
While i searched the Forum i found out, that this is a rather bad solution so i decided not to use it...
Thanks anyway
Sincerely
Matthias

Similar Messages

  • Why do we get the data from a view to a report.

    hi
    why do we get the data from a view to a report. is it possible to get the data from a view in all the cases?

    hi Jyotssna,
      Suppose you are planning to get the data from multiple tables then you got to specify seveal condtions and make use of joins which results in poor performance in fetching the data . In order to improve the performance we make use of views where the conditions of different tables are defined and the data is fetched accordingly.
    Regards,
    Santosh

  • Why do I get the "iwork discontinued" message when I click on the share feature in pages?

    Why do I get the "iwork discontinued" message when I click on the share feature in pages?

    If you are using an older version of iWorks, the sharing was, I understand discontinued in July 2012.
    New versions of the iWorks suite, Pages etc now have the sharing option, introduced earlier this year.

  • Why do I get the movies only in english?

    As a new Apple TV user this might be a stupid question for pros on Apple TV. Nevertheless, why do I get the movies which I wanted to receive in the German version only in the English version. I make my choice in the German iTunes-Store, I watch the trailers in German, but when I order the movie, I get it only in English. Am I stupid or what?
    Thanks for your help.
    Hartwin

    Hartwin, that's odd. Does this happen with every movie you've rented?
    And do you perhaps have a US iTunes account that you're using to order from?
    Other than that, I really can't think of an answer.

  • While installing Adobe Acrobat 8 on Windows 7 Professional why do I get the message "Adobe pdf.dll on windows Vista CD-ROM is needed.

    While installing Adobe Acrobat 8 on Windows 7 Professional, why do I get the messaage "Adobe pdf.dll on Windows Vista CD-ROM is needed"?

    Because your software is far too old for Windows 7.

  • Why do i get the following message when i attempt to open my backup file for lightroom cc?  "Lightroom cannot use the catalog named "Lightroom Catalog" because it is not writable and cannot be opened".  This message just started coming  up after downloadi

    why do i get the following message when i attempt to open my backup file for lightroom cc?  "Lightroom cannot use the catalog named "Lightroom Catalog" because it is not writable and cannot be opened".  This message just started coming  up after downloading lightroom cc (previously using lightroom 5)...am i backing up properly or not???

    Open Pictures folder and move the files named lrcat-journal and lrcat.lock to Desktop.
    Make sure that , they are not inside Pictures folder any more and try to open backup from Lighrtroom and check..
    Any LRcat file with .lock extension , move it to Desktop.

  • Why am I getting the message "project could not be prepared because an error occurred. (File already open with write permission)" when trying to share my imovie to media browser?

    Why am I getting the message "Project could not be prepared because an error occurred. (File already open with write permission.) when trying to
    share to the media browser?   I have done this many times before and never got this message.  This is very frustrating.  Can anyone help me?

    Hi
    Error -49 opWrErr  File already open with write permission
    Trash the preference files while application is NOT Running.
    Easiest way to find out if this is the problem is by:
    • Create a new User-Account
    • Log out of Your old one and into this
    • Re-try iMovie
    If it now works OK - then 99.9% the problem is iMovie pref. file that needs to be trashed.
    from Karsten Schlüter
    Some users notice on exporting larger projects from within iMovie that this operation is aborted with an 'error -49'
    This issue occurs only on MacOs machines using 10.7x
    try switching-off the Local Mobile Backup
    in Terminal copy/paste
    sudo tmutil disablelocal
    Re-launch Mac
    Yours Bengt W

  • Why do I get the message that my operating system is not supported?

    My computer is running Windows 7 - 64-bit. I have the latest softwear on both my iPhone and my iPad. I have installed Edge Inspect on these devices and have the Google Chrome edge inspect extension installed. I have been able to enter my passcodes for both devices in the Chrome extension. Why do I get the message that my operating system is not supported just yet?

    This is VERY interesting ... even though I got that strange message, once I linked my iPhone and my iPad to the Google extension, it worked! Whatever I display in Google Chrome automatically displays in the Edge Inspect app on the small devices. This is neat! The only problem that I can see is that Adobe needs to replace the error message with information about how to use the application.

  • Hello, Why am I getting the following message after I start up my computer: "CAHeadless has encountered an error. [/Adobe/premiere/elements/Release/12/ALL_LANG_12.1/CAHeadless/Make/Mac/../../Src/CAHeadle ss.cpp-683]." Anyone, please solve this for me? Tha

    Hello, Why am I getting the following message after I start up my computer: "CAHeadless has encountered an error. [/Adobe/premiere/elements/Release/12/ALL_LANG_12.1/CAHeadless/Make/Mac/../../Src/CAHeadle ss.cpp-683]." Anyone, please solve this for me? Thank you very much!

    Hello, Why am I getting the following message after I start up my computer: "CAHeadless has encountered an error. [/Adobe/premiere/elements/Release/12/ALL_LANG_12.1/CAHeadless/Make/Mac/../../Src/CAHeadle ss.cpp-683]." Anyone, please solve this for me? Thank you very much!

  • Why am I getting the pop-up "the iTunes library file cannot be saved.  You do not have enough access privilieges for this operation?"  All folders set to appropriate permissions, tried deleting and reinstalling iTunes, can't get rid of it.

    Why am I getting the above pop up?  How to make it stop?

    Hello deborahjael,
    Thanks for using Apple Support Communities.
    To troubleshoot this error message in iTunes please follow the directions in the link below.
    Trouble adding music to iTunes library or importing audio CD
    http://support.apple.com/kb/ts1387
    Take care,
    Alex H.

  • Why do I get the error message: "The file "iTunes Library" cannot be read because it was created by a newer version of iTune." I am using iTunes9.1.1 which, I believe, is the highest for OS 10.4.11 ?

    Why do I get the error message: "The file "iTunes Library" cannot be read because it was created by a newer version of iTune." I am using iTunes9.1.1 which, I believe, is the highest for OS 10.4.11 ?

    Hello,
    Did you reinstall lately?
    My 10.4.11 Drive seemes to have iTunes 7.6.2 on it, have you tried Software update to see if iTunes is listed?
    Another 10.4.11 drive has iTunes 6.05 on it... I hate upgrading iTunes, seems worse at every upgrade.
    The 10.5.8 drive I'm booted from now has iTunes 8.02 on it.

  • Why I keep getting the NO SIGNAL on my monitor??

    Question.....Someone gave me a Pc, I notice everytime I turn it on I get a No Signal icon on my monitor. So I open the unit up, took out the memory stick. Clean it off from dust with dry rag. Power it back up, still the same thing. I notice everything else is running like fans, even the little green light was on.  I went on youtube, tried those tips too, still the same reaction. Just before I got ready to give up on it. I notice there is no graphic Card. I was wonder could this be the reason why I keep getting the No Signal sign everytime i turn the pc on???? Please Help!!!!!In simple english Please......lol. Im very new at this.

    Does the iPhone NOT tell iTunes if you've played a track or not?
    Yes, but the entire track must be listened to - until the track ends.
    A song is not marked as played until the song has completed and the iPod starts playing the next song. The song must be played until the very end, and the same with a podcast.

  • Hi why do i getting the message like "Your payment method was declined"

    hi why do i get the message like "Your payment method was declined"

    What are you trying to use as your payment method, credit card, debit card ... ? If it's a debit card then I don't think that they are still accepted as a valid payment method in all countries - from this page :
    You may be able to use other payment types in your country, like debit and Maestro cards.
    which implies that they are not accepted in all countries, and there have been a number of posts about them being declined.
    For a card to have a chance of being accepted it needs to be registered to exactly the same name and address (including format and spacing etc) that you have on your iTunes account, and have been issued by a bank in the country where you and your iTunes account are. If it is then you could check with the card issuer to see if it's them that are declining it, and if not then try contacting iTunes Support (these are user-to-user forums) and see if they know why it's being declined (but you might not be able to use a debit card) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management

  • TS4425 Why do I get the message "there's no photos in this album"

    Why do I get the message "there's no photos in this album"?

    hi
    i was wondering if you found a solution to this issue because im getting the same message
    thanks

  • Why cant i get the latest msnbc shows on itunes?

    Why cant i get the latest video podcats from msnbc on itunes?

    That is vague.
    Are they not offered, or they are offered and you are not allowed to get them.
    Please explain

Maybe you are looking for

  • Server 2012 not visable in AD after IP change

    Running a single server 2012 in this environment so it hosts everything such as AD, DHCP, DNS etc. I changed the network IP scope due to VPN issues for users who connect from home networks using the same IP range.  During the IP range change I change

  • Timecode Reader Not Matching

    I've been having drift problems with the timecode reader in FCP 7. The timecode reader matches the timecode throughout the entire sequence in FCP, yet in the Quicktime ProRes file I export the burned-in timecode slowly drifts throughout the entire vi

  • How to get rid of DVD interlace?

    I encoded my source file in adobe media encoder. It is progressive 23.87 mpeg2-DVD and looks great on the computer but after Encore authors it to DVD, I put it in my DVD player and it looks interlaced with jagged edges especially with movement. It's

  • PI - SQL Port number change

    Hi Team, We had implemented SQL 2008 for PI 7.1 environment for default SQL Port number 1433, but to bring this to standards we want to change it to 3180. But when we made the change at SQL level, as expected SAP Java is not coming online and ConfigT

  • Menubar Rearranging

    My menubar has been acting strangely. Certain items can be moved by command dragging them, such as the time, the volume, bluetooth, and menu meters. Others, such as virtue desktops, quicksilver, and coreduo temp, cannot. I have tried restarting the a