MS SQL driver issue with Struts 2 tomcat 7 - sql-server

I am developing web application using Tomcat 7 and connecting to a MSSQL 2008 DB.
While executing a DB operation from any Java console based application, it succeeds. Same code fails to execute while performing same operations from web application with the message "No suitable drivers found". We are using sqljdbc4
URL private String url = "jdbc:sqlserver://10.100.41.232;databaseName=iptvdb;";
Not able to understand the this strange behaviour. Any workarounds?
Also tried with : port 1433 but it's still not working.

That error means it cant find the JDBC driver on your classpath. Do you have the JDBC driver? You need to have the MySQL JDBC drivers. If you dont have it, it can be downloaded from the MySQL website.
If you do have the driver or have downloaded it, make sure it is in the correct place. It needs to be placed on your classpath. This usually means one of two places
With your Struts application under the WEB-INF/lib folder
With the application server. For tomcat this is usually in $CATALINA_HOME/lib

Related

ORA-28040: After Upgrade Database to 12c from 11g

Problem Statement:
We are doing a migration activity in which we have migrated DATABASE from ORACLE 11g to ORACLE 12c.
After upgrade one of our application which is using jdk 6 with ojdbc6.jar (JDBC Driver) is not able to connect the 12c database.
Below error we are getting :
java.sql.SQLException: ORA-28040:
No matching authentication protocol
after Upgrade Database to 12c
Configuration
JDK Version : 1.6
JDBC Driver : ojdbc6.jar
Database Version : Oracle 12c
SQLNET.ALLOWED_LOGON_VERSION_SERVER = 11
SQLNET.ALLOWED_LOGON_VERSION_CLIENT = 11
Workaround tried:
1) We tried to run a simple jdbc application with jdk1.6 and ojdbc6.jar it was successful. Also it is as per Oracle Compatibility matrix.
2) We asked to update the parameter SQLNET.ALLOWED_LOGON_VERSION_SERVER = 8 but security team cannot do it as it does not comply on security standards.
Please suggest how we should proceed forward to fix this issue.
The problem was then weblogic.jar and from the classpath of weblogic.jar, ojdbc14.jar was being referred. We checked in WL_HOME\server\lib library and found that ojdbc14.jar was there. We just let keep it there but copied ojdbc6.jar in some external directory and loaded same in CLASSPATH before all jars. Below is from oracle docs-
This driver is installed in the WL_HOME\server\lib folder (where WL_HOME is the folder where WebLogic Server is installed) with weblogic.jar. The manifest in weblogic.jar lists this file so that it is loaded when weblogic.jar is loaded (when the server starts). Therefore, you do not need to add this JDBC driver to your CLASSPATH. If you plan to use a third-party JDBC driver that is not installed with WebLogic Server, you must install the drivers, which includes updating your CLASSPATH with the path to the driver files, and may include updating your PATH with the path to database client files. See "Supported Database Configurations" on the Oracle Fusion Middleware Supported System Configurations page at http://www.oracle.com/technology/software/products/ias/files/fusion_certification.htmlOpens a new window.
If you plan to use a different version of any of the drivers installed with WebLogic Server, you can replace the driver file in WL_HOME\server\lib with an updated version of the file or add the new file to the front of your CLASSPATH.
So if you are facing the same issue I would like to suggest-
1) Check for the Oracle driver (ojdbc) - as the most post on StackOverflow suggest same.
You can check ojdbc driver compatibity here
2) If you cannot change driver immediately the change below in sqlnet.ora
SQLNET.ALLOWED_LOGON_VERSION_SERVER=8
SQLNET.ALLOWED_LOGON_VERSION_CLIENT=8
(SQLNET.ALLOWED_LOGON_VERSION is depreciated in 12c. Also, please be noted that In 12c, the default value for the SQLNET.ALLOWED_LOGON_VERSION_SERVER parameter has been updated to “11”. This means that database clients using pre-11g JDBC thin drivers cannot authenticate to 12.1 database servers unless the parameter is set to the old default of “8”)
For your reference, please check-
https://docs.oracle.com/database/121/UPGRD/deprecated.htm#UPGRD60010
https://docs.oracle.com/database/121/UPGRD/afterup.htm#UPGRD60157
Thanks.

SqlFileStream error after SQL Server 2016 (SP2-CU3) upgrade (the device is not ready

We've had this .NET component (.exe) running to migrate documents between 2 databases for almost a year. Console app is using the System.Data.SqlTypes.SqlFileStream .NET class to read/write from file system.
After a recent upgrade of SQL Server to SQL Server 2016 (SP2-CU3) (KB4458871) - 13.0.5216.0 (X64) - the console app has stopped working and throws the following error when trying to open specific document for read operation:
System.ComponentModel.Win32Exception (0x80004005): The device is not ready
We double-checked FILESTREAM properties on both databases to make sure they are enabled (just in case they were removed somehow during the upgrade) and we confirmed they are configured as needed.
We are running out of troubleshooting options as we don't know what to check for. All ports seem to be open between the app server where this tool runs and the database servers (same as before).
Let me know if anybody has any idea what could have changed after recent SQL Server upgrade.
just in case someone faces the same issue... we were able to resolve this by actually disabling FILESTREAM, rebooting servers, enabling FILESTREAM back on.
Issue was related to some un-mapped path of physical drives for SQL (sorry i cant provide more details)

JDBC URL connection to SQL Server using Windows Authentication in JIRA plugin

I am currently at my wits end. I am trying to connect a JIRA plugin (Atlassian Java SDK) to a SQL Server 2012 database. It's required that I use Windows Authentication, but JIRA is logging:
com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication.
I've read that this can be combatted by adding the sqljdbc_auth.dll file to the program's library path, but there are no references specifically for JIRA plugins on how to do this other than for the base JIRA dbconfig.xml, which I am not using. This is a connection made within the plugin using the code:
String url = String.format("jdbc:sqlserver://%s:1433;databaseName=%s;integratedSecurity=true;domain=XXXX;", server, database);
I have tried to add the dll file to the following locations, all to no avail:
C:/{JIRA INSTALL PATH}/bin
C:/{JIRA INSTALL PATH}/jre/bin
C:/{JAVA INSTALL PATH}/jre_8.x.x/bin
What gives?
UPDATE:
I have gone in and added the JDBC JAR/DLL to the classpath/library path respectively in the JIRA Windows service configuration tool. Still getting the same error.
UPDATE 2:
I have switched to using the JTDS driver to see if JIRA was just not able to use the standard JDBC driver for some reason, but getting a similar error:
java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
I have also created a new Java app to test this in a controlled environment, but do not get this error after adding the ntlmauth.dll file to the C:\Windows\System32 directory. This leads me to believe this may be a bug within JIRA or I have something configured improperly.
Here is my own conclusion after many weeks of searching:
It is (currently) impossible to do this without the use of a password (which is sometimes the entire point of using Windows/Active Directory credentials). You can however use the JTDS driver in junction with a domain, username, and password to authenticate to servers that require windows authentication. This does not solve the core issue, but from what I can tell is the only current solution close enough to it.

How to connect to sql DB from soapUI using connection string?

I would like to ask someone who already tried to connect to SQL database from soapUI opensource version.
I have a test step JDBC request where I try to test and connect to my sql database. I use opensource version of soapUI. I read how it should be set up but still experience some problems.
This is what I do:
I installed java 8 and jdbc driver version 4.1. Added jdbc jar file to SoapUi/jre/bin folder as it is said in documentation for soapUI. This version of driver should work with Java 8.
Then in Driver field I write
com.microsoft.sqlserver.jdbc.SQLServerDriver
In connection string:
jdbc:sqlserver://Sservername:portnumber;databaseName=Consumption;username=alyona.kovalyova;password=mypassword
I get error saying
Can't get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'alyona.kovalyova'. ClientConnectionId...
I use my domain account because in our company the policy does not allow us to use database user. Because of this I tried to add integratedSecurity parameter to the string which should allow to login with windows account like this:
jdbc:sqlserver://S23-AS:1433;databaseName=Consumption;integratedSecurity=true
I also get error:
Can't get the Connection for specified properties; com.microsoft.sqlserver.jdbc.SQLServerException: This driver is not configured for integrated authentication. ClientConnectionId..
Does anyone encountered the same issue before? Could you give some recommendation?
For integrated authentication to work you'll need sqljdbc_auth.dll matching your environment (32bit / 64bit) in your library path (putting it in bin as well might help already)

I/O Error: SSO Failed: SSPI Not Initialized

I am using pentaho data integration 4.1 (Kettle) to build an ETL system. My customer requires connecting to database (MS SQL Server) using window authentication, I knew that Kettle supported it . However when I run my Kettle job, it throws the exception
"I/O Error: SSO Failed: SSPI Not Initialized".
From an article on a forum, I copy library sqljdbc_auth.dll into jre/bin folder. The result is quite good, I can use window authentication to connect to SQL server. But this function is not stable, I mean sometimes it works well, sometimes it throws exception
"I/O Error: SSO Failed: SSPI Not Initialized".
Please tell me how to fix this error.
Thank you.
To connect to SQL Server 2008, I had to install the 'Microsoft JDBC Driver 4.0 for SQL Server' and then add the path to sqljdbc_auth.dll to Spoon.bat in %PENTAHO_DI_JAVA_OPTIONS%. Like this:
set OPT=%PENTAHO_DI_JAVA_OPTIONS% "-Djava.library.path=%LIBSPATH%;C:\PROGRA~1\MICROS~1.0FO\sqljdbc_4.0\enu\auth\x86;C:\PROGRA~1\IBM\SQLLIB\BIN" "-DKETTLE_HOME=%KETTLE_HOME%" "-DKETTLE_REPOSITORY=%KETTLE_REPOSITORY%" "-DKETTLE_USER=%KETTLE_USER%" "-DKETTLE_PASSWORD=%KETTLE_PASSWORD%" "-DKETTLE_PLUGIN_PACKAGES=%KETTLE_PLUGIN_PACKAGES%" "-DKETTLE_LOG_SIZE_LIMIT=%KETTLE_LOG_SIZE_LIMIT%"
Ugly, but that's Java under Windows for you. Works quite reliably now though.
Are you using the JTDS driver? Try that combined with the ntlmauth.dll - that works great for us when running PDI on Windows Server 2003 connecting to various remote sqlserver databases.
We place the DLL in this folder:
libswt\win64
I've had the same issue while using JDBC 1.2.2 with MSSQL 2008. It turns out that there is a bug in the driver, making it randomly crash if you initialize it with more than one connection.
If we used only one initial connection to the DB this error never presented itself.
The issue is fixed in a later versions of JDBC. We currently use 1.3.0 and I/O Error: SSO Failed: SSPI Not Initialized never comes up.

Resources