How to set Password property of oledb connection in SSIS package - oledbconnection

I am new to SSIS, here is the issue I am facing.
1) Created an OLEDB connection to connect to database. Storing the Connection String in SSIS variable and have added expression to Connection Manager to pick the connection string according to environment.
2) Have used Windows Authentication to connect to database, so that no need to provide user ID and Password. In development environment it worked perfectly fine. But when moved to testing environment, its failing with Error "SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "REGEDB" failed with error code 0xC0202009"
3) Using SQL Server Configuration to deploy the package. But getting error Failed to load at least one of the configuration entries for the package. Check configuration entries for "CBPSSIS" and previous warnings to see descriptions of which configuration failed.
Below is the Connection String
Data Source=abcd\ISQLQ02;Initial Catalog=DRIP;Provider=SQLNCLI10;Integrated Security=SSPI;Auto Translate=False;
COuld you please let me know how to set Password property? I tired in Script file but its not working. Thank you
ConnectionManager OldedbConn;
OldedbConn = Dts.Connections["QAREGE"]; Dts.Connections["QAREGE"].Properties["ServerName"].SetValue(OldedbConn, Dts.Variables["User::dbServerName"].Value); Dts.Connections["QAREGE"].Properties["InitialCatalog"].SetValue(OldedbConn, Dts.Variables["User::dbCatalog"].Value); Dts.Connections["QAREGE"].Properties["UserName"].SetValue(OldedbConn, Dts.Variables["User::dbUserID"].Value); Dts.Connections["QAREGE"].Properties["Password"].SetValue(OldedbConn, Dts.Variables["User::dbPwd"].Value);

Since you are using ssis-2008 you can create a ssis configFile with .dtsConfig format with xml configuration file type. Include all your Database connection string in the config file. So when you moved your ssis package to another server you just need to edit the config file and set your connection based on your target server.

Related

HSQL server mode while connection from DatabaseSwingManager throws exception java.sql.SQLTransientConnectionException

I have written a java code of connecting to server mode
p.setProperty("server.database.3",
"file:G:/SERVERMODE/soamware;user=soamware;password=123#123");
p.setProperty("server.dbname.3", "soamware");
server.setProperties(p);
server.setLogWriter(null); // can use custom writer
server.setErrWriter(null); // can use custom writer
server.start();
try {
//Registering the HSQLDB JDBC driver
Class.forName("org.hsqldb.jdbc.JDBCDriver");
con = DriverManager.getConnection("jdbc:hsqldb:hsql://ip/soamware;
file:G:/SERVERMODE/soamware;user=soamware;password=123#123");
this code is working fine in netbeans with jdk8 and hsqldb2.5.1, however the console shows the build is not terminated and its still running. While when i connect to SwingDatabaseManager
with same url, username and password as mentioned in java code. It throws above mentioned exception. Kindly clarify also, why my program doesnt exit. I am not adding "server.shutdownCatalogs(1);" statement at end because then I cannot perform multiple operations in one session.
Because you are starting the server with only one database, you should set database.0 properties. You shouldn't use the # character at all on a connection string because it has a special meaning. You shouldn't use the file path when connecting to a server database. Use the dbname.0 value only. Edited code below:
p.setProperty("server.database.0", "file:G:/SERVERMODE/soamware;user=soamware;password=123x123");
p.setProperty("server.dbname.0", "soamware");
server.setProperties(p);
server.setLogWriter(null); // can use custom writer
server.setErrWriter(null); // can use custom writer
server.start();
try {
Class.forName("org.hsqldb.jdbc.JDBCDriver");
con = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost/soamware", "soamware", "123x123");

Is this a bug: stored procedure runs fine without parameters, causes error when parameters are added?

I have a stored procedure created in MySQL DB. This database is accessed as linked server through Microsoft SQL Server 2012 using Microsoft SQL Server Management Studio. The provider selected while creating linked server is "Microsoft OLE DB Provider for ODBC Drivers".
When I run following as text from Report builder 3.0 it runs fine and fetch data.
EXEC('CALL storedProcedureName(''string1'', ''string2'', ''string3'')') AT LinkedServerName;
But when I try to replace string1, string2, string3 with parameter name parameter1, parameter2, parameter3 as:
EXEC('CALL storedProcedureName(#parameter1, #parameter2, #parameter3)') AT LinkedServerName;
I get error:
Could not execute statement on remote server 'LinkedServerName'.
(Microsoft SQL Server, Error: 7215)
And when I try:
EXEC('CALL storedProcedureName('#parameter1', '#parameter2', '#parameter3')') AT LinkedServerName;
I get the prompt to enter values for parameter1, parameter2, parameter3. But when I enter the values and click ok, I get error:
Incorrect syntax near '#parameter1'. (Microsoft SQL Server, Error: 102)
Question: Am I missing something in syntax or is this a bug?
The linked server has:
"RPC" and "RPC out" set to True.
And the OLEDB provider has:
Enabled allow inprocess
Enabled dynamic parameter
I believe you have to call it like the below. So params become strings wrapped in single quotes:
EXEC('CALL storedProcedureName('''+#parameter1+''', '''+#parameter2+''', '''+#parameter3+''')') AT LinkedServerName;
I know this is an older question but the accepted answer is open to SQL Injection and I think it's important to offer a more secure method.
You really want to use a parameterized query
EXEC('CALL storedProcedureName(?,?,?)',#parameter1, #parameter2, #parameter3) AT LinkedServerName;
I know this works for oracle and it should work for MySql as well.

Error reading csv on remote server "Value `null` is not supported as key in maps, must be a non-nullable string."

I have a strange problem - I have a local neo4j instance v 2.3.8 and a remote server instance of neo4j v 3.1.4
I am in the process of rebuilding my graph on the remote server using the source files. This has been successful so far - I am able to import the csv files successfully on the remote server - I am accessing the remote server through the browser (remote http connection)
With literally the last file, I get the following error message on the remote server but the same works fine in my local neo4j instance:
Value null is not supported as key in maps, must be a non-nullable
string.
The cypher query is:
Load csv with headers from "srcfile3.csv" as line
WITH line
return line limit 2
The error message seems to be generated from this file in the neo4j code: https://fossies.org/linux/neo4j/community/bolt/src/main/java/org/neo4j/bolt/v1/messaging/Neo4jPack.java, if that helps.
Solution: Recreated the csv from the original xlsx - ensured all headers were in place and the file opened correctly. Thanks to /u/Tezra for the pointer

Tenanti "Undefined variable: Database"

I'm developing an application for multi tenant purpose, for this, I've used Orchestral/Tenanti but I'm experiencing the following problem.
I already performed some of the required steps for Multi Database Connection Setup.
Configuration Tenant Driver for Multiple Database: on my tenanti.php
Setting Default Database Connection: on my Tenant.php Middleware
Definition of my Tenants Connection: on my config/database.php
The problem becomes on the Database Connection Resolver step. In my Middleware I'm defining the connection to be used (I don't post the code because is not relevant for Tenanti use) which is correctly setted.
My resolver code is:
public function boot()
{
Tenanti::connection('tenants', function (User $entity, array $template) {
$template['database'] = "db_{$entity->getKey()}";
return $template;
});
}
This code is located on my AppServiceProvider. But my database to be used, is not correctly setted from my Resolver, throwing the following error:
ErrorException in MySqlConnector.php line 110:
Undefined variable: database
Clearly the error means that database is no setted.
Someone can help? Thanks in advance.
After many tests, I didn't find the solution using Tenanti, instead of that, I used Config class to set the database to use, and maintained my tenants configuration on database.php.
Config::set('database.connections.tenants.database', 'legal_'.$request->route()->parameter('account'));
Config::set('database.default', 'tenants');

What is the tADOConnection.ConnectionString in Delphi to access the Interbase server

I have a WindowsXPSP3 op system, on it a DelphiXE and InterbaseXE installed.
I created a database in IB and it works OK through the IBConsole and ISQL and connection testing also works through TCP/IP localhost:3050.
Now I try to access it from Delphi.
I did:
var AC:tADOConnection;
...
AC:=tADOConnection(Self);
AC.ConnectionString:=
AC.Open;
I tried all possible version I could google for the ConnectionString, but all generated an error. I used various Provider= versions, etc., but none works.
Could someone provide me with a simple working ConnectionString? Do I need to install any ADO driver or similar additionally?
Thanks,
Zsolt
There are two ways to easily create a valid connection string
a.1) Click on the small button in the object inspector right of the connection string property.
a.2) Create your connection, test it, press OK
or
b.1) Create an empty file e.g. 'TEST.UDL'. Use Notepad.EXE for example.
b.2) Double click on the file in the explorer. This will open the connection string editor
b.3) Create your connection, test it. Press OK
b.4) Your file now contains the connection string which you may copy&past in your application
Another benefit of the second method is that you can even use the file as a connection string. This makes life alot easier if you have to configure your connection from time to time (Just double click on the UDL if you have to change the connection properties). Here's how a valid connection string for a file looks like:
FILE NAME=<Full path to your UDL file>

Resources