java - Retrieving data from a database .. -


I view the results by storing the database in the database and using the netbins program. But there is no output and there is no compilation error in it. Do I know what the problem is? Is there a missing jar file

  package database; Import java.io.buffferedReader; Import java.io.IOException; Import java.io.InputStreamReader; Import java.sql *; Public class database {constant connection conn; Public Database () {} Public Connection Connection Receive Public () {Return Conn; } Public static zero master (string [] args throws SQLException {try {class.forName ("oracle.jdbc.driver.OracleDriver"); } Catch (Klassnotfound exception e) {System.out.println ("Could not load driver"); } String user = "system"; // readEntry ("enter userid:"); String pass = "mevalou"; // readEntry ("Enter password:"); Conn = DriverManager.getConnection ("jdbc: oracle: thin: @localhost: 1521: XE", user, pass); String query = "Choose from Reef, Title, Risk_action, RoutMouse, Effect, Probability, Attempts, Finding, Elation, Recommendation with LackOff Defence; The prepared condition myStatement = conn.prepareStatement (query); MyStatement.clearParameters (); Results myResult = myStatement.executeQuery (query); While (myResult.next ()) {string referee = myResult.getString (1); String title = myResult.getString (2); String exposure _rating = myResult.getString (3); String Root_cause = myResult.getString (4); String impact = myResult.getString (5); Probability of string = myResult.getString (6); String Attempt = myResult.getString (7); Finding String = myResult.getString (8); String implements = myResult.getString (9); String recommendation = myResult.getString (10); System.out.println ("=========================================== ================== "); System.out.println ("===================== Lack of defense table ================== "); System.out.println ("Ref:" + Ref); System.out.println ("title" + title); System.out.println ("Risk Ratings" + Risk_Rating); System.out.println ("root cause" + rootmouse); System.out.println ("effects" + effects); System.out.println ("prospect" + prospect); System.out.println ("attempt" + attempt); System.out.println ("find" + finding); System.out.println ("implications" + implication); System.out.println ("Recommendation" + Recommendation);  

P>
  myStatement.clearParameters (); As a result myResult = myStatement ExecuteQuery (query);   

What is the obvious parameter () really necessary? Additionally, remove the query parameter from the executeQuery () method, it is not necessary, because you are already setting it in the created state .

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -