How can I prevent BIML Express quoting an ODBC Driver - odbc

TL;DR
I'd like to prevent BIML from wrapping my ODBC driver in double quotes when it creates my dtsx package.
More info
I have a very simple BIML file, shown below after the BIML code header, which connects to Composite Information Server (CIS). I don't think the datasource is important, but I thought I'd include in case it's pertinent to the question/problem.
The CIS ODBC driver is installed with a driver name of Cisco Information Server 7.0.
As below, I'm entering the driver name correctly, but when BIML generates the dtsx package, it wraps quotes round the name, so, for a connection like this:
<OdbcConnection Name="CIS" ConnectionString="Driver={Cisco Information Server 7.0};Server=xxxxxxxxxx;Port=xxxxxxxxxx;Domain=xxxxxxxxxx;dataSource=xxxxxxxxxx;database=src;User=xxxxxxxxxx;Password=xxxxxxxxxx;Encrypt=yes;" />
...I end up with a connection string, like this:
Driver={"{Cisco Information Server 7.0}}"};server=xxxxxxxxxx;port=xxxxxxxxxx;domain=xxxxxxxxxx;datasource=xxxxxxxxxx;database=xxxxxxxxxx;user=xxxxxxxxxx;encrypt=yes
If I remove the curly braces and use a connection string like this:
<OdbcConnection Name="CIS" ConnectionString="Driver=Cisco Information Server 7.0;Server=xxxxxxxxxx;Port=xxxxxxxxxx;Domain=xxxxxxxxxx;dataSource=xxxxxxxxxx;database=src;User=xxxxxxxxxx;Password=xxxxxxxxxx;Encrypt=yes;" />
...I still end up with a connection string like this:
Driver={"Cisco Information Server 7.0"};server=xxxxxxxxxx;port=xxxxxxxxxx;domain=xxxxxxxxxx;datasource=xxxxxxxxxx;database=xxxxxxxxxx;user=xxxxxxxxxx;encrypt=yes
Edit Just for clarity (as it was missing from the original post) the extra quotes added by the BIML compiler mean the driver is unrecognised and executing the generated package throws this error:
Execute SQL Task: Failed to acquire connection "CIS". Connection may
not be configured correctly or you may not have the right permissions
on this connection.
I have a working solution (more of a workaround) by creating a duplicate registry entry for the driver in HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI, with the non-alphanumeric chars removed, then referencing this in BIML.
However, I'd like to know if there's a way to stop the BIML compiler wrapping quotes round my ODBC driver.
Thanks in advance for any suggestions!
BIML code
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<OdbcConnection Name="CIS" ConnectionString="Driver={Cisco Information Server 7.0};Server=xxxxxxxxxx;Port=xxxxxxxxxx;Domain=xxxxxxxxxx;dataSource=xxxxxxxxxx;database=src;User=xxxxxxxxxx;Password=xxxxxxxxxx;Encrypt=yes;" />
</Connections>
<Packages>
<Package Name="TestPackage" ConstraintMode="Parallel" ProtectionLevel="EncryptSensitiveWithUserKey" DelayValidation="true">
<Variables>
<Variable Name="TestResult" DataType="Int32">0</Variable>
</Variables>
<Tasks>
<ExecuteSQL Name="ConnectionTest" ConnectionName="CIS" ResultSet="SingleRow">
<DirectInput>SELECT COUNT(*) FROM SCHEMA.TABLE</DirectInput>
<Results>
<Result Name="1" VariableName="User.TestResult" />
<!-- ODBC requires a 1-based param number -->
</Results>
</ExecuteSQL>
</Tasks>
</Package>
</Packages>
</Biml>

Does ConnectionString="Driver={{{Cisco Information Server 7.0}}};... fix the problem?
I ran into a different issue in Biml where braces were being expanded as formatters and the solution is to double up the braces in .net at least

I have another workaround (instead of creating an alphanumeric-only copy of the ODBC registry entry).
#billinkc's answer, unfortunately, didn't help, as this related to escaping curly braces within a C# string.
The workaround is to create an ADO.NET ODBC connection, like this:
<AdoNetConnection Name="CISADO" Provider="System.Data.Odbc.OdbcConnection, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" ConnectionString="Driver=Cisco Information Server 7.0;Server=xxxxxxxxxx;Port=xxxxxxxxxx;Domain=xxxxxxxxxx;dataSource=xxxxxxxxxx;database=xxxxxxxxxx;User=xxxxxxxxxx;Password=xxxxxxxxxx;Encrypt=yes;" />
For some reason, the BIML compiler 'likes' this connection string and doesn't try to wrap it in quotes and/or curly braces.
I'll leave the question open, as I'd really like someone to give an answer and solution to prevent the unwanted quotes & curly braces being added by the BIML compiler. This answer will hopefully be useful to someone (and me!) in the future.

Related

Flyway 7.7.3 seems to ignore my "callback"

I am upgrading from Flyway 5.4 to 7.7.3 and ran into some issue.
flyway -teams -url=jdbc:oracle:thin:#localhost:1521/XE "-user=xxx as SYSDBA" -password=xxx -table=flyway_schema_history_app -encoding=utf-8 -baselineOnMigrate=true migrate
(I have the teams edition license)
Flyway gives me the following error message:
**
ERROR: Unable to parse statement in /flyway/sql/incremental/Build_302_Baseline/V302_106__fosprd_INSERT_Master_eg_pocqueue.sql at line 117 col 1. See https://flywaydb.org/documentation/knownparserlimitations for more information: No value provided for variable substitution: &R. Check your configuration. If this is not a SQLPLus variable intended to be substituted (eg. in a string literal), then you will need to add SET DEFINE OFF in the script beforehand.
Caused by: No value provided for variable substitution: &R. Check your configuration. If this is not a SQLPLus variable intended to be substituted (eg. in a string literal), then you will need to add SET DEFINE OFF in the script beforehand.
**
This is caused by a special character "&" in the SQL statement, however, I have made sure the SQL file is using UTF-8 encoding as well as Unix return (LF).
Also, I keep my callbacks under:
bash-5.0$ pwd
/flyway/sql/callbacks
bash-5.0$ ls
afterBaseline.sql afterEachUndo.sql afterMigrateError.sql afterUndo.sql beforeEachUndo.sql
afterBaselineError.sql afterEachUndoError.sql afterRepair.sql afterUndoError.sql beforeMigrate.sql
afterEachMigrate.sql afterMigrate.sql afterRepairError.sql beforeEachMigrate.sql beforeUndo.sql
This used to be able to run on 5.4 with no issue. But it's giving me this error on 7.7.3, anyone can point me to the right direction?
Thanks
This is due to the changes between versions of flyway's SQLPlus support and the fat you have a teams license.
As indicated in the message, this is related to SQLPlus's variable substitution:
https://flywaydb.org/documentation/database/oracle#variable-substitution
If you are not using SQLPlus features, you could try disabling them:
https://flywaydb.org/documentation/configuration/parameters/oracleSqlPlus
but the recommended solution is to place SET DEFINE OFF in the SQL script before the offending ampersand (with the option of reverting that afterwards)

SQLBase error HY092

I'm trying to config a connection with SQLBase with odbc driver on Windows and I never did that, but I'm getting the error:
Connection failed with SQL State: "HY092"
I'm using the Windows ODBC Administrator to try add the connection. In the field "Config Filename (INI)" of the configuration screen I put: "C:\Program Files (x86)\Centura\sql.ini" and I add "C:\Program Files (x86)\Centura\" to the PATH system variable.
In the application (.NET) I'm getting the message:
ERROR [HY092] [Gupta][ODBC Driver]Invalid attribute/option identifier
My sql.ini file has the content:
[win32client]
clientname=CWBXXX
[win32client.dll]
comdll=sqlws32
[win32client.
serverpath=server3,<SERVER_IP>,2155/<BASE_NAME>
Anyone could help me? Thank you.
Good to see you are using SQLBase . Awesome.
Two important settings to get right.
1) Make sure you are using the correct ODBC administrator
I'm guessing 32 bit in %systemdrive%\Windows\SysWoW64\odbcad32.exe.
If not , use the 64bit one in %systemdrive%\Windows\System32\odbcad32.exe.
Under System DSN tab Add the correct driver for the database. Either 'Centura SQLBase 3.6 32bit Driver' or the 'Gupta SQLBase 12.x' driver if you are running SQLBase 12.
Under the Configure Tab, specify the Data Source Name that you will use in your sql.ini. THEY MUST MATCH.
2)a. Make sure you only ever have 1 sql.ini on the client. Ever.
2)b. sql.ini needs the ODBC driver specified in the client section:
[win32client.dll]
comdll=sqlodb32
[odbcrtr]
odbctrace=off
longbuffer=32767
buffrow=10000
remotedbname=[dB Name specified in ODBC] ,
DSN=[Data Source Name specified in ODBC]
(without the square brackets eg. remotedbname=MyDatabase,DSN=MyDatasetName whatever names you have specified in ODBC admin.)

Wildfly 10 Sys-log-handler printing with Byte_order_mark <feff>

I have configured a syslog-handler in WildFly-10 Standalone.xml as below
<syslog-handler name="mysyslog">
<level name="INFO"/>
<hostname value="localhost"/>
<app-name value="myappserver"/>
<facility value="local-use-7"/>
</syslog-handler>
I have added rules in rsyslog.d as
if $programname == 'myappserver' then /tmp/mysyslog.log
When i check the mysyslog file i could see <feff> characters
These characters are appended by Wildfly itself before sending it to rsyslog.
Can you please let me know how to get rid of these from my logs
I referred this link https://en.wikipedia.org/wiki/Byte_order_mark and it indicated that these are BOM characters
That is per the RFC 5424 spec that the BOM is added. A simple workaround is to override the encoding. Unfortunately the standard syslog server management resource doesn't allow for an encoding to be set. There is an issue filed to fix this though.
However you could use a custom-handler to override this and use an encoding like US-ASCII to change the encoding which would remove the BOM. The following CLI commands should create a syslog handler similar to the one you have configured.
/subsystem=logging/pattern-formatter=syslog-pattern:add(pattern="(%t) %s%e")
/subsystem=logging/custom-handler=syslog:add(module=org.jboss.logmanager, class=org.jboss.logmanager.handlers.SyslogHandler, named-formatter=syslog-pattern, level=INFO, properties={hostname=localhost, appName="myappserver", facility="LOCAL_USE_7", encoding="US-ASCII", syslogType=RFC5424})

rhive.connect error: cannot modify RHIVE_UDF_DIR

I am trying to connect to Hive from R with the latest RHive package in HDP 2.4. The installation seemed to have gone smoothly, since I was able to call the library of RHive. When I execute
rhive.connect(host="192.168.56.101",port=10000, hiveServer2=TRUE)
I got this error message:
Cannot modify mapred.child.env at runtime. It is not in list of params that are allowed to be modified at runtime.
After some googling around, I added the following to the /etc/hive/conf/hive-site.xml file:
<property>
<name>hive.security.authorization.sqlstd.confwhitelist.append</name>
<value>mapred.child.env</value>
</property>
After restarting hive-server2, the original error message is now replaced by this one:
Cannot modify RHIVE_UDF_DIR at runtime. It is not in list of params
that are allowed to be modified at runtime.
I tried adding RHIVE_UDF_DIR right next to map.child.env, like this:
<property>
<name>hive.security.authorization.sqlstd.confwhitelist.append</name>
<value>mapred.child.env,RHIVE_UDF_DIR</value>
</property>
But this did not resolve the problem; it brought back the original error message that I was getting at the very beginning. Any thoughts on this? Thanks in advance!
I know this is late reply but I just came across this thread. Using java regex instead of comma separated would work. This worked for me this morning.
Config parameter should be added under hive-site.xml
hive.security.authorization.sqlstd.confwhitelist.append=mapred\.child\.env|RHIVE_UDF_DIR
Ps: Backslash was not displaying above so adding screenshot link.
config parameter with proper java regex for values

implement type 4 jdbc driver in DB2

In my project I'm using few configurations in context.xml and servlet.xml, where I'm setting
<ResourceLink
global="jdbc/mydatasource"
name="jdbc/mydatasource"
type="javax.sql.DataSource" />
<Resource
name="jdbc/mydatasource"
auth="Container"
type="javax.sql.DataSource"
username=" DATABASE_USERNAME"
password=" DATABASE_PASSWORD"
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://IP:port/DBname" />
and using it in my servlet by including it through
datasource = (DataSource) envContext.lookup("jdbc/mydatasource");
But I want to know what type of driver (type 2, 4, etc). I've imported db2jcc.jar in the application.
Googling for DB2 type 4 driver gives me this page of IBM: Understand the DB2 UDB JDBC Universal Driver (from 2005). Reading this makes clear that db2jcc.jar is the universal driver, which is both a Type 2 and a Type 4 driver. What you use depends on the JDBC url you specify:
For Type 4:
jdbc:db2//server:port/database
jdbc:db2//server/database
For Type 2:
jdbc:db2:database
Be aware that - according to this site - you will also need db2jcc_license_cu.jar on your classpath to get the Type 4 driver to work.
Java has the DatabaseMetaData interface, which may have the information you are looking for. I'm not a Java person, but getDriverMajorVersion() may return what you're looking for.
The URL is incorrect actually:
For Type4:
jdbc:db2://server:port/database
jdbc:db2://server/database
Missing another colon.

Resources