GWT JDBC LDAP连接失败 [英] GWT JDBC LDAP connection fails

查看:232
本文介绍了GWT JDBC LDAP连接失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用jdbc将我的GWT应用程序连接到ldap服务器,但是无法使其工作到目前为止。



这是我的尝试的代码示例连接到它:

 字符串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



当我运行应用程序时,我得到以下错误消息:



java.sql.SQLException:没有找到适合的驱动程序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

解决方案

您通常需要先注册JDBC驱动程序,然后才能连接到后端。



尝试类似

  DriverManager.registerDriver(new com.octetstring.jdbcLdap.sql。 JdbcLdapDriver()); 


$ b 有关注册驱动程序的方式


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();
    }

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: No suitable driver found for jdbc:ldap://SERVERIP:389/dc=SERVERNAME,dc=office,dc=COMPANY,dc=com?SEARCH_SCOPE:=subTreeScope

I would be thankful for any help

Edit: 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

解决方案

You generally need to register the JDBC driver before you can connect to the backend.

Try something like

DriverManager.registerDriver(new com.octetstring.jdbcLdap.sql.JdbcLdapDriver());

before setting up the connection.

More general information on ways of registering drivers.

这篇关于GWT JDBC LDAP连接失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆