database connectivey

Hi

I am facing a problem

i want to connect to database named cns in my server using connection string in jsp

: here is the code

===============================================

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

//Make the Connection to the database.

//Replace IP, Name, Username, Password to match your information.

java.sql.Connection connection=java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://cnsserver:1433/cns","frsuser", "us3rfr5");

//Get SQL Statement.

//Replace TableName to your table's name.

java.sql.ResultSet rs=connection.createStatement().executeQuery("select * from deed");

===========================================

It gives me a error (invalid url )

and if i remove the databse name "cns " then i get a error

"invalid table name "

please suggest what to do

[933 byte] By [rohit_sharma76a] at [2007-11-27 6:42:58]
# 1
You can find SQL server JDBC documentation here: http://msdn.microsoft.com/data/jdbcThe article "Connecting to SQL Server with the JDBC Driver" might be interesting.
BalusCa at 2007-7-12 18:13:24 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
What is the SQL Server version? For SQL Server 2005 the port is not 1433.
dvohra09a at 2007-7-12 18:13:24 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
Really? If you follow the documentation I gave, they mentions that the default port is 1433.
BalusCa at 2007-7-12 18:13:24 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4
if i remember it correctly , the url should like this:"jdbc:microsoft:sqlserver://cnsserver:1433;DatabaseName=cns"not sure. i'm using jtds driver now.
j_shadinataa at 2007-7-12 18:13:24 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
Thanks all got it working
rohit_sharma76a at 2007-7-12 18:13:24 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...