Inserting details into sql server?

Hi i have a requirement to insert values into sql server table in my jira plugin , i created a new table with three columns , i wrote the following code to insert values into database table , but the values are not inserting , following is my code snipet

namevalue = getName();
        desvalue = getDescription();
        roleValue = getRole();

   Class.forName("net.sourceforge.jtds.jdbc.Driver" );
            Connection con =DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433/jiradb","jirauser","jirauser");
  "test connection..");
            String query = "insert into jiradb.dbo.testworklog values(namevalue,desvalue,rolevalue)";
            Statement stmt = con.createStatement();
  "values inserted in database table.. ");

Can any body guide me where i did the mistake .

Thanks in advance

1 answer

This widget could not be displayed.

You should use your variables in the query string, like this :

String query = "insert into jiradb.dbo.testworklog values("+namevalue+","+desvalue+","+rolevalue+")";

Best regards


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

203 views 1 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you