I have a code which runs fine on the machine, where i have installed the database.
I am trying to run this code from other machine, which connects to the machine where MySQL is installed and tries to update data. However this code is not working from other machine. i am trying to connect as follows.
ds = new BasicDataSource();
ds.setDriverClassName("com.mysql.jdbc.Driver");
ds.setUrl("jdbc:mysql://192.168.0.104:3306/sd_mmm_data");
ds.setUsername("<UserName>");
ds.setPassword("<PassCode>");
ds.setMaxIdle(1);
ds.setMaxWaitMillis(40000);
I have replaced the localhost with the corresponding IP. However when i run the code, i always get the error table not found.
I have created a new user which can connect from other machines and the user has all of the required privileges. i have tried connecting from cmd prompt on client system and the connection works as expected queries run as expected. i tried connecting from mysql WorkBench and the connection works from client system. but the connection doesn't work from Java code. What am i missing?
I have added an entry in client system hosts file as follows ServerName And i tried using the ServerName in place of IP address in java code. Even this didn't work.