File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Finding out the correct URL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Finding out the correct URL" Watch "Finding out the correct URL" New topic
Author

Finding out the correct URL

Neha Gap
Greenhorn

Joined: May 30, 2007
Posts: 29
Hi Ranchers,

I am trying out this code..




And this is the output at my console

Does this driver accept my URL? true
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:545)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at DBAccess.main(DBAccess.java:14)


Now, I know that the DriverManager accepts the given url, but it wont get a connection. How do I find out the correct URL, I'm using SQL Server 2005 Express edition. If possibly the username, password are incorrect, how can I reset the same?

Thanks!
Neha.
Neha Gap
Greenhorn

Joined: May 30, 2007
Posts: 29
Ok, well, made a silly mistake out there.
But now I'm getting the error

Does this driver accept my URL? true
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: connect
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)


I've done everything to enable tcp/ip remote connections on my sql server, but it still gives me this error, besides, I cant even telnet localhost 1433. The etc/services file shows the port number is correct though.

Any idea how to get the thing to work with said port and url?

Thanks!
Neha.
 
 
subject: Finding out the correct URL