In an ssis connection manager there are properties for:
username
password
initial catalog
server
There is also a property for connection string, that is mostly made up of the above parts.
Does values in the top 4 properties overwrite the same values in the connection string?
If i am setting these values at runtime in sql server, do i need to parameterize these 4 properties AND the connection string?
Related
I am trying to set up Data Fusion MySQL connection ( JDBC plugin v. 8.0.25) with connection arguments that are not default. Somehow it won't let me use them and keep just ignoring them.
P.S. Local connection is just set to see the error and arguments that it is passing. Otherwise connection is just successful ( with default arguments )
I have tried changing values of connectTimeout and socketTimeout to 0, 99999999 etc but it just keep setting it to 20000 ms.
I except these values to overwrite since I am trying to pass my own arguments there.
Is it possible to access an SQL Server 2008 table with a column of type Geography using a Type Provider in F#?
This is my connection:
type dbSchemaAnalyticsWeb = SqlDataConnection<"Data Source=sql2008;Initial Catalog=Analytics;User ID=USER;Password=PASSWORD;">
Then the code to insert data:
let dbAnalyticsSQL = dbSchemaAnalyticsWeb.GetDataContext()
let sqlGeogBuild = new SqlGeographyBuilder()
sqlGeogBuild.BeginGeography(OpenGisGeographyType.Point);
sqlGeogBuild.BeginFigure(lat, long)
sqlGeogBuild.EndFigure()
sqlGeogBuild.EndGeography()
let LData = new dbSchemaAnalyticsWeb.ServiceTypes.LocationsData(
Address = address,
ZipCode = zipCode,
Longitude = long,
Latitude = lat,
GeoLocation = sqlGeogBuild.ConstructedGeography)
In the code above, the field GeoLocation references the Geography data type from SQL Server. However I get an error "The member or object constructor 'LocationData' has no argument or settable return property 'GeoLocation'. Is there another way to reference this field, or some other interface, or is this data type simply not accessible?
Note, I am using Visual Studio 2012 and .Net 4.5.
You are using the LinqToSql provider, which does not have support for the SqlGeography type. Try using the Entity Framework provider.
Here is how I reference a database that uses SqlGeography in one of my projects:
type internal Database = SqlEntityConnection<ConnectionStringName="DefaultConnection", LocalSchemaFile="Context.ssdl", ConfigFile="Web.config", ForceUpdate=true, Pluralize=true>
For most purposes the LinqToSql, and Entity Framework providers are very similar. The main difference is that the Entity Framework provider exposes types as internal, while LinqToSql makes things public.
If for some reason you would rather stay with LinqToSql, there are some work-arounds that might allow you to do what you want.
I am trying to write ETL that collects data from many identical server into a central repository. What I'm trying to do is write one package with source address, user id and password as parameters and execute the package once per server to be copied.
Is this doable? How can I use parameters to create a source?
I meant to ask how to parametrize the connection manager (is that even a real word?), not where to store the connection parameters. The answer is simple:
Create package parameters for Server, Database, User ID and Password
Create a connection manager as part of defining a data flow component
once a connection is defined, right-click on the connection manager at the bottom of the package design screen and select "Parametrize".
Select "ServerName" in the property drop-down
Select "Use existing parameter" or create new parameter if skipped step 1
If using existing parameter, select it from the drop down
Click OK to save (gotta do it after each parameter)
Repeat steps 4-7 for the rest of the parameters
You can store parameters in a table. Query the table with a sql task and store the results in a object variable. You can then use this variable in a for loop. Use expressions in SSIS to change values of your connection during each loop iteration.
Several books outline this method. Here is a code example.
Here are some steps - hopefully I didn't miss anything. You mention a server "Address", but I'm not sure exactly what you are trying to do. This example queries multiple sql servers.
You create the variables, SQL_RS with type of object, SRV_Conn with type of string. This holds my servername. In the execute SQL task, I have a query which returns the names of sql servers I want to query. Then set the following properties:
SELECT RTRIM(Server) AS servername
FROM ServerList_SSIS
WHERE (Server IS NOT NULL)
and coalesce(exclude,'0') <> 'True'
and IsOracle is Null
Execute SQL Task > General > ResultSet = "Full Result Set"
Execute SQL Task > Result Set Tab "Result Set Name = 0", Variable Name = "User::SQL_RS"
So we have a list of server names in the SQL_RS variable now.
ForEach > Collection > Enumerator = "Foreach ADO Enumerator"
ForEach > Collection > Enumerator Configuration > ADO Object source Variable = User::SQL_RS
This maps the first column of the SQL_RS object to the SRV_Conn variable, so each iteration of the loop will result in a new value in this variable.
ForEach > Variable Mappings > Variable = User::SRV_Conn, Index = 0
Inside the ForEach are some other sql execs, performing queries on sql databases, so I need to change the ServerName of my 'MultiServer' connection. I have another connection for the initial query that got me the list of servers to query. Making the connection dynamic is done in properties of the connection - right-click the connection > properties. Click the ellipses to the right of the expressions.
Connection > Properties > Expressions > Property = ServerName, Expression = "#[User::SRV_Conn]"
Note: The index value of 0 for the variable mapping works for Native OLEDB\SQL Server Native Client. If you're using another db provider, you may need to use other index types - this makes setup more confusing.
OLEDB = 0,1
ADO.NET = #Varname
ADO = #Param1, Param2
ODBC = 1,2
Full listing here.
Is there a way to set the sql_mode (for MySql database) in Hibernate properties or in connection string?
Thanks,
Stefano
Yes, as documented sessionVariables property which is defined as follows can be used in JDBC connection string:
A comma-separated list of name/value pairs to be sent as SET SESSION
... to the server when the driver connects.
List of values goes inside single quotes:
sessionVariables=sql_mode='ALLOW_INVALID_DATES,NO_BACKSLASH_ESCAPES'
I have a SQL query that returns me a "time(0)". I load that into SSIS, and it gets automatically converted to a "DT_DBTIME2", which is okay. I can transform it to any other type without error using a data conversion data flow item.
My problem is that when I try to insert that value into a "time(0)" field of a table, it gives me the following error:
The OLE DB provider used by the OLE DB adapter cannot convert between
types "DT_DBTIME2" and "DT_WSTR" for "ETAHour".
When I mouse over the fields in the OLE DB Destination component, it clearly says that the source field is a DT_DBTIME2 and the destination field is a DT_DBTIME2. I really wonder where this conversion error comes from.
Make sure that you are specifying provider in connection string.
In my case I'm using MSSQL 2012 Enterprise. It works on local machine, but after updating connection string in dtsconfig in installer it fails with error above.
Setting OLE DB provider fixed issue, in my case:
Provider=SQLNCLI11.1
Had a similar issue after importing an existing SSIS project created a new connection string and after I switched had multiple errors.
Changing the OLE DB provider to SQL Server Native Client 11.0 solved issue which is the equivalent of setting SQLNCLI11.1
enter image description here