• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

url ?

 
apos apos
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic