I'm very new to Knime so please be gentle with me!
I'm trying to set up a connection to Microsoft SQL Server using the Database Reader node but I am running into some issues, mainly due to my lack of knowledge I think.
When I try to configure the Database Reader node I am presented with a drop down where the only option is:
sun.jdbc.odbc.JdbcOdbcDriver
And another dropdown for the database URL:
jdbc:odbc:<database_name>
This is followed by the various username/password and SQL script options.
From what I've managed to find out, I believe I need the Microsoft JDBC driver, so my question is how do I load this driver in order to establish a connection to a SQL Server database?
I have looked in Preferences-->KNIME-->Database Driver where I am presented with an empty list box and an option to add new, unfortunately I don't know where the driver would be, if the driver is already included in my KNIME installation or whether I need to download it first.
I've looked at a few other forum posts but haven't found one that explains the process of getting drivers.
Any pointers would be much appreciated!
Thanks
Si
ps Using Windows XP 32 bit, have SQL Server 2008 and 2005 management studios installed on client machine with the server running 2005.
The driver you are looking for is very likely sitting in your database installation, usually sqljdbc.jar. After you have registered this driver package in the KNIME preferences, you can adjust the settings in the database nodes, such as:
Ok, after reading a few details online, I've tried using JTDS as the driver instead as apparently this is the way to go for WIndows Authentication Support:
I'm predictably still having issues connecting with this, I suspect it's because I need to place a file called ntlmauth.dll in a specific location. The SSO readme that is included with JTDS states:
"Place this DLL anywhere in the system path (defined by the PATH system variable) and you're all set"
Unfortunately, that doesn't make a whole lot of sense to me. Does the DLL need to go on the client machine or the server?
I am not familiar with this library, but I think the DLL has to go on the client into the KNIME installation <knime>/jre/lib/ext. Please let me know, if this helps.
Yet another guess, what happens, if you again use the original driver and try to login without using the DOMAIN? Is it possible that the database credentials are different from the normal user account?
Ok, my server is actually operating in mixed mode, so switching back to the Microsoft driver, I have tried giving KNIME the SA account details(dangerous game). I suspect there may be 2 problems here, I think there is a problem with how I'm trying to get Windows Authentication working but I also suspect there is a problem with how I have written my Database URL. I think it's best to address the URL issue first.
Annoyingly, the database I am trying to access has a space in it's name, KNIME is giving me the following error messages whenever I try to use square bracketing or single/double quotes to get around the spaces:
WARN DatabaseReaderConnection PreparedStatment not support by database: Invalid object name 'PATIENTS IP'.
WARN Database Reader com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'PATIENTS IP'.
WARN Database Reader java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database ""PATIENTS IP"" requested by the login. The login failed.
WARN Database Reader java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "'PATIENTS IP'" requested by the login. The login failed.
WARN DatabaseReaderConnection PreparedStatment not support by database: Invalid object name 'PATIENTS IP'.
WARN Database Reader com.microsoft.sqlserver.jdbc.SQLServerException: Invalid object name 'PATIENTS IP'.
WARN Database Reader java.sql.SQLException: com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "[PATIENTS IP]" requested by the login. The login failed.
I know I'm doing something stupid on this, I just can't figure out what.
Ok, having switched back to JTDS in order to try and get Windows Authentication working, the SA log in also works here.
When I remove the SA credentials to make JTDS default to Windows Authentication it fails and gives the following error message:
WARN Database Reader java.sql.SQLException: java.sql.SQLException: I/O Error: SSO Failed: Native SSPI library not loaded. Check the java.library.path system property.
I believe this is because the aforementioned ntlmauth.dll which is needed for windows authentication is sitting in the wrong location, so I'm now trying to identify where java.library.path is looking, I thought it was looking at C:\WINDOWS\system32 on the client machine as this is the location specified in Control Panel-->System-->Advanced-->Environmental Variables-->System Variables-->Path
This thread seems to support what I'm doing but despite placing different versions of ntlmauth.dll into C:\WINDOWS\system32 I'm still not having any success:
Did you make any progress connecting to your SQL Server? Is there any other table in your database, you can read from and that does not contain any spaces. I just want to make sure, that spaces are not a problem. However, I would also go back to the standard MS SQL driver without using any additional DDLs. So the correct syntaxt results to:
I had the same problem, in the end I gave up trying to connect using a windows login and created a SQL Server login instead. This worked without any problems.
ERROR Database Connector Execute failed: Could not create connection to database: Connection to database 'jdbc:sqlserver://sqlexpress:1433;database=DB;integratedSecurity=true;Timeout=100' timed out
Usually a timeout points to network connection issues (routing, firewalls, ...). When using an unknown tool to connect to a database, I usually try to connect from the same machine using a familar tool, like Visual Studio or SQL Server Management Studio. Once you get that to work, connecting using JDBC is usually very easy.
If your SQL server is running on the same machine, you could try using 127.0.0.1 as address instead of 'sqlexpress'
I have a SQL Server connectivity issue that we struggle on and can't resolve.
The connection and the workflow works seamlessly when launched from Knime (executing manually). But the Database Connector triggers an error when the workflow is launched by a commande line.
I may have badly configured the jdbc driver but it is strange that it works when executed manually.
What is more confusing is that the same workflow works in command line on another client machine
(windows 8 / Knime 2.11.2 = works)
(Windows server 2012 / Knime 2.11.3 = failed)
The error in the dos window is : Error Knime-worker-0 Database Connector
Execute failed: Could not create connection to database: com.microsoft.sqlserver.jdbc.SqlServerDriver
I tried your suggestion (127.0.0.1) and the IP address in my machine (192.168.1.63). Unfortunately, increasing the timeout setting nor changing the IP address did the trick.
I have an ODBC connection to the SQL server that I use with R smoothly on the same machine and, of course, the SQL Server Manager works fine.
I don't know what else to do to get the SQL connection working!
But what if i would like to connect to another host and port. Not with the comma but backflash. e.x.: HSQL01A\i0097
In ODBC it is working fine, but in KNIME i have some troubles with syntaxe.
What would be the right syntaxe and URL?
In advance thank you for your help.