what is the GROOVY connection string to an JDBC database with SSPI = True? I am running this from SoapUI Free version - jdbc

I'm trying to do this:
import groovy.sql.Sql
def sql = Sql.newInstance(
url:'jdbc:sqlserver://localhost\\myDB',
user:'server\user', //this I don't think I need because of SSPI
password:'password',
driver:'com.microsoft.sqlserver.jdbc.SQLServerDriver',
SSPI: 'true'
)
The problem I'm having is that this connection is just timing out. I can ping the machine. I can also connect to the database with Managment Studio logged into my SSPI user (or whatever you call it, I start the Management Studio with a different user)
So I've tried that with my SoapUI as well, started the program as a different user, but I still time out when I initiate the connection. So something is very wrong with my connection string and any help would be appreciated.
P.S. Yes, I don't know what's up with the \ backslashes after the URL to the server, I guess it indicates that it's at the root. If I don't use them I get a message that I'm on the incorrect version.

And then we found the answer..... First of all I had the wrong JDBC driver installed. You need to head over to microsoft to get the real deal:
https://www.microsoft.com/en-us/download/details.aspx?id=11774
Then you need to unpack this one, place the 4 or 4.1 version in your bin directory of SoapUI. (You are apparently supposed to use Lib/Ext, but that doesn't work for me)
Then, since we are trying to use SSPI or Windows Authentication, to connect to the SQL server, you need to place the sqljdbc_auth.dll from the driver/enu/auth folder. This is used in one of your path's or in SoapUI Lib folder. Remember to use the 32 bit dll for 32 bit SoapUI!!! I did not since my system is 64.....
After this, I used this string, but now you have the setup correct, so it should work fine as long as you remember to start SoapUI up using the correct windows user. (Shif-right click - start as different user - use the same user you have started the SQL server with)
Again, I wasn't completely aware of this from the start (yes, total newbie here) and it failed.
Finally, when you have done all this, this is the string that works - and probably a lot of derivatives since the failing part here were the driver and dll.
def sql =Sql.newInstance("jdbc:sqlserver://localhost;Database=myDB;integratedSecurity=true","com.microsoft.sqlserver.jdbc.SQLServerDriver")

Related

firebird, Bad File Descriptor/Your user name and password are not defined

I am trying to set up a test environment on my mac (os 10.12) and it requires Fishbowl/Firebird DB. No matter what I do i bounce back and forth between these two errors:
isql localhost:/Users/me/Fishbowl/database/data/EXAMPLE.FDB
which gives me:
Your user name and password are not defined. Ask your database
administrator to set up a Firebird login.
And anything to do using gsec to create user or change password:
And:
Statement failed, SQLSTATE = HY000 operating system directive stat
failed
-Bad file descriptor
This is supremely frustrating. Fishbowl Client itself seems to hit this DB just fine. I have chmod 770 the /tmp/firebird directory and even tried to chown the example.fdb file itself.
Can anyone tell me how I might hit this DB from my java app or commandline? Both ways produce these errors.
1) Your connection line starts with "localhost:". That means you user TCP/IP connection to reach the database server. And the database server is running in a separate process. That means chmod and chown should not matter as long as there is firebird daemon server running and listening at TCP port ( default is 3050 AFAIR, you can read the value of your installation in the text file firebird.conf ).
Indeed, there is so-called "embedded server" or "embedded mode" where the server is loaded as DLL/SO library into the application. But then the connection string can not have network protocol prefix, so that should NOT be your case.
2) You can check documentation at http://firebirdsql.org/manual/isql-switches.html to specify your user and password in the isql command line. The Firebird has one built-in superuser, namely "SYSDBA". Regarding the password it might be a bit complicated.... It differs by Firebird version and platform
2.0) whatever SYSDBA password might be set by the server installation, if server comes in a bundle with some application the said application can override it later. Then you would either have to contact application developers or try to remove the bundled FB and install your own vanilla one, risking rendering the application no more functioning.
2.1) Windows installation of FB 2.x sets the "default" SYSDBA password as "masterkey" (only 8 first symbols actually matter)
2.2) Linux installation of FB 2.x generates a random SYSDBA password and saves it into a text file in Firebird folder.
2.3) MacOS ? Don't know. Perhaps it is closer to Linux than to Windows. So try to find such a text file and try "masterkey"
2.4) With FB 3 the authentication methods and configuration was greatly overhauled, so... So it is quite hard to tell something specific. At least for me.
3) I don't know what Fishbowl ever is, but Google suggests this: https://www.fishbowlinventory.com/wiki/Fishbowl_for_Mac
If that is so, then check the bottomline examples at that page. They stress that you should sudo all those commands. That also makes sense because
3.1) Firebird daemon might have "trusted authentication" enabled, mapping FB users to Operating System users. On UNIX that would at least map SYSDBA to root. On Windows - to Administrator (however it is localized). This does not have to be enabled, but if it is then sudo UNIX command is exactly what makes applications run with OS superuser grants and might explain lack of user and password in the command line examples.
3.2) Firebird embedded server/mode work as part of an application process, and especially with CS (Classic Server) package on UNIX the command line utilities tend to fall into this mode. Then again it needs to be run as root to read highly sensitive data from Firebird Security Database, thus the need to sudo the command. Granted, I do not think your isql command might ever run in embedded mode - because you do specify "localhost:' prefix. But the example at the wiki link above - backup and restore - they use local connection strings, so they probably do run as embedded. So that might give you yet another hint - to try remove "localhost:" prefix from the connection string and to sudo isql rather than running it from regular user. It would hardly be a normal mode, but for test purposes why not.
Hope this helps.
PS. you might also try this Firebird IDE - it is simplistic, but again, for testing purposes... http://www.flamerobin.org/dokuwiki/wiki/manual

Server name dissapears from rdoConnection.Connect string

I'm working with an old Visual Basic 6 application that connects to an Oracle11g server using Remote Data Objects (RDO) 2. Here is my code:
Dim rdoCon As New rdoConnection
rdoCon.Connect = "DRIVER={Microsoft ODBC for Oracle};SERVER=os11atst.world;"
Debug.Print rdoCon.Connect '1
'Prompt the user to enter credentials and connect to the server:
rdoCon.EstablishConnection rdDriverComplete, False
Debug.Print rdoCon.Connect '2
The first Debug.Print gives me this (as expected):
DRIVER={Microsoft ODBC for Oracle};SERVER=os11atst.world;
However, the second one gives me this:
DRIVER={Microsoft ODBC for Oracle};UID=username;PWD=password;
The SERVER parameter is missing, even though the connection works fine. This is a problem for me, because I need to know what server the connection is to. I can not simply use the information from the first string, because the user is (and should be) able to change the server in the prompt that asks for username and password.
This problem arose from nowhere, possibly in connection to an upgrade from Windows XP to 7. Previously the program did not exhibit this behaviour, or so I am told by older colleagues. Not 100% sure that is correct, though.
How can I prevent the dissaperance of the server name? Can I get the name of the server in any other way than looking at the connection string?
I am not interested in solutions that include upgrading to something newer than RDO. For external reasons I am stuck with it.
rdoCon.EstablishConnection will override whatever you had previously set.
It sounds like the problem is in the DSN that is installed on this new machine. Compare it to the DSN that was installed on the previous machine. It had a configuration that you are missing on this new machine.
I have developed a not so pretty workaround to solve this. I have a table called SETTINGS containing columns NAME and VALUE. For every database I have simply added the setting servername together with the appropriate value. All I need to do to find out what server I am connected to is then to query the DB:
SELECT value FROM settings WHERE name = 'servername'
This is of course quite an ugly hack, so any better solutions would be welcome.

Could not obtain information about Windows NT group / user, error code 0x3a

I am trying to deploy a SQLCLR library to SQL Server 2008 R2. In visual studio I have set up the data connection and it works correctly (I can run queries), but when I try to deploy I get the message "Error: Could not obtain information about Windows NT group / user , error code 0x3a."
This is strange because I have set up the data connection to use SQL server authentication on a different user name.
I receive the same error when I run CREATE ASSEMBLY while logged in to the SQL management studio with the different user name.
To add to the mystery, when I deploy using permission set SAFE everything is fine. However my assembly requires EXTERNAL ACCESS.
What could be the problem with deploying my assembly?
This issue wasted so much time I feel compelled to share the solution so that nobody else falls into the same trap.
Issue was resolved by setting the SQL Server Active Directory Helper service to run on Manual, then rebooting the server.
This issue arose in a different environment for me:
Windows 10 box;
The user Windows complained about was an AZUREAD user;
On my Win10 box there was no SQL Server Active Directory
Helper service, so I couldn't try the original solution posted by
ose.
I was able to work round the issue by removing the AZUREAD user as a SQL Server user while I added the assembly.
In my case that user was not essential to have as a SQL Server user, but I dare say it would be possible to re-add the user back later should this be required.

MVC 3 - Writing to productive Database on SQL Server 2005 does not work (testing on local SQL Server 2008 does work)

I'm a bit confused. I built my MVC 3 project which works fine in my development environment and the integrated IIS in Visual Studio 2010.
After deploying it to an IIS 7 it seemed to work, too. Reading does. But when I try to change some database values, it simply does not do anything. It seems to work, but after a reload of the changed values, they aren't changed at all.
Development database is on a local MS SQL Server 2008 and production on a remote Server with SQL Server 2005 (in this case, but the version will differ later on). Is there any difference? The user in the connection string has full rights, since changing works via Management Studio.
The connection string looks like this:
<add name="MyDBEntities"
connectionString="metadata=
res://*/Models.MyDB.csdl|
res://*/Models.MyDB.ssdl|
res://*/Models.MyDB.msl;
provider=System.Data.SqlClient;
provider connection string="
data source=10.90.0.88;
initial catalog=MyDB;
persist security info=True;
user id=foo;
password=bar;
multipleactiveresultsets=True;
App=EntityFramework""
providerName="System.Data.EntityClient" />
Thanks in advance.
PS: I build the project with Entity Framework 4.1 which is installed on the server. Well, reading does work though...
I would suggest ensuring that you have the correct connection details. The easiest way I can think of would be :
Create a new text file ( f.e. connection.txt )
Rename '.txt' to '.udl'
Double-click the created connection.udl file
Provide all the required connection details, hit 'Test connection' button
If it works, hit 'OK' button, open the file with Notepad - connection string will be inside of your connection.udl file. If it doesn't work - you need to find out proper server details ( check instance name, port number, if your user has the correct permissions )

tns not resolving correctly through webservice

I realise there are some similar questions on here already but I couldn't see one that matched my problem so I'm afraid I had to ask a new question.
I have a webservice running on a server, which is throwing a ORA-12154: TNS:could not resolve the connect identifier specified" error. However when I log onto the said server i am able to tnsping the entry successfully, and connect to it via sqlplus, but not through the webservice.
If anyone has any suggestions as to things to look for then I would greatly appreciate it.
Cheers
Some other things to look at include:
If you're using a service name instead of SID, are you specifying the entire service name?
If you're using the ORACLE_SID environmental variable, check the case (mydb vs MYDB)
Check for a sqlnet.log file
If you're using a username/password#SID connect string, you may need to quote your password if it contains special characters (like an # symbol).
The webservice can't find tnsnames.ora which usually means that you didn't set up Oracle's environment properly when starting the process. This usually means you didn't source oraenv.sh in the shell script which starts it.
So your interactive login works - what is different between your interactive login and the user that runs your web service?
Are they the same user? If not then you will need to update some of your configs in order to make the Oracle client files available to the webservice.
Details like Operating System, Oracle Version, etc are always a help.

Resources