Data inputed is not going to sql databaseSQL standard to escape column names?How to avoid SQLException?Exception in thread “AWT-EventQueue-0” Java ErrorCreate program to find length of a StringMySQLSyntaxErrorException when trying to update using java databasehow to run executable via processBuilder?jpl library won't work with java maven projecthow to resolve the NullPointerException error in the following code? Throws error for setting text int TextFieldHow to save image into resource folder java swingapache POI java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipFileHaving a Null pointer exception while coding my first GUI and I can't figure out where it's going wrong
How could I create a situation in which a PC has to make a saving throw or be forced to pet a dog?
Fill the maze with a wall-following Snake until it gets stuck
How to avoid offending original culture when making conculture inspired from original
Can you place a web spell on a surface you cannot see?
How is linear momentum conserved in circular motion?
Why swap space doesn't get filesystem check at boot time?
How did the European Union reach the figure of 3% as a maximum allowed deficit?
King or Queen-Which piece is which?
How "fast" do astronomical events occur?
What is the word?
I wish, I yearn, for an answer to this riddle
TV show starring two men who develop various gadgets
Why do you need to heat the pan before heating the olive oil?
How to address players struggling with simple controls?
In the US, can a former president run again?
How to add a сolumn from one table to another?
Time travel short story where someone from the past follows the travelers back
What kind of chart is this?
How can the US president give an order to a civilian?
Is there any possible way to get these hearts as Adult Link?
How can caller ID be faked?
Scaling an object to change its key
Do details of my undergraduate title matter?
Why "amatus est" instead of "*amavitur"
Data inputed is not going to sql database
SQL standard to escape column names?How to avoid SQLException?Exception in thread “AWT-EventQueue-0” Java ErrorCreate program to find length of a StringMySQLSyntaxErrorException when trying to update using java databasehow to run executable via processBuilder?jpl library won't work with java maven projecthow to resolve the NullPointerException error in the following code? Throws error for setting text int TextFieldHow to save image into resource folder java swingapache POI java.lang.NoClassDefFoundError: org/apache/commons/compress/archivers/zip/ZipFileHaving a Null pointer exception while coding my first GUI and I can't figure out where it's going wrong
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
else
PreparedStatement ps1;
String query= "INSERT INTO 'registration'('u_fname','u_lname','u_uname','u_pass',u_address')VALUES(?,?,?,?,?)";
try
ps1=MyConnection.getConnection().prepareStatement(query);
ps1.setString(1, fname);
ps1.setString(2, lname);
ps1.setString(3, uname);
ps1.setString(4, pass);
ps1.setString(5, address);
if(ps1.executeUpdate() > 0)
JOptionPane.showMessageDialog(null,"New User Added");
catch (SQLException ex)
Logger.getLogger(RegisterForm.class.getName()).log(Level.SEVERE, null, ex);
generates this error:
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.ClientPreparedStatement.checkBounds(ClientPreparedStatement.java:1402)
at com.mysql.cj.jdbc.ClientPreparedStatement.getCoreParameterIndex(ClientPreparedStatement.java:1415)
at com.mysql.cj.jdbc.ClientPreparedStatement.setString(ClientPreparedStatement.java:1782)
at newpackage.RegisterForm.jButtonRegisterActionPerformed(RegisterForm.java:402)
at newpackage.RegisterForm.access$400(RegisterForm.java:22)
at newpackage.RegisterForm$5.actionPerformed(RegisterForm.java:162)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2238)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2296)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4897)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4475)
at java.awt.Container.dispatchEventImpl(Container.java:2282)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java mysql sql jdbc
add a comment |
else
PreparedStatement ps1;
String query= "INSERT INTO 'registration'('u_fname','u_lname','u_uname','u_pass',u_address')VALUES(?,?,?,?,?)";
try
ps1=MyConnection.getConnection().prepareStatement(query);
ps1.setString(1, fname);
ps1.setString(2, lname);
ps1.setString(3, uname);
ps1.setString(4, pass);
ps1.setString(5, address);
if(ps1.executeUpdate() > 0)
JOptionPane.showMessageDialog(null,"New User Added");
catch (SQLException ex)
Logger.getLogger(RegisterForm.class.getName()).log(Level.SEVERE, null, ex);
generates this error:
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.ClientPreparedStatement.checkBounds(ClientPreparedStatement.java:1402)
at com.mysql.cj.jdbc.ClientPreparedStatement.getCoreParameterIndex(ClientPreparedStatement.java:1415)
at com.mysql.cj.jdbc.ClientPreparedStatement.setString(ClientPreparedStatement.java:1782)
at newpackage.RegisterForm.jButtonRegisterActionPerformed(RegisterForm.java:402)
at newpackage.RegisterForm.access$400(RegisterForm.java:22)
at newpackage.RegisterForm$5.actionPerformed(RegisterForm.java:162)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2238)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2296)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4897)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4475)
at java.awt.Container.dispatchEventImpl(Container.java:2282)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java mysql sql jdbc
Change your'
to`
characters.
– Elliott Frisch
Mar 25 at 5:14
@ElliottFrisch There is no need for backticks here, and anyway that would only work on MySQL.
– Tim Biegeleisen
Mar 25 at 5:16
@TimBiegeleisen It also works in Hive (which is what I've been using lately). It looked like that was what OP wanted.
– Elliott Frisch
Mar 25 at 5:20
add a comment |
else
PreparedStatement ps1;
String query= "INSERT INTO 'registration'('u_fname','u_lname','u_uname','u_pass',u_address')VALUES(?,?,?,?,?)";
try
ps1=MyConnection.getConnection().prepareStatement(query);
ps1.setString(1, fname);
ps1.setString(2, lname);
ps1.setString(3, uname);
ps1.setString(4, pass);
ps1.setString(5, address);
if(ps1.executeUpdate() > 0)
JOptionPane.showMessageDialog(null,"New User Added");
catch (SQLException ex)
Logger.getLogger(RegisterForm.class.getName()).log(Level.SEVERE, null, ex);
generates this error:
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.ClientPreparedStatement.checkBounds(ClientPreparedStatement.java:1402)
at com.mysql.cj.jdbc.ClientPreparedStatement.getCoreParameterIndex(ClientPreparedStatement.java:1415)
at com.mysql.cj.jdbc.ClientPreparedStatement.setString(ClientPreparedStatement.java:1782)
at newpackage.RegisterForm.jButtonRegisterActionPerformed(RegisterForm.java:402)
at newpackage.RegisterForm.access$400(RegisterForm.java:22)
at newpackage.RegisterForm$5.actionPerformed(RegisterForm.java:162)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2238)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2296)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4897)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4475)
at java.awt.Container.dispatchEventImpl(Container.java:2282)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java mysql sql jdbc
else
PreparedStatement ps1;
String query= "INSERT INTO 'registration'('u_fname','u_lname','u_uname','u_pass',u_address')VALUES(?,?,?,?,?)";
try
ps1=MyConnection.getConnection().prepareStatement(query);
ps1.setString(1, fname);
ps1.setString(2, lname);
ps1.setString(3, uname);
ps1.setString(4, pass);
ps1.setString(5, address);
if(ps1.executeUpdate() > 0)
JOptionPane.showMessageDialog(null,"New User Added");
catch (SQLException ex)
Logger.getLogger(RegisterForm.class.getName()).log(Level.SEVERE, null, ex);
generates this error:
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.ClientPreparedStatement.checkBounds(ClientPreparedStatement.java:1402)
at com.mysql.cj.jdbc.ClientPreparedStatement.getCoreParameterIndex(ClientPreparedStatement.java:1415)
at com.mysql.cj.jdbc.ClientPreparedStatement.setString(ClientPreparedStatement.java:1782)
at newpackage.RegisterForm.jButtonRegisterActionPerformed(RegisterForm.java:402)
at newpackage.RegisterForm.access$400(RegisterForm.java:22)
at newpackage.RegisterForm$5.actionPerformed(RegisterForm.java:162)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
at java.awt.Component.processMouseEvent(Component.java:6533)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2238)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2296)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4897)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4475)
at java.awt.Container.dispatchEventImpl(Container.java:2282)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:733)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
java mysql sql jdbc
java mysql sql jdbc
edited Mar 25 at 7:20
a_horse_with_no_name
317k49483591
317k49483591
asked Mar 25 at 5:12
Milan GeorgeMilan George
1
1
Change your'
to`
characters.
– Elliott Frisch
Mar 25 at 5:14
@ElliottFrisch There is no need for backticks here, and anyway that would only work on MySQL.
– Tim Biegeleisen
Mar 25 at 5:16
@TimBiegeleisen It also works in Hive (which is what I've been using lately). It looked like that was what OP wanted.
– Elliott Frisch
Mar 25 at 5:20
add a comment |
Change your'
to`
characters.
– Elliott Frisch
Mar 25 at 5:14
@ElliottFrisch There is no need for backticks here, and anyway that would only work on MySQL.
– Tim Biegeleisen
Mar 25 at 5:16
@TimBiegeleisen It also works in Hive (which is what I've been using lately). It looked like that was what OP wanted.
– Elliott Frisch
Mar 25 at 5:20
Change your
'
to `
characters.– Elliott Frisch
Mar 25 at 5:14
Change your
'
to `
characters.– Elliott Frisch
Mar 25 at 5:14
@ElliottFrisch There is no need for backticks here, and anyway that would only work on MySQL.
– Tim Biegeleisen
Mar 25 at 5:16
@ElliottFrisch There is no need for backticks here, and anyway that would only work on MySQL.
– Tim Biegeleisen
Mar 25 at 5:16
@TimBiegeleisen It also works in Hive (which is what I've been using lately). It looked like that was what OP wanted.
– Elliott Frisch
Mar 25 at 5:20
@TimBiegeleisen It also works in Hive (which is what I've been using lately). It looked like that was what OP wanted.
– Elliott Frisch
Mar 25 at 5:20
add a comment |
1 Answer
1
active
oldest
votes
Your question is really just a typo, but I am posting an answer because the train of thought which might have led you to typo is worth discussing. Here is your corrected query string:
String sql = "INSERT INTO registration (u_fname, u_lname, u_uname, u_pass, u_address) ";
sql += "VALUES (?,?,?,?,?)";
By placing the column names into single quotes, you were effectively telling the database that you want to pass in string literals as column names. Instead, you want to just use the column names themselves, unescaped in any way.
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331573%2fdata-inputed-is-not-going-to-sql-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your question is really just a typo, but I am posting an answer because the train of thought which might have led you to typo is worth discussing. Here is your corrected query string:
String sql = "INSERT INTO registration (u_fname, u_lname, u_uname, u_pass, u_address) ";
sql += "VALUES (?,?,?,?,?)";
By placing the column names into single quotes, you were effectively telling the database that you want to pass in string literals as column names. Instead, you want to just use the column names themselves, unescaped in any way.
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
add a comment |
Your question is really just a typo, but I am posting an answer because the train of thought which might have led you to typo is worth discussing. Here is your corrected query string:
String sql = "INSERT INTO registration (u_fname, u_lname, u_uname, u_pass, u_address) ";
sql += "VALUES (?,?,?,?,?)";
By placing the column names into single quotes, you were effectively telling the database that you want to pass in string literals as column names. Instead, you want to just use the column names themselves, unescaped in any way.
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
add a comment |
Your question is really just a typo, but I am posting an answer because the train of thought which might have led you to typo is worth discussing. Here is your corrected query string:
String sql = "INSERT INTO registration (u_fname, u_lname, u_uname, u_pass, u_address) ";
sql += "VALUES (?,?,?,?,?)";
By placing the column names into single quotes, you were effectively telling the database that you want to pass in string literals as column names. Instead, you want to just use the column names themselves, unescaped in any way.
Your question is really just a typo, but I am posting an answer because the train of thought which might have led you to typo is worth discussing. Here is your corrected query string:
String sql = "INSERT INTO registration (u_fname, u_lname, u_uname, u_pass, u_address) ";
sql += "VALUES (?,?,?,?,?)";
By placing the column names into single quotes, you were effectively telling the database that you want to pass in string literals as column names. Instead, you want to just use the column names themselves, unescaped in any way.
answered Mar 25 at 5:17
Tim BiegeleisenTim Biegeleisen
253k13105164
253k13105164
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
add a comment |
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
@MilanGeorge You may accept this answer by clicking the green checkmark to the left.
– Tim Biegeleisen
Mar 27 at 2:18
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55331573%2fdata-inputed-is-not-going-to-sql-database%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Change your
'
to`
characters.– Elliott Frisch
Mar 25 at 5:14
@ElliottFrisch There is no need for backticks here, and anyway that would only work on MySQL.
– Tim Biegeleisen
Mar 25 at 5:16
@TimBiegeleisen It also works in Hive (which is what I've been using lately). It looked like that was what OP wanted.
– Elliott Frisch
Mar 25 at 5:20