hi and good day to all,
i have a problem with my data from the mysql. i have string data from the db and want to process in program(java app),but no out appeared.i suspect something is wrong with the input because, there is no problem if i run with direct input.


this is code to query data from mysql.Example input: 2,2,2,2 is in string

public static void main (String[] args)
       {

           Connection conn = null;
           String input = new String();
           int t=0;
           int id =0;
           try
           {


			   //register jdbc driver for mysql
			   Class.forName ("com.mysql.jdbc.Driver").newInstance ();
               //define url of db on localhost
               String url = "jdbc:mysql://localhost/t-way";
               //get connection to d db for s username n password
               String userName = "root";
               String password = "anything";
               conn = DriverManager.getConnection (url, userName, password);

               System.out.println ("URL "+url);

               Statement  s = conn.createStatement();

               //execute sql statement
			   ResultSet rs = s.executeQuery("SELECT * FROM input WHERE 'check'=0");
			   int count=0;
			   while (rs.next())
			      {

			   			id= rs.getInt("id");
			   			input= rs.getString("in");
			   			t = rs.getInt("number");
			   			++count;

			   	   }

                            rs.close();
			    s.close();

                            Process go = new Process(input , t);
   			    go.release();



           }

i can get data from this code and can pass it to Process class

this is code to give direct input to Process class

public class Try
{


 public static void main(String[] args)
     {


	      Process go = new Process("2,2,2,2" , 2);
          go.release();

      }

}

the Process goes well and i got the output. i have no idea whats the problem but i suspect the content of the string is different between direct input n db

Why don't you try printing out what's returned? Also, where is the catch block? You're not just ignoring exceptions, are you?

Why don't you try printing out what's returned? Also, where is the catch block? You're not just ignoring exceptions, are you?

im sorry.its my mistake.actually,there is nothing wrong with this code.it was my ignorance that kind of input cant be processes by my algorithm....its really shamefull...


im sorry....and thanks for the concern

This article has been dead for over six months. Start a new discussion instead.