Nextval('id_increment') doesn't work - why?

sorry for crossposting this as i just joined and asked in the newbie section..
I've got a main method as a driver to test a database insertion and in the line not working is -
Customer c = new Customer (select nextval('id_increment'),"Mark","Jones");
the error is to do with nextval...
java.lang.Error: Unresolved compilation problem:
     Invalid character constant
I've never used a database with java before and the line worked fine before I made the sequence. Inserting a 1 or 2 for example had worked fine before this.
Any suggestions on where to look next would be appreciated. Thanks.

main is just a simple test driver - the database accepts a sequenced integer, a string for name and a string for address...
package week07;
import java.sql.*;
public class main {
     * @param args
     public static void main(String[] args) {
          // TODO Auto-generated method stub
try {
     Customer c = new Customer (select nextval('id_increment'),"Mark","Jones");
     c.insertInDB();
     System.out.println("finished insertion");
catch(SQLException ex)
System.out.println("bugger");
System.out.println();
ex.printStackTrace();
Customer.java are just getters and setters and constructor, I've addes an insert method I'm testing...
package week07;
import database.Database;
import java.sql.*;
* @author Steven Clark
public class Customer {
     * @param args
     private int id;
     private String name, address;
     public Customer(int id, String name, String address) {
          super();
          // TODO Auto-generated constructor stub
          this.address = address;
          this.id = id;
          this.name = name;
     public String getAddress() {
          return address;
     public void setAddress(String address) {
          this.address = address;
     public int getId() {
          return id;
     public void setId(int id) {
          this.id = id;
     public String getName() {
          return name;
     public void setName(String name) {
          this.name = name;
public void insertInDB() throws SQLException
          Database db = new Database();
          db.update("insert into customer values ('" + getId()
                    + "', '" + getName()
                    + "', '" + getAddress() + "')");
          db.disconnect();
Finally, the table in postgreSQL is just those 3 fields - id with a sequence as primary key, a name and address. There's a sequence for id.
I'm not sure where I've gone wrong and wonder if my syntax in teh main method calling nextval() is somehow wrong?

Similar Messages

  • I have downloaded my latest flash player and it still doesn't work, why?

    I have downloaded my latest flash player and it still doesn't work, why?

    Lightroom doesn't use the Camera Raw plug-in. All of the Camera Raw technology is part of the Lightroom program. You will either have to upgrade to Lightroom 5 or use the DNG converter to create digital negative copies that can be used with Lightroom 4.

  • Hi I'm new in this Ae and i loved it and started to get into editing but when i watch videos on how to use effects like magnify and CC light burst 2.5 it doesn't work why?

    hi I'm new in this Ae and i loved it and started to get into editing but when i watch videos on how to use effects like magnify and CC light burst 2.5 it doesn't work why?

    First, I want to clear up some vocabulary issues. After Effects is not intended for editing video. Editing involves cutting shots together to tell a story. Premiere Pro edits video. While you technically can cut video together in AE, Premiere is much, much better for that.
    After Effects is used for creating shots - visual effects, compositing, motion graphics, animation, color correction, color grading, etc.
    What exact version number of AE (down to the decimal points) are you using? Plus the questions Todd asked, plus the info in the link he gave.
    Also, if you're new to AE, you should really start here. This resource will give you a foundation in how to actually use After Effects that will probably clear up your current problem and prevent much more frustration in the future.

  • I push the cloud botton on the appstore to return the past purchased apps but it doesn't work.why?

    i push the cloud botton on the appstore to return the past purchased apps but it doesn't work.why?

    Oh gosh, this is ancient history for me.
    First, I remember some sort of third party boot enabler being required to install OSX on some G3s.  Not sure if it included iBook. http://eshop.macsales.com/OSXCenter/XPostFacto/Framework.cfm?page=XPostFacto.htm l
    Second, which exact set of installer discs?  They have to be black colored retail discs, not grey ones which came with a specific model Mac and will only boot that model.
    What are the exact specifications of the computer?  Does it have sufficient RAM?  You're asking a lot for a G3 to run Tiger.

  • Help: v('p1_test'):=1; doesn't work why?

    I want to update states on p34_level_1, 2, 3, 4 etc..
    But it seems I can use v('p34_level_1') one way?
    for example:
    Variable_Value:= v('p34_level_1'); -- <----works correctly
    but I cant go:
    v('p34_level_1'):= Variable_Value; -- <----DOESN'T work
    Below show my code basically i want to loop through some fields and update the contents with values,
    any ideas? or suggestions?
    I get this error:
    ORA-06550: line 17, column 28: PLS-00103: Encountered the symbol ":" when expecting one of the following: := . ( % ;
    declare
    count_levels number(12,0);
    begin
    -- Count levels
    select count(level_id)
    into count_levels
    from wi_ccqual_level
    where bu = :p1_buid;
    -- update page
    FOR i IN 1 .. count_levels
    LOOP
    v('P34_LEVEL_' || i): = i;
    --i = i;
    END LOOP;
    END;

    Hi Vanadium
    Function v('ITEM') just reads item values from APEX environment.
    If you want to update item values from PL/SQL you should use apex_util.set_session_state API
    Syntax: apex_util.set_session_state(item,value)
    So you should write: apex_util.set_session_state('P34_LEVEL_'||i , i );
    I hope this helps you
    Oscar

  • My KeyListener doesn´t work, why?

    Hi!
    I am trying to ge my KeyListener working.
    My code is as follows:
    class C extends JPanel
              public C()
                   addMouseListener(new MListener());
                            addKeyListener(new KListener());Furher down in the code I have this:
    class KListener extends KeyAdapter
                public void keyPressed(KeyEvent e)
                       System.out.println(KeyEvent.getKeyText(e.getKeyCode()) + " was pressed");
                public void keyReleased(KeyEvent e)
                     System.out.println(KeyEvent.getKeyText(e.getKeyCode()) + " was released");
           }I do not get any errors when compiling the code but the KeyListener doesn´t work. The mouse listeners work perfekt.
    What´s wrong with my key listener?

    Add your keyListener to the JFrame and it will probably work, the JFrame has the focus when you use your JPanel.
    package Junk;
    import java.awt.Dimension;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import javax.swing.JFrame;
    class Junk extends JFrame {
      Junk(){
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        addKeyListener(new KListener());
        setPreferredSize(new Dimension(256, 256));
        setVisible(true);
      public static void main(String[] args){
        new Junk();
      class KListener extends KeyAdapter {
        public void keyPressed(KeyEvent e) {
                System.out.println(KeyEvent.getKeyText(e.getKeyCode()) + " was pressed");
              public void keyReleased(KeyEvent e) {
             System.out.println(KeyEvent.getKeyText(e.getKeyCode()) + " was released");
    }

  • 6303i Classic modem doesn't work - why?

    In the 6303i user manual:  "You can use your device as a modem by connecting it to a compatible PC. For details, see the Nokia Ovi Suite documentation"
    Based on this I just bought a 6303i and wasted a morning trying to get the modem to work.  I can connect to it using Hyperterminal, interrogate it, find out what network it's connected to (AT+COPS), what the call quality is (AT+CSQ), but as soon as I type ATD [phone no] it returns ERROR.
    Why does AT+CSQ, +COPS etc work but ATD doesn't?

    nowadays, nokia phones which comes with computer compatibles(connectivity) and gprs enable, also can be used as a modem.
    I hope you are not typing your phone no. in atd command. it should be somewhat like *99#(contact your sp).
    to use your phone as a modem, no need to go such detail(but if for some reason you need).
    and there are lots of thread/topic on this forum
    hope someone add more input on this issue

  • Grant permissions on sys.sql_logins doesn't work: why?

    Using admin user I try to run:
    3> GRANT SELECT ON sys.sql_logins TO someuser
    4> go
    Msg 15151, Level 16, State 1, Server ..., Line 2
    Cannot find the object 'sql_logins', because it does not exist or you do not have permission.
    1>
    Why is that?

    Hi Martin
    No, it won't work.
    Features that are Not Supported in SQL Database
    GRANT/REVOKE/DENY endpoint, server-level, server principal, and system object permissions
    and related system tables such as sys.server_principals and sys.server_permissions.
    If you have any feedback on our support, you can click
    here.
    Eric Zhang
    TechNet Community Support

  • Method to return ArrayList or Vector doesn't work, why?

    Hi, I try to return a ArrayList or Vector from a method but it does not work.. wondering why and how to fix it? Thanks:)
    class Class1{
          public static main(...){
              Class2 test = new Class2();
              ArrayList<String> resp = test.class2method(...);
              if(resp.get(4).equals(...)) {        
    class Class2{
        public ArrayList class2method(int NumInt1, int NumInt2, ...) {
           ArrayList<String> arrayTesting = new ArrayList<String>(13);
           responses.set(2, Integer.toString(NumInt1));
           responses.set(3, Integer.toString(NumInt2));
           responses.set(4, Integer.toString(NumInt3));
           responses.set(5, Integer.toString(NumInt4));
           responses.set(6, Integer.toString(NumInt5));
           return responses;
    }

    what is responses? don't you want to return
    arrayTesting?yes, responses is arrayTesting, sorry did notmention
    that.what do you mean? is the code you posted a typo or
    what you actually have in your code?It's more than 1000 lines codes so I decided not to posted them but here is part of them. My point is that i tried to return a ArrayList or Vector even with a simple code, it does not work. Thanks for your help.
    public class DemoScript {
        public DemoScript() throws IOException {
            // register the shutdown hook
            Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    System.out.println("close prog");
                     endApp();
        public void endApp() {
            System.out.println("done!");
            System.exit(0);
         public static void main(String[] args) {
              Parameters p = new Parameters();
              VMF vm = null;
                   //Elements: [0]time, [1]MsgType, [2]NumInt1, [3]NumInt2, [4]NumInt3, [5]NumInt4, [6]NumInt5, [7]NumLong,
                   //               [8]String1, [9]String2, [10]String3, [11]String4, [12]String5
    //               ArrayList<String> responses = new ArrayList<String>(13);
              try {
                   MyScript my = new MyScript();
                   if(args.length == 5) {
                       p.vmHost = args[1]; p.vmPort = Integer.parseInt(args[2]);
                       p.guiHost = args[3]; p.guiPort = Integer.parseInt(args[4]);
                  } else if(args.length == 4) {
                       p.vmHost = args[1]; p.vmPort = Integer.parseInt(args[2]); p.guiHost = args[3];
                  } else if(args.length == 3){
                       p.vmHost = args[1]; p.vmPort = Integer.parseInt(args[2]);
                  } else if(args.length == 2){
                       p.vmHost = args[1];
                  } else {
                       System.out.println("Usage: java MyScript [port #] [voice mail hostname] <voice mail socket #> <GUI hostname> <GUI socket #>");
                       System.out.println("Default: <voice mail socket #> = "+p.vmPort+", <GUI hostname> = "+p.guiHost+", <GUI socket #> = "+p.guiPort);
                       System.exit(-1);
    //               String hostname;
                   //int port;
                   /* Check for input arguments */
                   //if(args[0] != null){
                   //     port = Integer.parseInt(args[0]);
                   //     hostname = args[1];
                   //} else {
                   //     port = 2000;
                   //     hostname = "10.0.0.228";
                   //System.out.println("tews");
                   vm = new VMF(p.vmHost, p.vmPort, p.guiHost, p.guiPort);
                   vm.logon();
                   //vm.portAbort(4);/*
                   vm.portCapture(3, 0);
                   //vm.portAbort(4);/*
                   //vm.portOnhook();
                   //vm.portOffhook();
                   ////vm.portStop(3);  //to stop a port current operation
                   //vm.portWaitring(); //vm will not resp until port detects ring
                   //vm.portOffhook();
                   //vm.portGetdigits(5, 7);
                   //vm.portDialdigits("201");
                   //for(int i=0;i<100000000;i++);
                   //vm.portCallprogress(3, 0, 10);
                   //System.out.println("d");
                   //for(int i=0;i<1000000;i++);
                   //vm.portGetdigits(5, 7);
                   //vm.portRecordfile(30, 1, "\\\\kanapak.ctlinc.local\\VMfiles\\test.wmv");
                   //vm.portClearDTMF();
                   //vm.portPlayfile("\\\\kanapak.ctlinc.local\\VMfiles\\test.wmv");
                   //vm.portPlayprompt(2);
                   //vm.portSpeaknumber(3845);
                   //vm.portSpeakdigits("1639123478866478909");//75655656566657867867*");
                   //vm.portExternalcall(4, "933");
                   ArrayList<String> response = vm.portInternalcall(2, "201");
                   System.out.println(response.get(4));
                   if(response.get(4).equals("DONE")) {
                        vm.portPlayprompt(1); vm.portPlayprompt(2);
                   } else if(response.get(4).equals("GONE")) {
                   vm.portSpeakttsstring("hello. This will create ");//a project with all of the proper SWT and JFace imports. Version 4.1.1 latest build released (SWT visual inheritance, enhanced SWT GridLayout support, non-visual beans, custom !!!SWT widgets, code generation enhancements, expose property, etc.)");
                   vm.portRelease();
                   vm.logoff();
                   vm = new VMF(p.vmHost, p.vmPort, p.guiHost, p.guiPort);
                   vm.logon();
                   vm.portCapture(Integer.parseInt(args[0]), 0);
                   vm.portOnhook();
                   vm.portOffhook();
                   //          vm.portGetdigits(5, 7);
                   //vm.portRecordfile(30, 1, "\\\\kanapak.ctlinc.local\\VMfiles\\test.wmv");
                   //vm.portClearDTMF();
                   //vm.portPlayfile("\\\\kanapak.ctlinc.local\\VMfiles\\test.wmv");
                   vm.portPlayprompt(86);
                   //          vm.portSpeaknumber(3845);
                   //vm.portSpeakdigits("1639123478866478909");//75655656566657867867*");
                   //vm.portExternalcall(4, "933");
                   //vm.portInternalcall(9, "82045");
                   //vm.portSpeakttsstring("hello. This will create");// a project with all of the proper SWT and JFace imports. Version 4.1.1 latest build released (SWT visual inheritance, enhanced SWT GridLayout support, non-visual beans, custom !!!SWT widgets, code generation enhancements, expose property, etc.)");
                   vm.portRelease();
                   vm.logoff();
              } catch (IOException e) {
                   e.printStackTrace();
              } catch (InterruptedException e) {
                   //catch "STOP PORT"
                   vm.logoff();
    class VMF {
        public ArrayList<String> portInternalcall(int rings, String dial_string) {
             if (logon_status == 0) {
                   System.err.println("Error: logon required");
                   logoff();closeAndExit();
              } else if (capture_status == 0) {
                   System.err.println("Warning: portCapture required");logoff();closeAndExit();
              } else if (rings <1 || rings >999 || !checkDigits(dial_string)) {
                   System.err.println("Warning: portInternalcall( [1-999] , \"[0-9,A-D,F,P,a-d,f,p,*,#]\" )");
             breakString(dial_string);
             ostruct.write("", "IVR", "123", 188, captured_port, rings, 0, 0, 0, 0, str1, str2, str3, str4, str5);
             sendToGUI("s", "", "IVR", "123", "188", Integer.toString(captured_port),
                       Integer.toString(rings), "0", "0", "0", "0", str1, str2, str3, str4, str5);
             readStream();
             recToGUI("r", Integer.toString(MsgType),Integer.toString(NumInt1),Integer.toString(NumInt2),
                        Integer.toString(NumInt3),Integer.toString(NumInt4),Integer.toString(NumInt5),
                        Integer.toString(NumLong),String1,String2,String3,String4,String5);
              responses.set(2, Integer.toString(NumInt1)); responses.set(3, Integer.toString(NumInt2));
              responses.set(4, Integer.toString(NumInt3)); responses.set(5, Integer.toString(NumInt4));
              responses.set(6, Integer.toString(NumInt5));
              return responses;
    }

  • I want to do a border-radius with box shadow and it doesn't work, why?

    This should be simple but it's not working and I don't know why. I think the problem is in the html.
    I simply want to have a div with an image inside that is circular and has an inset shadow and is centered on the page.
    /*here is my css*/
    #div3 {
    -webkit-margin:25px auto;
    -webkit-border-radius:50%;
    .box-shad{
    -webkit-box-shadow: 15px 15px 15px #8 inset;
    <!-- here is my html -->
    <body>
      <div class="gridContainer clearfix">
      <div id="div3" class="fluid"><div class="box-shad"><a href="index.html"><img src="images/Big-tree-trans1.png" width="900" height="700" alt=""/></a></div>
      </div>
    </body>
    Here is my website: www.adjacentdimensionsmedia.com

    I want a different drop shadowed image on each page. Is there a way to do that?
    Sure.  Copy & paste the following code into a new, blank document.
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>HTML5 Document</title>
    <style>
        margin: 0;
        padding: 0;
        -moz-box-sizing: border-box;
        -webkit-box-sizing: border-box;
        box-sizing: border-box;
    img {
        max-width: 100%;
        vertical-align: baseline
    body { background: #069 }
    header, footer {
        clear: both;
        width: 100%;
        padding: 0 2%;
        background: #CCC;
        color: #000;
        min-height: 50px
    article {
        clear: both;
        width: 75%;
        min-height: 600px;
        padding: 0 2%;
        background: #FFF;
        color: #069;
        margin: 0 auto;
    .shadow img { box-shadow: 1px 3px 5px #333 }
    .radius img {
        -moz-border-radius: 10px;
        -webkit-border-radius: 10px;
        border-radius: 10px;
    .border img { border: 20px solid #069 }
    .center {
        text-align: center;
        margin: 0 auto
    </style>
    </head>
    <body>
    <header>Header</header>
    <article> <h1>Main content area</h1>
    <div class="shadow radius border center">
    <!--INSERT YOUR UNIQUE IMAGE BELOW-->
    <img src="http://placehold.it/500x325.jpg"> </div>
    <h3>Heading 3</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.  Mauris vitae libero lacus, vel hendrerit nisi!  Maecenas quis velit nisl, volutpat viverra felis. Vestibulum luctus mauris sed sem dapibus luctus.  Pellentesque aliquet aliquet ligula, et sagittis justo auctor varius. Quisque varius scelerisque nunc eget rhoncus.  Aenean tristique enim ut ante dignissim. </p>
    <p> </p>
    <h3>Heading 3</h3>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.  Mauris vitae libero lacus, vel hendrerit nisi!  Maecenas quis velit nisl, volutpat viverra felis. Vestibulum luctus mauris sed sem dapibus luctus.  Pellentesque aliquet aliquet ligula, et sagittis justo auctor varius. Quisque varius scelerisque nunc eget rhoncus.  Aenean tristique enim ut ante dignissim. </p>
    </article>
    <footer>Footer</footer>
    </body>
    </html>
    Nancy O.

  • If I open my email server with firefox the autocomplete doesn't work. why?

    If I open my email server with Internet explorer I don't have this problem

    Thank you Alley!
    But still not working.
    I've just bought my Apple TV. I think it is impossible low battery and I tried to hold menu and left, but it didn't response again.
    When I press any buttom, the Apple TV LED doesn't flick. The light is just on... not flickering...
    Thanks again!
    Igor

  • Mini DisplayPort to DVI to VGA doesn't work (why?!)

    I purchased a Mini DisplayPort to DVI adaptor from eBay. It works just fine when connected to a DVI cable to a monitor, but there's no signal when I put a DVI to VGA adapter in-between to connect it to a VGA only display. I was hoping to use a single Mini DisplayPort cable to handle both DVI and VGA connections - am I missing something here?
    Here's an image of the connection path: http://img690.imageshack.us/img690/313/photors.jpg
    Thanks

    Someone on Twitter mentioned the Mini DisplayPort to DVI output is DVI-D only, which means the VGA adapter wouldn't receive an analogue signal to convert to VGA.
    Exactly correct. When you plug a DVI adaptor into mDP the port only sends out the digital signal. Likewise, when you plug a VGA adaptor into mDP the port sends only the analog signal. So using two adaptors in tandem is not possible. You need a separate adaptor for DVI and for VGA, unfortunately.
    --Travis

  • I got a digtal download from a CD and downloaded it to my computer and when I try to drag it over to iTunes it doesn't work, why not?

    The songs are downloaded into a music folder on my computer, they are legal downloads, but it won't let me bring it over to my iTunes library. When I click and drag it, they just never copy over.

    I'm not sure? I'm new to lightroom and it's lightroom 5 that I'm using. What is happening is I go to develop the picture in the developing section in lightroom and it gives me this message that says " Develop module is disabled Please purchase a license to reactivate the develop module." I shouldnt have to do anything else after already buying the cd and downloading it initially. It's already paid for? I'm so confused!!
    why is the adobe lightroom 5 asking me to keep downloading the CD I bought at Best Buy store. I have already bought the CD and downloaded it on my computer but for some reason it gives me 10 days a then I have to download it again!!! Why is this its so an 

  • Line in red doesn't work, why?

    var nbTunes:Number = 43;
    var listeTunes:Array = new Array();
    var noTune:Number= 1;
    var max:Number = 43;
    var pick:Number = -1;
    var tune:Sound = new Sound(soundloader_mc);
    for (var i:Number = 1; i <= max; ++i)
    do{
      pick = random(nbTunes) + 1;
      trace(pick);
    while(! this.Available(pick))
    listeTunes.push(pick);
    trace (listeTunes);
    this.Play();
    tune.onSoundComplete= function(){
    Next();
    btnStop.onRelease= function(){
    tune.stop();
    btnPlay.onRelease= function(){
    tune.start();
    btnBack.onRelease= function() {
    BackTrack();
    btnNext.onRelease= function() {
    Next();
    function BackTrack(){
    if (noTune > 1){
      noTune-= 1;
    else{
      noTune= max;
    this.Play();
    function Next(){
    if (noTune < max)
      noTune+= 1;
    else{
      noTune= 1;
    this.Play();
    function Play(){
    this.WriteTune();
    var addZero:String = "" ;
    addZero.String = (noTune - 1) < 10 ? "0" : "" ;
    trace("addZero: " + addZero.String) ;
    tune.loadSound("Track No" + addZero.String + listeTunes[noTune - 1] + ".mp3", true); 
    function WriteTune(){
    trackNumber_txt.text = noTune + " / " + max;
    function Available(choice:Number):Boolean{
    var isAvailable = true;
    for(var j:Number = 0; j < listeTunes.length; ++j){
      if (listeTunes[j] == choice){
       isAvailable = false;
    return isAvailable;

    Thanks, it works now.
    I'm trying to learn ActionScript3 while finding snippets of code on Google to help me get started, but I guess I end up with code from earlier versions of ActionScript w/out my knowledge.  It's not easy for me to distinguish between the versions as I'm a novice at this.
    Example, in the following code, bigNum does have a dot to it even though it is just a regular variable.
    playbutt.addEventListener(MouseEvent.CLICK, playSound);
    function playSound(e:Event):void
    SoundMixer.stopAll();
    var num:Number = Math.ceil(Math.random()*43);
    bigNum.text = num < 10 ? "0"+String(num) : String(num);
    var path:String = "Track No" + bigNum.text + ".mp3";
    trace(path);
    var s:Sound = new Sound(new URLRequest(path));
    s.play();
    SoundChannel(1).addEventListener(Event.SOUND_COMPLETE, playSound);
    Ron

  • I have a iBook G3 and I'm trying to install OS X 10.4 but it doesn't work, why?

    I recieved my OS X 10.4.1 install discs today so I put disc into my iBook and rebooted it. As I did the apple logo appeared after the bong, no loading wheel appeared then a load of writing appeared. The last line said: "panic: We are hanging here...". At the top I noticed two error lines and they read: "Error: Extension archive doesn't contain software for this computer's CPU type." and
    "Error: Couldn't unpack multi-extension archive.". What does all of this mean and how do i fix it? If anyone needs more parts of the writing on the black screen I am willing to give it to you. Thanks

    Oh gosh, this is ancient history for me.
    First, I remember some sort of third party boot enabler being required to install OSX on some G3s.  Not sure if it included iBook. http://eshop.macsales.com/OSXCenter/XPostFacto/Framework.cfm?page=XPostFacto.htm l
    Second, which exact set of installer discs?  They have to be black colored retail discs, not grey ones which came with a specific model Mac and will only boot that model.
    What are the exact specifications of the computer?  Does it have sufficient RAM?  You're asking a lot for a G3 to run Tiger.

Maybe you are looking for