SQL Server Storage Plugin not Working - sql-server

I am trying to get the SQL Server Plugin working in Apache Drill as outlined here but it seems to be throwing the following error:
error (unable to create/update storage)
My storage config looks like this:
{
type: "jdbc",
enabled: true,
driver: "com.microsoft.sqlserver.jdbc.SQLServerDriver",
url:"jdbc:sqlserver://10.60.68.145;databaseName=Demo",
username:"ApacheDrill",
password:"Passw0rd"
}
I have tried copying both sqljdbc41.jar (from sqljdbc_4.1.5605.100_enu.tar.gz) and sqljdbc42.jar (from sqljdbc_4.2.6420.100_enu.tar.gz) to the drill directory \apache-drill-1.4.0\jars\3rdparty\ but it doesn't seem to make a difference.
The environment details are:
Operating System: Microsoft Windows 8.1 Pro, SQL Server Version: 11.0.3000 and Apache Drill Version: 1.4.0.

Related

Connecting to MSSQLServer 2019 on Windows11 from Apple macOS BigSur using VS for Mac 2022 v17.4

I have an apple desktop computer with Visual Studio for Mac 2022 version 17.4 and wanted to connect to a MS SQL Server database on a windows 11 computer. However, I am able to connect to the windows 11 computer from the Mac and use the shared folders. I have installed the Microsoft odbc drivers, also JDBC drivers. I installed DBeaver and tried but to no avail and lastly installed DBVisualizer which I was able to ping the sql server but still not able to connect. I am getting SQL Server browser not started. But I have verified it on the windows 11 computer that is starts automatically. I have also make sure it is allowed through the windows firewall. Below is the AppSettings.json file.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "ServerName=I-AM-I\\SQLEXPRESS;Initial Catalog=Anglophone;User Id=sa;Password=password;"
},
"AllowedHosts": "*"
}
I thought I was going to get the same result as on windows. I have tried installing Microsoft ODBC and followed the instructions using home-brew. I tried JDBC, DBeaver and finally DbVisualizer. When I use the iODBC administrator I get the following error: 08003 odbc driver connection not open.
When I use the DbVisualizer, I get the following error:
Product: DbVisualizer Free 14.0.1 (build: 3540)
OS: Mac OS X
OS Version: 11.7.1
OS Arch: x86_64
Java Version: 17.0.4.1
Java VM: OpenJDK 64-Bit Server VM
Java Vendor: Eclipse Adoptium
Java Home: /Applications/DbVisualizer.app/Contents/Resources/jre.bundle/Contents/Home
DbVis Home: /Applications/DbVisualizer.app/Contents/Resources/app
User Home: /Users/bainn
PrefsDir: /Users/bainn/.dbvis
SessionId: 131
BindDir: null
An error occurred while establishing the connection:
Long Message:
Cannot open database "AnglophoneLawReports" requested by the login. The login failed. ClientConnectionId:8f9f7741-c0cc-44ff-b1a9-0f8f079c000f
Details:
   Type: com.microsoft.sqlserver.jdbc.SQLServerException
   Error Code: 4060
   SQL State: S0001
I am just hoping to get a simple AppSettings.json connection string format that could connect to SQL server on windows 11. The ability to connect to sql server on windows 11 without installing any container on the mac.
Thank you

Connect to MSSQL from Spring boot application using windows authentication

I am currently using the below properties to connect to a remotely Mssql server from Java spring boot application:
spring.datasource.url=jdbc:sqlserver://ip\\domain;databaseName=name
spring.datasource.username=abc
spring.datasource.password=def
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
The application runs from both windows and unix servers. I need now to start using the windows authentication instead of the db credentials. This is already configured and supported from MSSQL side. From Java spring boot this is not working. I tried to add to the url: integratedSecurity=true it said it cannot find a dll. I added sqljdbc_auth.dll to java jre bin folder and it didnt work.
I'm working on MS SQL Server 2016, Hibernate 5.3.7.Final and Spring bot 2.2.0. For me, adding this line to properties worked: (without jtds!)
spring.datasource.url=jdbc:servername;databasename=your_db_name;integratedSecurity=true
You may also need these properties:
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect
And if you encounter a problem with "no sqljdbc_auth in java.library.path".
You may refer to this answer no sqljdbc_auth.
Try use jtds driver, and in apllication properties use:
app.datasource.youraplication.jdbcUrl=jdbc:jtds:sqlserver://yourBdHost/yourSchemaBd;domain=yourDomain
Download the drivers from:
https://learn.microsoft.com/en-us/sql/connect/jdbc/download-microsoft-jdbc-driver-for-sql-server?view=sql-server-2017
Add the jar to your project Right Click on project - > Build Path -> Configure Build Path - > Libraries -> Add External JARs
Add "integratedSecurity=true" to your connection string and remove username and password

Connecting Phoenix app to MS SQL Azure database

I am trying to connect a phoenix application to MS SQL. After looking around online I came across a couple of adapters called mssql_ecto & mssqlex.
I have added them to the project following the instructions in the readme, installed odbc and checked that the db is online but I am now getting the following error..
[error] Mssqlex.Protocol (#PID<0.13069.0>) failed to connect: ** (Mssqlex.Error) odbc_not_started
My app is configured as below..
config :my_app, MyApp.Repo,
adapter: MssqlEcto,
username: "<my_username>",
password: "<my_password>",
database: "test",
hostname: "<my_server>.database.windows.net",
pool_size: 10
My environment is as follows..
MacOS Sierra 10.12.5
Elixir version: 1.4.4
There is an issue in the mssql_ecto repo already, and I have tried the suggestions from there, but it still has not worked.
If anyone has managed to connect their phoenix/elixir application to MSSQL on macOS and could provide some instructions it would be greatly appreciated (even if it was done in a completely different way to my approach 😉 ).
Side note: Tried it in node with the same db and was able to connect to and query the db.
I've been working through the same issue this week, connecting to an Azure SQL Database, and this is what I've got working.
You are seeing the first of 2 main problems I ran into:
Erlang installed without ODBC
Mssqlex adapter is missing required configuration options
#1: Erlang installed without ODBC
If you've installed Elixir and Erlang using brew, or something like it, you are getting an installation of Erlang that does not include erlang-odbc. In order to remedy this, you will need to install Erlang from source.
I recommend that you install both Erlang and Elixir from source using the method documented here:
http://www.lambdacat.com/how-to-install-elixir-on-mac/
Just make sure that you remove the Kerl option, --without-odbc, before you build Erlang.
Now that you have Erlang installed correctly, the odbc_not_started error should go away... to be replaced by connection errors to the database.
#2: Mssqlex adapter is missing required configuration options
As of this moment, the mssqlex adapter does not support the following configuration options that Azure is looking for:
Encrypt
TrustServerCertificate
Connection Timeout
To get around this issue, I forked the mssqlex library and added those options in a branch. I am not committing to maintaining this so feel free to fork it yourself.
In order to use the modified mssqlex, replace the mix dependency with the github location and branch name:
{:mssqlex, git: "https://github.com/tvanhouten/mssqlex.git", branch: "azure-settings", override: true}
The override: true is important because mssql_ecto has a dependency on the mssqlex version in hex.
Now you can update your configuration:
config :my_app, MyApp.Repo,
adapter: MssqlEcto,
username: "<my_username>",
password: "<my_password>",
database: "test",
hostname: "<my_server>.database.windows.net",
pool_size: 10,
encrypt: "yes",
trust_server_certificate: "no",
connection_timeout: "30
Other "Gotchas" to Look Out For
Azure requires TCP connection:
In order to connect to an Azure SQL Database, you will need to make sure that the hostname: option starts with tcp:. So, all together, it will look like
hostname: "tcp:.database.windows.net"
Mssql_ecto does not support Ecto 2.2+:
If you're getting errors related to Ecto or Ecto.SubQuery, you probably need to make sure that you are using a version of Ecto that is supported by mssql_ecto. At this point in time, that means Ecto 2.1.x. Again, this requires a slight change to your mix dependencies:
{:ecto, ">= 2.1.0 and < 2.2.0"}
Dependency cache and lock issues:
If everything seems to be in order according to the above but it just doesn't seem like the new dependencies are being updated and compiled as expected, do the following:
Run mix deps.clean --all
Delete the mix.lock file from your root project directory
Run mix deps.get
Run mix deps.compile
That should do it!

Laravel SQL Server - PDOException could not find driver on migrate

I have a laravel 5.2 instance configured to run against MS SQL Server. I have downloaded from microsoft the drivers and the connection runs perfect DB::table('usuarios')->select('*')->get(); returns:
[{"id":"5","username":"jtd","password":"$2y$10$t8RXYy\/afaEuIpE8GIk2bOvbHsQoj0fhGPxmo\/3UqJABKVA4I4pHC","email":""}]
But when I try to php artisan migrate i get the:
[PDOException]
could not find driver
Why this is happening?
Stack trace:
c:\wamp\www\presence\webapp>php artisan migrate --verbose
[PDOException]
could not find driver
Exception trace:
() at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\Illuminate\Datab
ase\Connectors\Connector.php:55
PDO->__construct() at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\
Illuminate\Database\Connectors\Connector.php:55
Illuminate\Database\Connectors\Connector->createConnection() at C:\wamp\www\pre
sence\webapp\vendor\laravel\framework\src\Illuminate\Database\Connectors\SqlServ
erConnector.php:32
Illuminate\Database\Connectors\SqlServerConnector->connect() at C:\wamp\www\pre
sence\webapp\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connect
ionFactory.php:61
Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connector
s\{closure}() at n/a:n/a
call_user_func() at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\Il
luminate\Database\Connection.php:924
Illuminate\Database\Connection->getPdo() at C:\wamp\www\presence\webapp\vendor\
laravel\framework\src\Illuminate\Database\Connection.php:792
Illuminate\Database\Connection->reconnectIfMissingConnection() at C:\wamp\www\p
resence\webapp\vendor\laravel\framework\src\Illuminate\Database\Connection.php:6
77
Illuminate\Database\Connection->run() at C:\wamp\www\presence\webapp\vendor\lar
avel\framework\src\Illuminate\Database\Connection.php:349
Illuminate\Database\Connection->select() at C:\wamp\www\presence\webapp\vendor\
laravel\framework\src\Illuminate\Database\Schema\Builder.php:55
Illuminate\Database\Schema\Builder->hasTable() at C:\wamp\www\presence\webapp\v
endor\laravel\framework\src\Illuminate\Database\Migrations\DatabaseMigrationRepo
sitory.php:141
Illuminate\Database\Migrations\DatabaseMigrationRepository->repositoryExists()
at C:\wamp\www\presence\webapp\vendor\laravel\framework\src\Illuminate\Database\
Migrations\Migrator.php:404
Illuminate\Database\Migrations\Migrator->repositoryExists() at C:\wamp\www\pres
ence\webapp\vendor\laravel\framework\src\Illuminate\Database\Console\Migrations\
MigrateCommand.php:103
Illuminate\Database\Console\Migrations\MigrateCommand->prepareDatabase() at C:\
wamp\www\presence\webapp\vendor\laravel\framework\src\Illuminate\Database\Consol
e\Migrations\MigrateCommand.php:58
Illuminate\Database\Console\Migrations\MigrateCommand->fire() at n/a:n/a
call_user_func_array() at C:\wamp\www\presence\webapp\vendor\laravel\framework\
src\Illuminate\Container\Container.php:507
Illuminate\Container\Container->call() at C:\wamp\www\presence\webapp\vendor\la
ravel\framework\src\Illuminate\Console\Command.php:169
Illuminate\Console\Command->execute() at C:\wamp\www\presence\webapp\vendor\sym
fony\console\Command\Command.php:256
Symfony\Component\Console\Command\Command->run() at C:\wamp\www\presence\webapp
\vendor\laravel\framework\src\Illuminate\Console\Command.php:155
Illuminate\Console\Command->run() at C:\wamp\www\presence\webapp\vendor\symfony
\console\Application.php:794
Symfony\Component\Console\Application->doRunCommand() at C:\wamp\www\presence\w
ebapp\vendor\symfony\console\Application.php:186
Symfony\Component\Console\Application->doRun() at C:\wamp\www\presence\webapp\v
endor\symfony\console\Application.php:117
Symfony\Component\Console\Application->run() at C:\wamp\www\presence\webapp\ven
dor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at C:\wamp\www\presence\webapp\a
rtisan:36
I found a solution. I post it for everyone. I use WAMP stack (PHP, Apache and MySQL). The fact is that wamp uses the 5.5.12 version for terminal CLI, so I have to install SQL Server PDO Extensions on the version I am using and (besides this) on the 5.5.12 version (I have several PHP versions installed). Can provide more information if needed.

Tibco EMS - File to Database Configuration issue with JVM

I am configuring Tibco EMS 7.0 server on Solaris 10 from the default file based store to a Database Store (Oracle RAC). Starting the instance the log shows the following JVM error:
2014-09-18 14:34:36.729 Logging into file '/lcl/dev/logs/tibco/jmspm2.log'
2014-09-18 14:34:36.729 ERROR: Error Loading JVM: ld.so.1: tibemsd64: fatal: /lcl/dev /apps/tibco/components/eclipse/_jvm/lib/sparc/libjvm.so/lib/sparcv9/server/libjvm.so: Not a directory
I have installed hibernate 3.2.5.001 from Tibco that uses the Eclipse JVM and files. Also istalled the recommended instantclient_11_2 that includes ojdbc5.
Below is my modified tibemsd.conf with dbstore_classpath, dbstore_driver_name, dbstore_driver_dialect, jre_library as:
dbstore_classpath = /lcl/dev/apps/tibco/components/eclipse/plugins/com.tibco.tpcl.org.hibernate_3.2.5.001/hibernate3.jar;/lcl/dev/apps/tibco/ems/7.0/bin/dom4j-1.6.1.jar;/lcl/dev/apps/tibco/ems/7.0/bin/commons-collections-2.1.1.jar;/lcl/dev/apps/tibco/ems/7.0/bin/commons-logging-1.0.4.jar;/lcl/dev/apps/tibco/ems/7.0/bin/ehcache-1.2.3.jar;/lcl/dev/apps/tibco/jta.jar;/lcl/dev/apps/tibco/ems/7.0/bin/cglib-2.1.3.jar;/lcl/dev/apps/tibco/antlr-2.7.6.jar;/lcl/dev/apps/tibco/ems/7.0/bin/antlr-2.7.6.jar;/lcl/dev/apps/tibco/components/eclipse/plugins/com.tibco.tpcl.org.com.mchange.c3p0_0.9.1.001/c3p0-0.9.1.jar;/lcl/dev/apps/tibco//ems/7.0/bin/asm.jar;/lcl/dev/apps/tibco/asm-attrs.jar;/lcl/dev/apps/tibco;../db_components/instantclient_11_2/ojdbc5.jar
dbstore_driver_name = oracle.jdbc.driver.OracleDriver
dbstore_driver_dialect = org.hibernate.dialect.Oracle10gDialect
jre_library = /lcl/dev/apps/tibco/components/eclipse/_jvm/lib/sparc/libjvm.so
I get the same error when I installed jdk1.5.0_71 and attempted to call ./jdk1.5.0_71/jre/lib/sparc/libjvm.so
I get the same error when set jre_library to: /lcl/dev/apps/tibco/components/eclipse/_jvm/lib/sparc since it appears to be looking for a directory.
Questions:
Is the ld.so.1 libray required (can't find it)?
Any ideas how to resolve this error and configure Java?
Solved!
I installed Java 1.6 via jdk1.6.0_45 and it worked! Below are the JRE settings that were used.
# jre_library = "/lcl/dev/apps/tibco/jdk1.6.0_45/jre/lib/sparcv9/server/libjvm.so" # This also works
jre_library = "/lcl/dev/apps/tibco/jdk1.6.0_45/jre" # This path works too, more consise
jre_option = -Xmx256m

Resources