ilakic
asked on
Java can't connect to named instance of SQL server 2005
Hi
I'm having an issue connecting to a named instance of SQL Server 2005 from within a Java program.
I'm issuing the following command:
if( dbtype.equals("ora") )
{ Packages.java.sql.DriverMa nager.regi sterDriver ( new Packages.mks.frame.sql.jdb c.oracle.D river() );
}
if( dbtype.equals("sql") )
{ Packages.java.sql.DriverMa nager.regi sterDriver ( new Packages.mks.frame.sql.jdb c.mssql.Dr iver() );
}
con = new Packages.java.sql.DriverMa nager.getC onnection( url, dbuser, dbpass );
con.setTransactionIsolatio n( java.sql.Connection.TRANSA CTION_READ _COMMITTED );
The variable "url" is set to:
jdbc:jtds:sqlserver://cgcs qldev\\sql 2005:1433/ Ticket_Sys tem
When I run the command, I get the following exception:
java.sql.SQLException: Unknown server host name 'cgcsqldev\sql2005'.
I've been reading that Java doesn't like named instances of SQL server. The identified solution was to use the default instance and specify a port number since, technically, each instance should be running on its own port. However, this is not the case at the client that I am at right now. All instances (named and default) are listening on port 1433.
Is there any way for me to connect to a named instance of SQL Server 2005 through Java without requiring that it use a different port?
Thanks a lot.
I'm having an issue connecting to a named instance of SQL Server 2005 from within a Java program.
I'm issuing the following command:
if( dbtype.equals("ora") )
{ Packages.java.sql.DriverMa
}
if( dbtype.equals("sql") )
{ Packages.java.sql.DriverMa
}
con = new Packages.java.sql.DriverMa
con.setTransactionIsolatio
The variable "url" is set to:
jdbc:jtds:sqlserver://cgcs
When I run the command, I get the following exception:
java.sql.SQLException: Unknown server host name 'cgcsqldev\sql2005'.
I've been reading that Java doesn't like named instances of SQL server. The identified solution was to use the default instance and specify a port number since, technically, each instance should be running on its own port. However, this is not the case at the client that I am at right now. All instances (named and default) are listening on port 1433.
Is there any way for me to connect to a named instance of SQL Server 2005 through Java without requiring that it use a different port?
Thanks a lot.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
this may also help http://www.connectionstrings.com/sql-server-2005