Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
CometKeeper
Starting Member
4 Posts |
Posted - 2006-12-09 : 10:16:39
|
Hello, I can't resolve the following problem, I think it is a very stupid task, but I can't find it: 0. I need to access to SQL dbs through jdbc from my java application. Before to create java I did as follow:1. I installed SQL Server Express2. I created a user with password (SQL authentication)3. I set both Windows e SQL authentication in surface area cfg4. I set only TCP/IP remote connections5. I set specific port 1433 in the protocols tcp in "All IPs" 6. I can't connect through sqlcmd or osql.7. I CAN connect through SQL Server Manager studio or how hell it is called!The error is (I have italian version, so I try to transalte for you):say user id is cometk and pass is 123c:\>sqlcmd -U cometkPassword: HResult 0x4818, level 14, state 1Login failed for user 'cometk'.HResult 0x2746, level 16, state 1Provider TCP: Connection interrupted from the remote hostslqcmd: error: Microsoft SQL Native Client : connection error while communicating.Can anyone help me? Can anyone guide me to configure SQL Server to make remote connections? :) Thanks bye from Italy CometKeeper... A Dream Guardian... |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-12-09 : 10:39:57
|
It looks like you are connecting fine, but the login is denied. Did you provide the password? Try this:sqlcmd -Q"select top 1 * from sysobjects" -dpubs -Ucometk -Ppassword_for_cometk http://www.elsasoft.org |
|
|
CometKeeper
Starting Member
4 Posts |
Posted - 2006-12-09 : 12:30:54
|
sigh, unfortunately, it doesn't work. Exactly the same error...sigh!I know it is quite complex and long, but can anyone tel me the procedure to configure SQL Server and the procedure to create users that can remotely connect. In this way I could see if some step is missing. I know SQL language, but SQL Server seems to me to be not quite standard SQL. When I used MySQL I did not have any problems. If you please I will appreciate it very much.Thank you... CometKeeper... A Dream Guardian... |
|
|
CometKeeper
Starting Member
4 Posts |
Posted - 2006-12-09 : 15:07:35
|
Ok, ok, now seems to work, with the command line:sqlcmd -S SERVERNAME\SQLSERVERINSTANCENAME -H host -U user -P passwordif I remove -S option it doesn't work. But now I have two problems, one regarding java, and the other regarding SQL Server, I will post those two questions maybe you can help me with both:1. [JAVA] do you know how to create the url string with all parameters for DriverManager.getConnection() method??2. [SQL Server] if one doesn't know the instance name and only knows the address of the remote host how can he connect to the remote server?Thank you for your patience...CometKeeper... A Dream Guardian... |
|
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-12-09 : 16:43:21
|
quote: Originally posted by CometKeeper2. [SQL Server] if one doesn't know the instance name and only knows the address of the remote host how can he connect to the remote server?
You have to know what server you are connecting to. an IP address works fine, but if you want to connect to a named instance at a certain IP, you must specify it, eg 111.222.333.444\InstName. If you provide no instance, it will connect to the default instance (if it exists). http://www.elsasoft.org |
|
|
CometKeeper
Starting Member
4 Posts |
Posted - 2006-12-09 : 17:08:51
|
Mmmh, ok. So...If when I remove -S option I get the error this means that in my SQL server is not present a default instance?If it is so, is there a way to create a default once?Bye CometKeeper... A Dream Guardian... |
|
|
PSamsig
Constraint Violating Yak Guru
384 Posts |
Posted - 2006-12-10 : 07:39:31
|
When you install SQL Server Express you will at an early stage be given the an option to use 'Advance' options, do so, and you can make the installation a default instance.Alternatively you can run the installation program with the following parameters:/qb ADDLOCAL=All INSTANCENAME=MSSQLSERVER SAPWD=a_strong_password DISABLENETWORKPROTOCOLS=2 SECURITYMODE=SQLwhich will install a default instance with all components, mixed mode authentication with the sa password set to 'a_strong_password' and TCP/IP connections allowed.-- If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime. |
|
|
|
|
|
|
|