pentaho local and remote connection to sql server - sql-server

This is giving me headache.
I just set up pentaho community edition on my laptop. I was able to connect to mysql server in xampp by following the instructions in the pdf documentation that comes with the enterprise edition getting_started_with_pentaho. I connect perfectly to mysql database.
However I need to also connect both locally and remotely to a sql server (mssql) but follwing the same process as i did for the mysql database does not work.
This is what i did:
I installed SQLServer2008R2SP1-KB2528583-x64-ENU.exe sql server and logged in successfully with the following input
server type: database engine
server name: ME-PC\SQLEXPRESS
authentication: windows authentication
login: ME-PC\ME
password:
Now I downloaded the jdbc driver for mssql from here and extracted the folder to my desktop. The folder contained sqljdbc4.jar and sqljdbc.jar as well as both x64 and x86 versions of sqljdbc_auth.dll.
I am running a x64 OS but but the jdk i installed went to the Programfiles(x86) so I guess the java i had install was for x86. Due to this reason I copied sqljdbc4.jar and the x86 version of sqljdbc_auth.dll to the directorys:
C:\Users\ELRAPHA\Desktop\PENTAHO\biserver-ce\tomcat\webapps\pentaho\WEB-INF\lib
C:\Users\ELRAPHA\Desktop\PENTAHO\administration-console\jdbc
C:\Users\ELRAPHA\Desktop\PENTAHO\data-integration\libext\JDBC
I also enabled TCI/IP on my local sql server.
As I mentioned, am able to connect to sql server via the management studio but when i try to create a new connection through pentaho in the web browser with the following
hostname: localhost
database name: master
instance name: ME-PC\SQLEXPRESS
port: 1433
username: ME-PC\ME
password:
I get the error
error connecting to database [mssqllocal]
org.pentaho.di.core.exception.KettleDatabaseException:
Error occured while trying to connect to the database
error connecting to database:(using class com.microsoft.sqlserver.JDBC.SqlServerDriver)
The TCP/IP connection to the host localhost, port 1433 has failed.
Error: Connection refused: connect.
I dont get what am doing wrongly especially since mysql was to straight forward. Been at this all day. I need help . Please can anyone see my error or something that am missing here? HELP

If you want to connect through JDBC to SQL Server via Windows Authentication, then the sqljdbc_auth.dll must be in the right location. On my system (x86) that this is relative to the install directory of the sqljdbc4 driver. By "extracted the folder to my desktop" I assume you mean you ran the installer, and that's where you choose the location of the driver. For example on my system, this file is not in the Pentaho folders, it's in:
C:\Program Files\Microsoft JDBC Driver 4.0 for SQL Server\sqljdbc_4.0\enu\auth\x86
I would ensure that both 32 and 64 bit versions of sqljdbc_auth.dll are in their respective locations since you seem to have a mixed system.
Alternatively, you can use SQL Server authentication which is simpler, but doesn't integrate with AD, etc.
EDIT:
Oops, I forgot something very important. The JVM must be made aware of the location of sqljdbc_auth.dll. I had to add the path of that dll to %LIBSPATH% in Spoon.bat (I'm only using PDI).
So essentially I changed this block of code in the batch file:
:USE32
REM ===========================================
REM Using 32bit Java, so include 32bit SWT Jar
REM ===========================================
set LIBSPATH=libswt\win32
GOTO :CONTINUE
:USE64
REM ===========================================
REM Using 64bit java, so include 64bit SWT Jar
REM ===========================================
set LIBSPATH=libswt\win64
set SWTJAR=..\libswt\win64
to this:
:USE32
REM ===========================================
REM Using 32bit Java, so include 32bit SWT Jar
REM ===========================================
set LIBSPATH=libswt\win32;C:\PROGRA~1\MICROS~1.0FO\sqljdbc_4.0\enu\auth\x86
GOTO :CONTINUE
:USE64
REM ===========================================
REM Using 64bit java, so include 64bit SWT Jar
REM ===========================================
set LIBSPATH=libswt\win64
set SWTJAR=..\libswt\win64
Note the shortened path names. In your case, I would add an entry for the 64 bit lib also since you have a mixed environment.
Essentially whatever program you're starting that uses the sqljdbc driver, you must add the path the sqljdbc_auth.dll to the Java library path (i.e. -Djava.library.path=%LIBSPATH%). After doing that, my instance of PDI can connect to SQL Server via Windows Authentication with no trouble. I don't use the BI_Server or the Admin Console, but I suspect you'll have the same issue.
Note, I have no experience with SQLEXPRESS, or a mixed 32 bit JVM/64 bit OS environment. There could be problems there too, but if you want to use Windows Authentication with SQL Server, you have to at least deal with the library path issue.

If you are using a intance of Sql Express in local machine and connecting Pentaho, you must empty the field Port Number. Try the configuration below:
Host Name: localhost
Database: database_name
Instance Name: sqlexpress
Port Number:
User Name: user_name
Password: *****

In case of having issues, together with empty the port number, is to manually set the instance name as a manual parameter:
instanceName=SQLEXPRESS
The default pentaho dialog (at least to 8.3) generates only the code "instance=SQLEXPRESS"

Related

Ansible install SQL Server Express 2016

I have a problem when I tried install SQL Server Express 2016 through config.ini
Preamble
remote server is Windows 2016 ENG with last patch
On my disk c:\temp I have the SQL setup files, and the sql_conf.ini file.
On the instance I have installed all modules and service needed by SQL.
If I open a rdp session on the server and run the command 'c:\temp\SQLEXPRADV_x64_ENU\SETUP.EXE
/configurationfile=c:\temp\sql_conf.ini' it's works withous any
problem.
the user that Ansible use to connect is named "ansible" and is on Administrators group.
The playbook is:
- name: 'Installo SQL Server Express 2016'
win_shell: 'c:\temp\SQLEXPRADV_x64_ENU\SETUP.EXE /configurationfile=c:\temp\sql_conf.ini'
args:
chdir: 'c:\temp'
Result is:
There was an error generating the XML document. Error result: -2068774911
I tried replace win_shell with the modules win_command and win_psexec but not have any change.
I also tried with directive become_method: runas but nothing change.
After many tries, I found this behavior:
If a login, only one time on remote server, via rdp with "ansible" user, (and then logoff) the palybook work without any problem!
I have found a workaround using win_dsl module (and not the sql_conf.ini file), but I would like understand why with the modules win_shell, win_command and win_psexec, not work.
Someone have any idea?

SQL Server connection error - Data source name not found and no default driver specified

When running a third party developed EXE located on the shared folder of Windows Server 2012 R2, which connects to SQL Server 2012 Express, the following error occurs:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
When the EXE is 'Run as Administrator' it works fine. But this application interfaces with Office and other programs, so running as administrator puts it into protected memory space that conflicts with other applications. I need it to open normally, as before.
This error has only occurred since client workstations had Windows 10 1803 and higher installed. Bizarrely, workstations that updated to 1803 and higher are unaffected. Only on new installs has the problem occurred.
There was something about 1803 which changed the network stack, client side, that caused a lot of different problems for SQL connections and I have seen a hundred different solutions but none work in our case.
Client machines connect to Server 2012 using domain login accounts. Each domain user account is given local admin rights and full administrator rights. The client workstations are normal Windows 10 Pro install with ESET antivirus. When testing the ODBC connection, it is successful and works. Only when running the program does the error occur.
On the Server side I have.... Enabled Named Pipes, Disabled and Removed SMB1.0
So what is going on here? Why from 1803 on must we run as administrator to get a connection?
Data source name not found
I would first check if the Data Source is defined below "User" or "System" .
If it is User for the Administrator there is no way to access it except if the user previously run it by using the option "Run with administrative permission"
In case it is defined as System DSN likely the user after 1803 does not have enough permission to access the registry where it is stored, so this is the most probable case scenario.
The optimal is to see if you can modify your connection using OLE or something else rather than ODBC so it can be DNSless, eventually try to define a DSN with the same name below User with the same user who is running it that should be read before the framework is going to look for the same DSN name under the system / local machine registry section.
To troubleshoot deeper registry permission issues you can use the former Sysinternals procmon downloadable from MS website, this must executed using "Run with administrative permission"

How do create ODBC data source by using oracle instant client?

As I knew, Oracle Instant Client is free from OTN for anyone to use in a development or production environment. But in order to create a ODBC data source on windows, i need a tns service name? How can I create odbc data source on windows os by using oracle instant client?
Check the ODBC installation instructions http://www.oracle.com/technetwork/database/features/oci/odbc-ic-releasenotes-094306.html :
On Windows
Install the Instant Client Basic or Basic Light package.
Download the Instant Client ODBC package. Unzip it
in the same directory as your Basic or Basic Light package.
Execute
odbc_install.exe from the Instant Client directory. If Instant
Client is 11g or lower, start the command prompt with the
Administrator privilege.
On Linux I sometimes hand edit my .odbc.ini file to change the TNS connect string in the ServerName field, for example to set it with the 'Easy Connect' TNS syntax:
ServerName = localhost/orclpdb

In play framework I am unable to connect to sql server where windows authentication is enabled

I am trying to connect to SQL Server from play framework where my SQL Server is hosted on a different machine with Windows authentication enabled. I'm not sure how that can be done in play. I am new to the play work.
This is what I configured in my application.config:
db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.default.url="jdbc:sqlserver://hostname"
db.default.trusted_connection="yes"
db.default.user="hari"
db.default.password="MyPassword"
db.default.host = "hostname"
db.default.logStatements=true
Any help on is appreciated.
There is nothing related to play frame work here , your need to have sqljdbc_auth dll file under your system32 folder and enable integrated security as true.
keep sqljdbc_auth.dll in your windows/system32 folder and it will work.Download sqljdbc driver from this link Unzip it and you will find sqljdbc_auth.dll.Now keep the sqljdbc_auth.dll inside system32 folder and run your program
along with the above changes I modified my application.config as follows
db.default.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.default.url="jdbc:sqlserver://hostname;databaseName=test;integratedSecurity=true"
db.default.trusted_connection="yes"
db.default.host = "hostname"
db.default.logStatements=true

Linking Oracle with SQL Server

I'm trying to link SQL Server 2005 to an Oracle 10g database. I've installed the Oracle client on the SQL server and validated that I can connect to the Oracle database using both tnsping and sqlplus. When I try to run a query in SQL Server I get the following:
OLE DB provider "OraOLEDB.Oracle" for linked server "ORA_CSSA2APD" returned message "ORA-12154: TNS:could not resolve the connect identifier specified".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "OraOLEDB.Oracle" for linked server "ORA_CSSA2APD".
Any ideas? I've tried both of the following queries with no luck:
select * from openquery(ORA_CSSA2APD, 'select count(rowid) from eservice_op.agent')
select count(rowid) from ORA_CSSA2APD..eservice_op.agent
I suspect an environment setting. That is, your session is picking up the TNSNAMES.ORA file but the session underlying SQL Server is not. I'd check were ORACLE_HOME and, possibly, TNS_ADMIN are being set and pointing to.
Are you able to use the easy connect syntax for the database with the SQL Server connection .
IE replace ORA_CSSA2APD with hostname:1521/service_name
ORA:12154 generally means that the alias of the db you're trying to connect to wasn't found in the tnsnames.ora file. (See http://ora-12154.ora-code.com/ a more detailed explanation.)
You need to make sure that the Data Source is an alias that the tnsnames file knows about (on the server where SQL Server resides, regardless of where you're running the queries from); SQL Server is going to be just like any other Oracle client and needs to know where to connect to and without the tnsnames.ora file, it's not going to know the details of where the Oracle db is.
If you don't have access to the SQL Server server (there's one from the department of redundancy department), you'll need to get the server admin to set that up for you.
(The Data Source property of the linked server should be the alias in tnsnames.ora alias for the db you're trying to link to.)
HTH...
TNS error messages generally means the connection is flawed (eg host is unobtainable/timesout on the specified port, or that is simply doesn't know what ORA_CSSA2APD is supposed to point to).
One thing to consider is, are you using a 64-bit Windows and are you using a 32-bit or 64-bit Oracle client (or possibly both). If you've got a 32-bit app running on a 64-bit OS trying to call Oracle, it needs a 32-bit Oracle client. Using a 32-bit client on a 64-bit OS can be tricky and it is safer to NOT install it in the "Program Files (x86)" folder.
Also bear in mind the following
In a 64-bit version of Windows Server
2003 or of Windows XP, the
%WinDir%\System32 folder is reserved
for 64-bit applications. When a 32-bit
application tries to access the
System32 folder, access is redirected
to the following folder:
%WinDir%\SysWOW64
So for 64-bit windows, the 32 bit stuff is in the SysWOW64 folder and the 64 bit stuff is in the system32 folder.
This issue happened to me, as well, but only with certain Windows user accounts. A combination of enabling the "Allow inprocess" provider option for the OraOLEDB.Oracle provide (SSMS > Server Objects > Linked Servers > Provides > OraOLEDB.Oracle), restarting the SQL Server Windows service and lastly adjusting the permissions on the TNSNAMES.ora file directly.
We found that SQL Server, for some unknown reason, started looking for the TNSNAMES.ORA file in default Oracle locations.
We were able to place the TNSNAMES.ORA files in the following locations, with successful results:
For SQL Server 32-bit on 32-bit OS or 64-bit on 64-bit OS
%ProgramFiles%\Oracle
%ProgramFiles%\Oracle\network\admin
For SQL Server 32-bit on 64-bit OS
%ProgramFiles% (x86)\Oracle
%ProgramFiles% (x86)\Oracle\network\admin
We too were able to connect using SQL*Plus, but SQL Server could not. It is important to note that SQL*Plus did not use the same TNSNAMES.ORA file. This is why one worked.

Resources