Connect java app to sqlserver with only memory shared - jdbc

I can’t connect my software written in Java to sqlserver via the shared memory protocol.
I do very well in tcp with JDBC but impossible in memory-shared
I looked online, but I can’t find anything.

Related

Connecting to DB2 (DB2/400) database running on an iSeries AS400 via Linux/OSX

My requirement is simple: I have a Rails web app that needs to read some data in from DB2 running on an iSeries AS400.
With the incredible help of the ibm_db gem maintainers, I believe I've been able to solve the technical hurdle of connecting to the DB2 instance.
The backstory is here if there are others looking for guidance:
https://github.com/ibmdb/ruby-ibmdb/issues/25
Briefly:
Download the DB2 CLI/ODBC package provided for Linux/OSX
Set some environment variable and some connection config
Attempt a connection.
Leverage sequel gem in conjunction with ibm_db gem.
It should work!!
Sadly, I'm now blocked on #3 by this error:
[FAILED]: [IBM][CLI Driver] SQL1598N An attempt to connect to the database server failed because of a licensing problem. SQLSTATE=42968
I've been in touch with 3 different people at IBM in an attempt to resolve this and I'm constantly pointed to an article about DB2 Connect licenses with a cost of over $10K. iSeriesAccess (formerly ClientAccess) is available for Windows/Linux but is a heavy package and doesn't have an OSX counterpart.
I did find this question (License ERROR with DB2 driver on linux) but this I believe this assumes DB2 on Linux, not OS400.
Has anybody in the SO community had any luck or experience with this sort of thing?
For ODBC connections to an IBM i database, there are two options:
Use DB2 Connect Unlimited Edition for System i (extra cost)
Use IBM i Access ODBC driver (included with OS licensing / SWMA)
The IBM i Access ODBC driver is delivered with Client Access iSeries Access IBM i Access for Windows 7.1 or the IBM i Access Client Solutions Application Packages, which are currently only available for Windows and Linux. If people are interested in a Mac OS X version of the IBM i Access ODBC driver please vote on this RFE.
For ibm_db connections to an IBM i database, there are also two options:
Running on Linux/Mac/Windows/...: use DB2 Connect Unlimited Edition for System i (extra cost)
Running on IBM i: Use native IBM i CLI (free)
So, if you're running production on IBM i, even if we added an IBM i Access ODBC driver for Mac OS X, it still wouldn't help you, since the ibm_db driver does not work with the IBM i Access ODBC driver. :( You could use ruby-odbc in development and ibm_db in production, but I'm guessing you don't want to do that.
Now, if you're not running production on IBM i, you must be using DB2 Connect in production, so then I'd see if there were any more DB2 Connect licenses for you to use in development.
this is the official IBM opensource repo for odbc drivers:
https://public.dhe.ibm.com/software/ibmi/products/odbc/

How to tell a sybase jdbc dirver to exclude certain port when connecting to the sybase database server?

My app ('App A') uses com.sybase.jdbc3.jdbc.SybDriver and Spring framework 2.5.6 (for db connection pooling and ORM) to connect to a sybase 15.5 database.
For some reason, App A has used a port 34567 to talk to the sybase database server today. The port is actually reserved for another app ('App B'), and as a result App B failed (due to 'Address is already in use').
Is there anyway we can tell a jdbc driver to avoid a certain port to talk to the Sybase database server?
You cannot tell the JDBC driver to exclude ports. You can tell it though what ports to use.
I suppose you use the jConnect driver. So here is a link of how you can Invoke the jConnect driver
In the case that you want to set the connection properties explicitly, you can do so before connecting to the server in two ways:
Use the DriverManager.getConnection method in your application.
Set the connection properties when you define the URL.

How to sniff Oracle's credentials from a connection attempt to the database?

I have a legacy application, which connects to the configured Oracle database.
It seems it has some logic that alters the database credentials as it is unable to successfully log in to the Oracle database, while sqlplus started on the same machine is able to log in.
The error I am getting is: [DataDirect][ODBC Oracle Wire Protocol driver][Oracle]ORA-01017: invalid username/password; logon denied
How to find out what is the database username and password that are sent to the database?
What I have tried so far:
Enabled auditing of failed sign-on attempts on Oracle (audit create session whenever not successful). It does not solve the issue, because it only logs the username, which seems to be correct, without the password.
Used a sniffer to eavesdrop the network traffic between the machine running the application and the database, but since Oracle's TNS protocol is encrypted, it did not help a lot.
Started a server using netcat on port X, provided port X in the application configuration file. The application did connect to my server, that is how I know the application is connecting to the correct server. But since the TNS protocol is pretty complex (requires a series of messages to be exchanged between the client and the server) I hope there is a simpler why of achiving what I want without having to reverse engineer Oracle and implementing my own server.
Enabled tracing of the JDBC driver (Trace=1, TraceFile, TraceDll). The trace file shows the correct username, but obviously the password is not getting logged.
My environment:
Database: Oracle 11g
Application runs on: Solaris
Application uses: DataDirect ODBC Oracle Wire Protocol v70
I not sure, but if connection established by ODBC driver (as described in question tags) then you can try ODBC sniffing tools like ODBC Tracing.
Citation:
Password "Sniffing" Using Trace
ODBC provides a means for tracing the conversation taking place between the driver and the host database. Used by developers for testing purposes, the tracing feature is designed to help programmers find out exactly what is going on and to help fix problems. However, tracing (also called "sniffing") can be used by nefarious bad guys to retrieve user passwords.
When tracing is enabled, communications with the host are written to a file. This includes the user ID and password, which are captured in plain text.
Update
SQLPlus connects to Oracle with OCI interface, but DataDirect ODBC driver uses it's own proprietary implementation of communication protocol. So, most probable point of failure is driver misconfiguration or incompatibility.
DataDirect provides some tools for ODBC drivers diagnostics, but only option applicable to case described in question is using snoop utility, which acts like a netcat which already tried.
Because connection failed at credential verification stage, the most probable source of error is using localized symbols for user name or password. There are some issues with Oracle authentication process, listed in DataDirect Knowledge Search (search for ORA-01017).
It seems that DataDirect provides two separate version of driver with and without Unicode support, therefore one of possible points of failure is to connecting with non-Unicode version of driver to Unicode version of database and vice verse.
P.S. For now I don't have any experience with DataDirect ODBC driver. So it's only suggestions about possible source of failure.

Setting DB2 Client Audit information with a dbcp connection pool in a Java app

I'm developing Java apps on Tomcat 5.5 using JNDI to connect to shared dbcp connection pools with JDBC 3.0 drivers and DB2 8 on zOS and also DB2 9 on LUW. In my app, I use org.springframework.jndi.JndiObjectFactoryBean to get the dataSource and feed it into an org.springframework.jdbc.core.simple.SimpleJdbcTemplate to run the queries. This has been a fairly good solution so far, but our DBAs are requesting that we provide better granularity for auditing SQL performance. Currently, all portlets and apps use the same connection pool to connect to the database and the only way to distinguish between apps is to match the SQL run with the SQL in each app. We don't want to create seperate pools for each app. DB2 provides several methods on their DB2Connection from the driver that allow us to set audit information.
setDB2ClientApplicationInformation
setDB2ClientUser
setDB2ClientWorkstation
setDB2ClientAccountingInformation
My question is... what's the best way to set these values on a connection from a connection pool. Do I need to access the underlying connection in order to set these values? Should I clear them before returning the connection to the pool? Does anyone have code examples?

Oracle connections from a COM+ application

We have an Oracle 10.2.0 server running. There is a schema on the server called FOO. I have created an ODBC connection to the schema using the 10.2.0 client.
We have a desktop application that has core database access libraries written by ourselves that uese SQLDriverConnect etc.
We also have a COM+ application that makes use of the same core libraries.
When I connect with the desktop application, using the ODBC connection, there are no problems.
Connecting with the COM+ application, I cannot perform any queries. SQLDriverConnect returns SUCCESS but then any attempt to peform a query gives an Oracle error "not connected". The COM+ application is set to run as the "logged in user".
I'm sure this is probably a security issue, but I don't know where to start.
Any ideas?
Thanks.
I found what was causing the problem, it's an Oracle bug.
Cause:
Oracle Bug 4991478; COM application not able to connect when using Oracle10g Client 10.2 if using Neutral Threading or Free-Threaded Marshaller, Fails With ORA-21561 / ORA-00022
Solution:
Install Oracle Client (patch) 10.2.0.3.0.

Resources