我现在工具和环境都装好了 eclipse+Mysql+tomcat如何配置链接数据库?要具体的方法    谢谢大家了~

解决方案 »

  1.   

    这个不用在csdn问吧  去百度知道就能解决
      

  2.   

    先google,自己实在找不到在csdn
      

  3.   


    import java.sql.Connection ;
    import java.sql.DriverManager ;
    import java.sql.SQLException ;
    public class ConnectionDemo{
    // 定义MySQL的数据库驱动程序
    public static final String DBDRIVER = "org.gjt.mm.mysql.Driver" ;
    // 定义MySQL数据库的连接地址
    public static final String DBURL = "jdbc:mysql://localhost:3306/mldn" ;
    // MySQL数据库的连接用户名
    public static final String DBUSER = "root" ;
    // MySQL数据库的连接密码
    public static final String DBPASS = "mysqladmin" ;
    public static void main(String args[]){
    Connection conn = null ; // 数据库连接
    try{
    Class.forName(DBDRIVER) ; // 加载驱动程序
    }catch(ClassNotFoundException e){
    e.printStackTrace() ;
    }
    try{
    conn = DriverManager.getConnection(DBURL,DBUSER,DBPASS) ;
    }catch(SQLException e){
    e.printStackTrace() ;
    }
    System.out.println(conn) ; // 如果此时可以打印表示连接正常
    try{
    conn.close() ; // 数据库关闭
    }catch(SQLException e){
    e.printStackTrace() ;
    }
    }
    };
      

  4.   


    出现了这个问题   
    Several ports (8080, 8009) required by Tomcat v6.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
    怎么解决
      

  5.   

    开了俩tomcat,从进程里面关掉一个....
      

  6.   

    楼主应该自己学会看exception。
      

  7.   

    想哭啊~~ 我啥都不会怎么看啊  就知道html和c++ 拜托来个热心的大哥教我弄吧