Problem "ConnectionFactory is deprecated"

      Problem "ConnectionFactory is deprecated"

      Sorry that I am a pretty newer with Palo. I just tried to run the example "ListDatabase". But the following code:

      Connection connection = ConnectionFactory.getInstance().newConnection(PALO_SERVER, PALO_SERVICE, PALO_USER, PALO_PASS);

      seems that: "The method newConnection(String, String, String, String) from the type". I cannot successfully use it to get the connection. I use my local server. My Palo and Jpalo API were just download: Palo 3.0 and Jpalo Java API 2.0. How can I do? Any answers are appreciated!

      RE: Problem "ConnectionFactory is deprecated"

      Try this,

      Source Code

      1. public class PaloMain {
      2. private ConnectionConfiguration connection_configuration = null;
      3. private Connection connection = null ;
      4. public PaloMain( String _paloServer, String _paloPort, String _paloUser, String _paloPass, String _db) throws Exception
      5. {
      6. connection_configuration = new ConnectionConfiguration(_paloServer, _paloPort);
      7. connection_configuration.setPassword( _paloUser );
      8. connection_configuration.setUser( _paloPass);
      9. this.Connect(_db);
      10. System.out.println( "Connected to server "+_paloServer+" Port: "+_paloPort+" DB: "+_db );
      11. this.Disconnect();
      12. System.out.println( "Disconnected.");
      13. }
      14. public void Connect(String _db) throws Exception
      15. {
      16. connection = ConnectionFactory.getInstance().newConnection( connection_configuration );
      17. if ( connection == null )
      18. throw new Exception( "Connection failed" );
      19. db = connection.getDatabaseByName(_db);
      20. if ( db == null )
      21. throw new Exception( "Could not set DB" );
      22. }
      23. }


      Holger

      Post was edited 2 times, last by “h_decker” ().