GWT JDBC LDAP 连接失败 [英] GWT JDBC LDAP connection fails
问题描述
我正在尝试使用 jdbc 将我的 GWT 应用程序连接到 ldap 服务器,但目前无法正常工作.
I am trying to connect my GWT application to an ldap server using jdbc, but could not make it work so far.
这是我尝试连接到它的代码示例:
Here is a code sample of my attempt to connect to it:
String ldapConnectString = "jdbc:ldap://SERVERIP:389/dc=SERVERNAME,dc=office,dc=COMPANY,dc=com?SEARCH_SCOPE:=subTreeScope";
java.sql.Connection con;
try {
con = DriverManager.getConnection(ldapConnectString,"cn=USERNAME","PASSWORD");
} catch (SQLException e) {
System.out.println("An error has ocurred!!! Connection failed");
e.printStackTrace();
}
我用来写这个的例子是:http://myvd.sourceforge.net/bridge.html
The example I used to write this is: http://myvd.sourceforge.net/bridge.html
当我运行应用程序时,我收到以下错误消息:
When I run the application I get following error message:
java.sql.SQLException: 找不到适合 jdbc:ldap://SERVERIP:389/dc=SERVERNAME,dc=office,dc=COMPANY,dc=com?SEARCH_SCOPE:=subTreeScope 的驱动程序
java.sql.SQLException: No suitable driver found for jdbc:ldap://SERVERIP:389/dc=SERVERNAME,dc=office,dc=COMPANY,dc=com?SEARCH_SCOPE:=subTreeScope
感谢您的帮助
我提供的代码示例在 RPC 访问的服务器端运行.我在从这里下载的 lib/目录中包含了 2 个 jar 文件:http://sourceforge.net/projects/myvd/files/jdbc%20ldap%20bridge/jdbc%20ldap%20bridge%202.1/jdbc-ldap-2.1.zip/download
The code sample I provided is running on server side accessed by RPC. I included 2 jar files in my lib/ directory downloaded from here: http://sourceforge.net/projects/myvd/files/jdbc%20ldap%20bridge/jdbc%20ldap%20bridge%202.1/jdbc-ldap-2.1.zip/download
推荐答案
一般需要注册JDBC驱动才能连接后端.
You generally need to register the JDBC driver before you can connect to the backend.
试试类似的东西
DriverManager.registerDriver(new com.octetstring.jdbcLdap.sql.JdbcLdapDriver());
在建立连接之前.
有关 驱动注册方式.
这篇关于GWT JDBC LDAP 连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!