租房买房买生意上iU91
楼主: Yiben
打印 上一主题 下一主题

[电脑] JavaBean Expert Help!!!

[复制链接]   [推荐给好友]
楼主
发表于 2002-7-14 10:52 | 显示全部楼层
My Code:
  protected String

    // Borland JDataStore
    driver = "com.borland.datastore.jdbc.DataStoreDriver",
    db = "jdbc:borland:dsremote://localhost/db/agent.jds",

    // postgreSQL
    // driver = "org.postgresql.Driver",
    // db = "jdbc:postgresql://localhost/pla",

    // mySQL
    // driver = "org.gjt.mm.mysql.Driver",
    // db = "jdbc:mysql://localhost/pla",

    user = "sa",
    password = "sa";

  protected Connection conn = null;
  protected boolean updatable = false;

  // constructor
  public DBA() throws Exception {
    Class.forName(this.driver).newInstance();
    this.conn = DriverManager.getConnection(this.db, this.user, this.password);

    // the way in J2EE, dbName must be register in the J2EE server.
    // this.conn = ((DataSource) new InitialContext().lookup(dbName)).getConnection();
  }
回复 支持 反对

使用道具 举报

2#
发表于 2002-7-18 14:02 | 显示全部楼层
Just one thing, about my code:

I tested the code in all the db connections, jdatastore,mysql, portgresql and hsql, and in two environment, the tomcat4.03 and j2ee 3.1, it works in all the testing.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

Copyright © 1999 - 2024 by Sinoquebec Media Inc. All Rights Reserved 未经许可不得摘抄  |  GMT-4, 2024-6-8 21:46 , Processed in 0.046945 second(s), 27 queries .