Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: getConnection with syntax error at '?????????'


Advanced Search

getConnection with syntax error at '?????????'
Posted by: Matt Rosing ()
Date: September 11, 2012 03:23PM

I'm trying to connect to a remote server using Connector/J but get the same message no matter what code I use. I can connect to it manually with the mysql client command on debian just fine.

The error is: 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. Do I need to escape any characters? All the '?'s don't help much.

The latest code is:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class E{
public void connect(){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(
"jdbc:mysql://192.168.1.3:3306/dbname?user=dbuser&password=dbpw");
}catch( Exception e){
System.out.printf("Something went wrong: "+e.getMessage());
}
}

I get the exact same problem with DataSource.

Something is working because if I put in a bad password I get an access denied message.

I'm using mysql-connector-java-5.1.22-bin.jar and had the same problem with 5.1.21

I would greatly appreciate some wisdom. Thanks.

Options: ReplyQuote


Subject Written By Posted
getConnection with syntax error at '?????????' Matt Rosing 09/11/2012 03:23PM
Re: getConnection with syntax error at '?????????' Matt Rosing 09/11/2012 10:11PM
Re: getConnection with syntax error at '?????????' Dinesh Varyani 09/23/2012 01:55PM


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.