Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connect to db, simple question !!

 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I must connect to a remote Sql Server DB througth java !
I have these data:

IP Server: 192.168.3.6
Server Name: TEST
DB Name: db_test
Login: sa
Password: sa

Is it this ip address correct ?
I think this is a local address

With this code



I have error "java.sql.SQLException: Network error IOException: Connection refused: connect"

Telnet 192.168.3.6 1433 give an error !!!
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you check if the tcpip protocol is enabled on that MSSQL server?
 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I resolved my problem, correct connection url is



 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New problem

Server admin change sql server authentication mode from sql to windows mode !
Web server and sql server are on different machines in same local network but not in domain !

How can I change my connection string to use windows authentication ?

I found this on jtds documentation but my sql server isn't on a domain !!!


domain
Specifies the Windows domain to authenticate in. If present and the user name and password are provided, jTDS uses Windows (NTLM) authentication instead of the usual SQL Server authentication (i.e. the user and password provided are the domain user and password). This allows non-Windows clients to log in to servers which are only configured to accept Windoes authentication.
If the domain parameter is present but no user name and password are provided, jTDS uses its native Single-Sign-On library and logs in with the logged Windows user's credentials (for this to work one would obviously need to be on Windows, logged into a domain, and also have the SSO library installed -- consult README.SSO in the distribution on how to do this).

 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can connect to it via SQL Server's management console using windows integrated authentication? What domain is the user you do that in?
 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:
You can connect to it via SQL Server's management console using windows integrated authentication? What domain is the user you do that in?


I can't understand your questions

I can't connect to sql server with Sql Server Management Studio !
Web server (my machine) and Sql Server are on the same local network 192.168.3
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't connect at all? Speak to your database administrator. If you need access to work she/he should be able to give it to you.
 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can access to sql server only with remote connection + sql server management studio (on sql server) !
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK. Who do you connect as? What domain is that user in?
 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mmm
From remote desktop access (windows xp)

computer : 192.168.3.6
username : username
password : password
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, you RDP to the server and connect as admin? Speak to your SQL Server administrator. No point trying to guess what valid credentials could be when there is someone who could just tell you.
 
Fred Artes
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Sturrock wrote:
Ah, you RDP to the server and connect as admin?


Yes

Paul Sturrock wrote:
Speak to your SQL Server administrator. No point trying to guess what valid credentials could be when there is someone who could just tell you.


Server admin give me only

1) sql server url
2) db name
3) instance name
4) username
5) password

He said me that sql server is not on a domain !!
What can I ask him to solve my problem ?

Thank you very much for your help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic