小编idi*_*ius的帖子

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

为什么Oracle Sql*Plus会打印许多不需要的标题?

当我运行一个应该返回确切行的sql语句时,sqlplus打印列名称多次?为什么?

oracle sqlplus

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

Java IO - 在写入其他应用程序时读取一个大文件

我想使用java来读取weblogic日志文件,而weblogic正在将日志写入其中(缓冲),但我只想读取内容,当我开始阅读它时.

我怎样才能做到这一点 ?

public class DemoReader implements Runnable{

    public void run() {
        File f = new File ("c:\\test.txt");
        long length = f.length();
        long readedBytes = 0; 
        System.out.println(length);
        try {
            BufferedReader fr = new BufferedReader(new FileReader(f));
            String line = "";
            while((line = fr.readLine()) != null && readedBytes < length){
                readedBytes += line.getBytes().length;
                if(readedBytes > length){
                    break;
                }else{
                    System.out.println(line);
                }
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
Run Code Online (Sandbox Code Playgroud)

java file-io

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

h2混合模式连接问题

我在servlet上下文监听器中启动h2数据库:

public void contextInitialized(ServletContextEvent sce) {
     org.h2.Driver.load();
     String apprealPath = sce.getServletContext().getRealPath("\\");
     String h2Url = "jdbc:h2:file:" + apprealPath + "DB\\cdb;AUTO_SERVER=true";
     LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); 
        StatusPrinter.print(lc); 
     logger.debug("h2 url : " + h2Url);
     try {
   conn = DriverManager.getConnection(h2Url, "sa", "sa");
  } catch (SQLException e) {
   e.printStackTrace();
  }
  logger.debug("h2 database started in embedded mode");
        sce.getServletContext().setAttribute("connection", conn);
    }
Run Code Online (Sandbox Code Playgroud)

然后我尝试使用dbvisualizer使用以下url连接到h2:

jdbc:h2:tcp://localhost/~/cdb
Run Code Online (Sandbox Code Playgroud)

但得到这些错误消息:

An error occurred while establishing the connection:
   Type: org.h2.jdbc.JdbcSQLException   Error Code: 90067   SQL State: 90067
Message:
   Connection is broken: "Connection refused: connect" [90067-148] …
Run Code Online (Sandbox Code Playgroud)

h2

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

在Web应用程序中为每个用户创建日志文件是否合适

当错误发生时,我发现很难跟踪大型和混合(会话)日志文件中的问题?所以,我想为每个用户创建一个日志文件,但我担心如果我这样做会对性能产生很大影响.有超过1000个用户,从现在开始,最多在线用户数低于100

对不起我的英语,我希望你们能理解我在说什么......

java logging

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

标签 统计

java ×2

file-io ×1

h2 ×1

javascript ×1

logging ×1

oracle ×1

sql ×1

sqlplus ×1