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 url ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "url ?" Watch "url ?" New topic
Author

url ?

apos apos
Greenhorn

Joined: Apr 04, 2006
Posts: 1
Hello i am trying to connect to a database on my sql server 2000
and on running my class i am rerceiving this :

Unable to connect.Invalid url

Could anybody help me ?
I use this
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:xxxx;databaseName=dataSourceName;","username","password");

And also if i have 2 servers should i in one way refer to one of them where my database is?

Thanks
[ April 04, 2006: Message edited by: Bear Bibeault ]
Jignesh Gohel
Ranch Hand

Joined: Dec 28, 2004
Posts: 276
con=DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:xxxx;databaseName=dataSourceName;","username","password");

And also if i have 2 servers should i in one way refer to one of them where my database is?


Try removing the semicolon after datasource name
databaseName=dataSourceName;"

for e.g use this sample url format
"jdbc:microsoft:sqlserver://ur IP or local host ortnumber;SelectMethod=cursor;DatabaseName=ur database name"

In case if u have two servers then u might refer to them through the port numbers on which they are allocated .

Hope this helps


Regards,
Jignesh

The Art Of Life Is To Know When To Be Useless And When To Be Useful - CHUANG TZU
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60048
    
  65

"apos apos",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: url ?
 
Similar Threads
mysql on web server ? ?
DriverManager class
DriverManager.getConnection("...","user","password");
help wanted
How to read from XSD generated database and put that data into XML file.