Question

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

Was it helpful?

Solution

removed the instance parameter and it worked fine

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top