Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6344861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:43:21+00:00 2026-05-24T20:43:21+00:00

I am trying to insert values into Oracle 10g database using the code below

  • 0

I am trying to insert values into Oracle 10g database using the code below but its giving an error of “Missing Expression” on execution. I have to pass reference values into the insert clause but do not know the exact syntax or way of doing it.
Please help me through this.
Thanks.

Student Table:-

                      Sid       VARCHAR2(200) PRIMARY KEY  CHECK(Sid>0),
                      Pass_word VARCHAR2(10) NOT NULL,
                      S_name    VARCHAR2(20) NOT NULL,
                      G_name    VARCHAR2(20)         ,
                      Branch    VARCHAR2(10) NOT NULL,
                      D_company VARCHAR2(20)         ,
                      B_Percent INT NOT NULL CHECK(B_Percent<100),
                      twelth_percent INT NOT NULL CHECK(twelth_percent<100),
                      tenth_percent INT NOT NULL  CHECK(tenth_percent<100),
                      Certify   VARCHAR2(30),
                      Semester  INT NOT NULL CHECK(Semester<9),
                      D_Birth   DATE NOT NULL,
                      Sex       VARCHAR2(6) NOT NULL

CODE:

Connection connection = null;

try
{

  // Load the JDBC driver

   String driverName = "sun.jdbc.odbc.JdbcOdbcDriver";

   Class.forName(driverName);

    connection = DriverManager.getConnection("jdbc:odbc:placement","siddharth","sid");

    studentID = StudentID.getText();
    spassword = PasswordField.getPassword();
    studentname = NameField.getText();
    Gname = GuardianField.getText();
    branch = BranchField.getText();
    dcompany = DcompanyField.getText();
    bpercent = BtechField1.getText();
    twelthpercent = TwelthField.getText();
    tenthpercent = TenthField.getText();
    semester = SemesterField.getText();
    certify = CertificationField.getText();
    sex = SexCombo.getActionCommand();
    date =  (Date) DateTextField1.getValue();



    Statement stmt = connection.createStatement();
    stmt.executeUpdate("insert into student " +"(sid,pass_word,s_name,g_name,branch,d_company,b_percent,twelth_percent,tenth_percent,certify,semester,d_birth,sex)"+
                 "values(studentID, spassword,studentname,Gname,branch,dcompany,bpercent,twelthpercent,tenthpercent,certify,semester,date,sex)" );

    stmt.close();
    connection.close();
    }

    catch (ClassNotFoundException e) {
    // Could not find the database driver
      JOptionPane.showMessageDialog(null,e);
    } 
    catch (SQLException e) {
    // Could not connect to the database
      JOptionPane.showMessageDialog(null,e);
     } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:43:22+00:00Added an answer on May 24, 2026 at 8:43 pm

    Currently your SQL statement looks like:

    insert into student (sid, pass_word, ...) values (studentID, spassword, ...)
    

    The variable names mean nothing to the SQL itself.

    You should use a prepared statement. For example, your SQL should look like this:

    insert into student (sid, pass_word, ...) values (?, ?, ...)
    

    and then you use:

    PreparedStatement stmt = connection.prepareStatement(sql);
    stmt.setString(1, studentID);
    stmt.setString(2, spassword);
    
    // etc
    

    See the JDBC tutorial on prepared statements for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to insert new records into a SQL CE 4 database with LINQPad
My database table has columns email, username and password. I'm trying to insert these
How can insert a array into my MySQL database? I have managed to insert
I'm trying to insert some data into a table with shell_exec (on localhost). Here's
I'm trying to insert a false boolean value in a SQLite3 table but it
I have an array with more than 134675+ values, I need to insert them
I am trying to insert current date/time and a value that was redirected to
I have some trouble when trying to update a table by looping cursor which
I just started using jQuery in the past few days. I love how it
I am learning python and i am new bie. I am trying to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.