myeclispe在本机上,而SqlServer2005在另一台电脑上,该怎么连,求具体步骤

解决方案 »

  1.   

    打开myeclipse,工具栏有个window,点开最下面有个Show View,然后再选择other,模糊搜索DB两个字
    试图DB Brows出来了,选中它右键有个new的选项,在里面填好即可
      

  2.   

    sql server 2005 远程连接打开了吗?先用Sql server客户端测试下
      

  3.   

    把localhost换成对方的ip地址不就完了 
      

  4.   

    [Quote
    把localhost换成对方的ip地址不就完了
    [/Quote]
    这个完全能够解决!lz是用hibernate链接sqlserver2005?这样也是一样的,要导入包
      

  5.   

    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;public class BaseDao {
    public final static String DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver";
    public final static String URL="jdbc:sqlserver://localhost:1433;databaseName=数据库名";
    public final static String DBNAME="用户名";
    public final static String DBPASS="用户密码";

    public Connection getConn() throws ClassNotFoundException,SQLException{
    Class.forName(DRIVER);
    Connection conn=DriverManager.getConnection(URL,DBNAME,DBPASS);
    return conn;
    }

    public void closeAll(Connection conn,PreparedStatement pstmt,ResultSet rs){
    if(rs!=null){
    try {
    rs.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    if(pstmt!=null){
    try {
    pstmt.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    if(conn!=null){
    try {
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    }
    }
    }

    public int executeSQL(String preparedSql,String[] param){
    Connection conn=null;
    PreparedStatement pstmt=null;
    int num=0;
    try {
    conn=this.getConn();
    pstmt=conn.prepareStatement(preparedSql);
    if(pstmt!=null){
    for(int i=0;i<param.length;i++){
    pstmt.setString(i+1, param[i]);
    }
    }
    num=pstmt.executeUpdate();
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    }finally{
    this.closeAll(conn, pstmt, null);
    }
    return num;
    }

    }
    楼主有疑惑就问我!
      

  6.   


    还有更加简单的是
    点击myeclipse 右上角 debug旁边的黄色小加号
    选择Myeclpse Datebase Explorer
    在里面自己写
    但是连接jar包 自己一定要搞到  放到WEB-INF下的lib下
      

  7.   

    Data Source Explorer视图
    右键Database Connections选择new,Connection Profile Types选择SQL Server
    里面配置。注意要有驱动程序jar包sqljdbc.jar
      

  8.   

    IP地址要写myeclipse那台电脑的地址,不是本地的!
      

  9.   

    和连接自己电脑上的SQL Server2005差不多呀,将localhost改成别人的IP就可以了呀。
      

  10.   

    (SqlServer2005上的)IP地址,用户名,密码,通过JDBC就可以连上了