문제

ive got a method that connects to sql server using JTDS

String url = "jdbc:jtds:sqlserver://192.168.12.123;instance=server-e61t7rvb;DatabaseName=test";
     String driver = "net.sourceforge.jtds.jdbc.Driver";
    String userName = "sa";
    String password = "hello";

                Class.forName(driver);
        conn = DriverManager.getConnection(url, userName, password);
        System.out.println("Connected to the database!!! Getting table list...");
        DatabaseMetaData dbm = conn.getMetaData();
        rs = dbm.getTables(null, null, "%", new String[] { "TABLE" });
        while (rs.next())  System.out.println(rs.getString("TABLE_NAME"));

using this i can connect fine to SQL 2008 but when i change it to a SQL 2000 server i get "server has no instance named " for the instance name i am running

select @@servername 

note that i can use the instance name to log into the server from my computer using sql management studio.

any help much appreciated

도움이 되었습니까?

해결책

removed the instance parameter and it worked fine

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top