我正在尝试将通过 Tomcat 运行的基于 Java 的程序连接到 CONNX 数据库,但标题中出现错误。这是我的代码,删除了一些识别信息:
String driver = "com.Connx.jdbc.TCJdbc.TCJdbcDriver";
String connectionString = "jdbc:connx:DD=praxav11;Gateway=<server name>";
String user = "<user>";
String pass = "<pass>";
Class.forName(driver);
dbConnection = java.sql.DriverManager.getConnection(connectionStr, user, password);
我一直在使用以下说明:
“praxav11”我从 DSNR 工具中获得,根据它是我想要的 CDD 的 CDD-DSN,所以我非常有信心这是正确的。
对于网关,我尝试了服务器名称和服务器 IP。我非常确信用户名和密码是正确的,无论如何我猜我会得到一个不同的错误。
有人对什么是错误的有任何想法或对尝试什么有任何建议吗?我真的对此一无所知,并尝试过暴力破解它,但我就是无法让它发挥作用。
完整的错误是:
com.$company.DBDataSetException: java.sql.SQLException: Connection refused: connect
at com.$company.DBDatabase.setConnection(DBDatabase.java:43)
at em.cabbench.$client.ERPInterface$client.connectToConnx(ERPInterface$client.java:137)
at em.cabbench.$client.ERPInterface$client.getERPRawMaterialPrice(ERPInterface$client.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at em.cabbench.RequestTypes.call(RequestTypes.java:1120)
at em.cabbench.CabBenchSrv.processRequest(CabBenchSrv.java:988)
at em.cabbench.CabBenchSrv.doGet(CabBenchSrv.java:828)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
Caused by: java.sql.SQLException: Connection refused: connect
at com.Connx.jdbc.TCJdbc.TCJdbcDriver.connect(TCJdbcDriver.java:251)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.$company.DBDatabase.setConnection(DBDatabase.java:40)
... 23 more
Couldn't connect to CONNX
java.lang.NullPointerException
at com.$company.DBDatabase.closeConnection(DBDatabase.java:66)
at em.cabbench.$client.ERPInterface$client.getERPRawMaterialPrice(ERPInterface$client.java:171)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at em.cabbench.RequestTypes.call(RequestTypes.java:1120)
at em.cabbench.CabBenchSrv.processRequest(CabBenchSrv.java:988)
at em.cabbench.CabBenchSrv.doGet(CabBenchSrv.java:828)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)