Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1


Advanced Search

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1
Posted by: Terrence Ma ()
Date: April 18, 2011 01:56PM

Hi, so im trying to use JDBC to update Mysql using Java.

Right now, I've just been trying to connect to the database. I've followed multiple tutorials verbatim, and I'm still getting errors. This is the error I get

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1

I've also tried doing what someone else suggested below...

create database with utf-8 character like that:
CREATE DATABASE `test`
CHARACTER SET `utf8`
COLLATE `utf8_general_ci`;

nothing worked. Please help me!!!!

My code:

Connection con = null;
String url = "jdbc:mysql://localhost:3306/test";
String user = "root";
String pass = "";
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection(url, user, pass);
con.close();
}
catch(Exception e){
System.out.println(e.getMessage());
}

Options: ReplyQuote


Subject Written By Posted
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1 Terrence Ma 04/18/2011 01:56PM
Re: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1 Gerard Matte 04/18/2011 03:57PM
Re: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1 Terrence Ma 04/18/2011 11:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.