小编Moi*_*nGK的帖子

我可以使用像ApacheDS这样的LDAP服务器作为桌面应用程序的持久性解决方案吗?

一个家伙建议我使用ApacheDS作为我的数据库(MySQL)的替代品你可以在这里找到讨论 我是LDAP和ApacheDS的新手(实际上我昨天也不知道),我搜索了它并阅读了一些文章,最后我得到了这个页面.

考虑LDAP网络协议(如果是)是否可能或者使用像ApacheDS这样的LDAP服务器作为桌面应用程序的持久性解决方案是明智的选择?

LDAP是否需要运行应用程序服务器(如tomcat)?你可以点亮我:) thnx

java database ldap apacheds

2
推荐指数
1
解决办法
1641
查看次数

无法在linux中从java调用mysqldump

这是代码:

public static File backupDB() throws IOException {

    File file = null;

    file = new File("BKUP_DB_"
            +   Calendar.getInstance()).replace("/", "-") + ".sql");

    String executeCmd = "mysqldump -u " + "dbUserName" + " -p" + "dbPassword"
    + " " + "dbName" + " > " +file.getPath();



    Process runtimeProcess;
    try {

        runtimeProcess = Runtime.getRuntime().exec(executeCmd);
        int processComplete = runtimeProcess.waitFor();

        if (processComplete == 0) {
            System.out.println("Backup created successfully");
            runtimeProcess.destroy();
            return file;
        } else {

            System.out.println("Could not create the backup");
        }

    } catch (Exception ex) { …
Run Code Online (Sandbox Code Playgroud)

java mysql linux runtime.exec

2
推荐指数
1
解决办法
1338
查看次数

使用struts 2和hibernate在jsp页面中显示Blob(图像)

我设法将我的mysql数据库中的图像存储为Blob.(我也在使用hibernate)现在我正在尝试加载该图像并将其发送到jsp页面,以便用户可以查看图像.

这是我的struts 2动作类

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.Blob;
import org.hibernate.Hibernate;

import domain.post.image.Image;



public class FileUploadAction {

  private File file;

  @SuppressWarnings("deprecation")
  public String execute() {

      try {
          System.out.println(file.getPath());
          Image image = new Image();
          FileInputStream fi = new FileInputStream(file);

          Blob blob = Hibernate.createBlob(fi);
          image.setImage(blob);
          image.save();

      } catch (FileNotFoundException e) {

          e.printStackTrace();
      } catch (IOException e) {

          e.printStackTrace();
      }
      return "success";
  }

  public File getFile() {
      return file;
  }

  public void setFile(File file) {
      this.file = file;
  } …
Run Code Online (Sandbox Code Playgroud)

java hibernate struts2 java-ee web

1
推荐指数
1
解决办法
1万
查看次数

使用java代码列出特定PostgreSQL数据库中的所有表

实际上我已经google了一点,我需要相应的SELECT命令来跟随PostgreSQL shell命令:

\dt schemaname.*
Run Code Online (Sandbox Code Playgroud)

我设法使用以下代码获取所有数据库:

            Statement statement = (Statement) connection.createStatement();
            ResultSet rs = statement
                    .executeQuery("SELECT datname FROM pg_database");
            while (rs.next()) {
                System.out.println("DB Name : " + rs.getString(1));
           //i need another while here to list tables 
           //inside the selected database
}
Run Code Online (Sandbox Code Playgroud)

我尝试了以下声明,但没有运气:

statement.executeQuery("SELECT table_schema,table_name FROM "
                                + rs.getString(1)
                                + " ORDER BY table_schema,table_name");
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误:

org.postgresql.util.PSQLException: ERROR: relation "template1" does not exist
  Position: 37
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
    at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
    at com.isiran.rayten.rg.db.bare.wrapper.PGWrap.main(PGWrap.java:64)
Run Code Online (Sandbox Code Playgroud)

java sql postgresql

1
推荐指数
2
解决办法
5972
查看次数

缺少com.google.android:android:jar的dependencies.dependency.version'

我试图用eclipse运行一个简单的虚拟android项目,我也试图使用maven.我已经按照这篇文章中接受的答案的教程

这是我的pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>ir.raysis</groupId>
    <artifactId>quickie</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>quickie</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.version></platform.version>
        <android.plugin.version>3.5.3</android.plugin.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>${android.plugin.version}</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <platform>18</platform>
                    </sdk>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
Run Code Online (Sandbox Code Playgroud)

这是我的控制台日志:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects... …
Run Code Online (Sandbox Code Playgroud)

eclipse android maven

0
推荐指数
1
解决办法
8084
查看次数