0

I've been trying figuring this out

ps.setString(1,fname);
ps.setString(2,lname);
ps.setString(3,uname);
ps.setString(4,pass);
ps.setString(5,gender);
ps.setString(6, phone);
ps.setString(7,brdate);
ps.setString(8,address );

it would send another message at the bottom:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''java_login_register'('fname', 'lname', 'uname', 'pass','gender','phono','bdate'' at line 1

connection to the database or localhost

con = DriverManager.getConnection("jdbc:mysql://localhost:3306/uinterface_?serverTimezone=UTC","root","");
            ps = con.prepareStatement("INSERT INTO 'login_register'('fname', 'lname', 'uname', 'pass','gender','phono','bdate','address') VALUES (?,?,?,?,?,?,?,?)");
  • 4
    Well the first problem is because JDBC parameter indexes start at 1. So that's solved by the second part - I suggest you edit your question to remove any mention of the parameter problem, and focus on the broken SQL. Show the complete SQL you're using. – Jon Skeet Apr 20 '20 at 11:56
  • @Jon Skeet HIII, what do u mean broken SQL? how am I suppose to fix that? thankyouuu, I am still new to java programming please be understanding – BeginnerNoob Apr 20 '20 at 12:12
  • 3
    Remove the quotes around the table and columns names – Federico klez Culloca Apr 20 '20 at 12:24
  • As per the exception message: "You have an error in your SQL syntax". In other words, your SQL is broken. As Federico says, you probably just need to remove the quotes from around your table and column names. – Jon Skeet Apr 20 '20 at 12:33
  • @Ivar IT REALLY ANSWERED THE PROBLEM! THANKYOUUU. now I can move on to the next step thankyou so much – BeginnerNoob Apr 20 '20 at 13:11

0 Answers0