Hey... i know this is an old thread but instead of creating a new one with the same topic i'll post here... first of all i want to say thx to Izzy for his/her replies that helped me to finally create a connection from my pc to mysql server located on my laptop,but i got a problem; i have all privileges for my database but still i can't change it from my java program(update doesn't work)
the screen from phpmyadmin with users and privileges for my database:
the connection code to database:
- Code: Select all
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url ="jdbc:mysql://192.168.0.148:3306/chat";
instance=DriverManager.getConnection(url, "root", "");
the update code:
- Code: Select all
Connection con=DbConnection.getInstance();
try {
Statement s= con.createStatement();
s.executeQuery("UPDATE user SET Status="+sx+"WHERE Username='"+ux+"'"); //sx-is type INT and ux-STRING
DbConnection.close();
}catch (SQLException e) {}
and the table:
I can use the operation SELECT but UPDATE doesn't work;
and i have another problem... how can i connect to my mysql server from another PC with different external IP?
PS: I use xampp for windows version 1.7.3