I'm trying to connect a Java based program running through Tomcat to a CONNX database, but I'm getting the error in the title. This is the code I have, with some identifying information removed:
OnChildClickListener
I've been using instructions from:
"praxav11" I got from the DSNR tool, according to which is the CDD-DSN for the CDD I want so I'm pretty confident that is right.
For the gateway I've tried both the server name and the server IP. Username and password I'm quite confident are correct and I would get a different error for those anyway I guess.
Does anybody have any ideas for what is wrong or suggestions for what to try? I'm really drawing a blank on this and have tried brute forcing it but I just can't get it to work.
The full error is:
namespace app\modules\forum;
class Module extends \yii\base\Module
{
public function init()
{
parent::init();
$this->modules = [
'admin' => [
// you should consider using a shorter namespace here!
'class' => 'app\modules\forum\modules\admin\Module',
],
];
}
}
答案 0 :(得分:0)
好点...也许你可以尝试这个解决方法,因为你在Tomcat ..
使用此链接
http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html
在上下文文件中设置数据库资源。
请在您的应用程序的web.xml文件中引用它。
并编写一个代码片段,查找JNDI并建立连接。
这将通过TomCats的眼睛确认问题是什么。
别忘了将包含驱动程序的CONNX jar文件复制到 运行代码之前,Tomcat home(CATALINA_HOME)。
答案 1 :(得分:0)
Class.forName("com.Connx.jdbc.TCJdbc.TCJdbcDriver").newInstance();
TCJdbcDataSource ds = new TCJdbcDataSource();
ds.setGateway("<GateWay_IP>");
ds.setPort((short)7500); //default port
ds.setDSN("<Your_DSN_IP>");
ds.setUser("<UserName>");
Connection con = ds.getConnection();
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);