AnsweredAssumed Answered

Java - SqlException on connection

Question asked by cymerman on Nov 6, 2017
Latest reply on Nov 6, 2017 by vkaufmann

Hi, im trying to connect to osi DB through Java and osi JDBC driver

 

my code:

 

public void name() throws Exception {
   String url = "jdbc:pioledbent://my-osi-server/Data Source=AFServer;Integrated Security=SSPI;";
   Class.forName("com.osisoft.jdbc.Driver").newInstance();
  try (Connection con = DriverManager.getConnection(url, createPropertiesList());
   PreparedStatement stmt = con.prepareStatement(SQL_QUERY);
   ResultSet rs = stmt.executeQuery()) {
   while (rs.next()) {
  //handle rs data
   }
  } catch (Exception e) {
  e.printStackTrace();
   }
  }
private Properties createPropertiesList() {
  Properties plist = new Properties();
   plist.put("ProtocolOrder", "Https/Soap:5461,NetTcp:5462");
   plist.put("LogConsole", "True");
   plist.put("user", LOGIN);
   plist.put("password", PASSWORD);
   plist.put("TrustedConnection","True");
   plist.put("LogLevel", "5");
   return plist;
}

 

and have error:

 

java.sql.SQLException: Connection to https://my-osi-server:5461/DataAccessServer/Query failed. Error: [PI SQL DAS gSOAP Channel] An HTTP processing error occurred

Connection to net.tcp://my-osi-server:5462/DataAccessServer/Query failed. Error: [PI SQL DAS NetTcp Channel] Could not connect to net.tcp://my-osi-server:5462/DataAccessServer/Query. The connection attempt lasted for a time span of 00:00:01.7222899. TCP error code 10061: No connection could be made because the target machine actively refused it 10.112.56.234:5462.

No connection could be made because the target machine actively refused it 10.11.12.13:5462

Could not connect using none of the specified protocols.

 

i tried to telnet my-osi-server on ports 5461 and 5462 and didnt reach it...

 

What i have to do to have possibility to connect to osi DB trough JDBC? I need to install some additional stuff?

Outcomes