Showing posts with label instead. Show all posts
Showing posts with label instead. Show all posts

Tuesday, March 20, 2012

connectionstring gets populated unwillingly

Hi,
I hav eplaced an expression for the flat file connection as below

@.[User::FileDirectory] + @.[User::FileName]

This is supposed to be used instead of the ConnectionString property of the flat file connection.

You can see that I have created two variables.

The variable
@.[User::FileDirectory] is set to the directory. i.e. I have hardcoded the path to it and assigned it to this variable.

The variable @.[User::FileName] is picked up automatically.

The question is:

When I go to the properties of the flat file connection, I delete the value inside the connectionstring property becuase there is now the expression which is set to the connectionstring.
But when I come back to this property then I am not sure why the connectionstring property gets populated with the directory that I hardcoded to the variable.

Many thanks

arkiboys wrote:

Hi,
I hav eplaced an expression for the flat file connection as below

@.[User::FileDirectory] + @.[User::FileName]

This is supposed to be used instead of the ConnectionString property of the flat file connection.

You can see that I have created two variables.

The variable
@.[User::FileDirectory] is set to the directory. i.e. I have hardcoded the path to it and assigned it to this variable.

The variable @.[User::FileName] is picked up automatically.

The question is:

When I go to the properties of the flat file connection, I delete the value inside the connectionstring property becuase there is now the expression which is set to the connectionstring.
But when I come back to this property then I am not sure why the connectionstring property gets populated with the directory that I hardcoded to the variable.

Many thanks

This is by design. The connectionstring property is picking up the value from the expression. Don't worry about it. It will be correct at runtime.|||

I'm not sure if this is correct because in the connectionstring property it shows:

\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\

and in the expressions it shows:

@.[User::FileDirectory] + @.[User::FileName]

Please note that in the variable design I have manually assigned the variable @.[User::FileDirectory] to the path above

Thanks

|||

I forgot to mention that it gives the following error:

Error: 2007-07-26 18:10:05.39
Code: 0xC020200E
Source: Data Flow Task Flat File Source [1]
Description: Cannot open the datafile "\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\".
End Error

so basically, it is not seeing the filename. it only sees the directoryname

Thanks

|||

arkiboys wrote:

I forgot to mention that it gives the following error:

Error: 2007-07-26 18:10:05.39
Code: 0xC020200E
Source: Data Flow Task Flat File Source [1]
Description: Cannot open the datafile "\\gblond088s0b\D$\ApplData\CEM\WorkingTemp\".
End Error

so basically, it is not seeing the filename. it only sees the directoryname

Thanks

Right. You need to give the Filename variable a default value. And if, during runtime, it still cannot find the data file, then you aren't populating the Filename variable correctly.|||

This is strange.
If I use a loop and give it the full directory path as described before, the foreach loop picks up the filenames and runs the package successfully. But I do not want to use a loop.

The package gets called once per filename. So the filename gets passed to the package and I want it to run but obviously it does not.

Not sure why the filename does not get populated when it is being passed to the package.

Thanks

|||How are you populating the Filename variable otherwise?|||

I have created a variable called @.FileName.

There is also a flat file connection which has a path to the directory as described before.

There is a command prompt which someone else is in charge of running, at the end of this command it passes the filename.

How do you think the filename should get populated?

note that I do not have this problem when I use a foreach loop but for this project loop is not required.

Thanks

|||

arkiboys wrote:

I have created a variable called @.FileName.

There is also a flat file connection which has a path to the directory as described before.

There is a command prompt which someone else is in charge of running, at the end of this command it passes the filename.

How do you think the filename should get populated?

note that I do not have this problem when I use a foreach loop but for this project loop is not required.

Thanks

I'm asking HOW you are passing a value to the Filename variable. HOW is the command line, that someone else is in charge of executing, populating the Filename variable? You need to know this before asking your questions here.|||

Ok,
If I want to run the package myself, how can I do this using the command line?

|||DTEXEC /FILE "Path to your package" /SET "\Package.Variables[Namespace::VariableName].Properties[Value]";YourValue

Sunday, March 11, 2012

connection to SQL Server files (*.mdf) require SQL server express 2005 to function properl

I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.

I have two SQL Server instances installed.

1- UserLT (this is sql 2000)
2- UserLT\SQL2005 (this is SQL 2005 named instance)

But when i try to add a database to my VS website project I get the following error:

Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925

I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)

and changed the "SQLEXPRESS" to "USERLT\SQL2005".

But I still get the same error message. Any ideas how i can resolve this issue?

Hello,

Attach the files to your SQL server instance using for example the SQL management Studio and change your connectionstring to connect into this database.

|||

Well the thing is that I dont have a database created yet. I am trying to create a new database. If i create a database in SQL 2005 then my connectionstring will point to the database on sql server. I need the database to reside in the VS project like a stand alone .mdf file so that I can deply the database with my project.

Does that make sense? Thanks for your help.

|||

Hi,

You may open your Machine.Config file (the file is in %SystemRoot%\Microsoft.NET\Framework\ver. number\CONFIG ). Try to find the ConnectionString node, modify the setting and make it look like

<add name="LocalSqlServer" connectionString="data source=UserLT\SQL2005;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />

Thanks.

Wednesday, March 7, 2012

Connection to an alias instead of a named server?

Is this doable?
The server name is TOPAZ
The alias name is topaz-alias
The username is somesqldb
The password is password
The following connection statement works:
Connection conn_topaz_byserver =
DriverManager.getConnection
("jdbc:microsoft:sqlserver://topaz;databasename=somesqldb"
,"somesqldb", "password");
The following connection statement fails:
Connection conn_topaz_byalias =
DriverManager.getConnection
("jdbc:microsoft:sqlserver://topaz-alias;databasename=somesqldb"
,"somesqldb", "password");
Galen Boyer
Hi Galen. The driver is trying to open a raw socket
to a machine named whatever you put in the URL
after the '//' and before the ';'. If you can
set up your DNI to find topaz from the alias,
then it will work.
Here's a program that opens a socket like the
typical type-4 driver will do, given the inputs
the URL and properties will supply. If you can
configure your OS dni info to get this program to
succeed opening the socket using the alias you want,
then the driver will too.
Joe Weinstein at BEA
import java.io.*;
import java.net.*;
public class isAnythingListeningOn
{
public static void main(String argv[])
throws Exception
{
if (argv.length != 2)
{
System.out.println("Usage: isAnythingListeningOn <host> <port>");
System.out.println("eg:\n% java isAnythingListeningOn myMachine 1433");
System.exit(0);
}
try
{
System.out.println("\nTrying to open a socket with host "
+ argv[0] + " and port " + argv[1] + " ...");
Socket socket = new Socket(argv[0],(new Integer(argv[1]).intValue()));
System.out.println("\nYes, there is, we got a socket.");
socket.close();
}
catch (Exception e)
{
System.out.println("We failed to open a socket. Here's why:\n");
e.printStackTrace();
System.out.println("\n(Either there is no machine named '" + argv[0]
+ "' or\nnothing is listening there on port "
+ argv[1] +")\n");
}
}
}
galenboyerdev@.hotpop.com wrote:

> Is this doable?
> The server name is TOPAZ
> The alias name is topaz-alias
> The username is somesqldb
> The password is password
> The following connection statement works:
> Connection conn_topaz_byserver =
> DriverManager.getConnection
> ("jdbc:microsoft:sqlserver://topaz;databasename=somesqldb"
> ,"somesqldb", "password");
>
> The following connection statement fails:
> Connection conn_topaz_byalias =
> DriverManager.getConnection
> ("jdbc:microsoft:sqlserver://topaz-alias;databasename=somesqldb"
> ,"somesqldb", "password");
>
|||Joe Weinstein <joeNOSPAM@.bea.com> writes:

> Hi Galen. The driver is trying to open a raw socket
> to a machine named whatever you put in the URL
> after the '//' and before the ';'. If you can
> set up your DNI to find topaz from the alias,
> then it will work.
[...]

> Socket socket = new Socket(argv[0],(new Integer(argv[1]).intValue()));
The following worked:
java.net.Socket socket = new java.net.Socket("topaz",1433);
The following failed:
java.net.Socket socket = new java.net.Socket("topaz-alias",1433);
So, the alias seems to be a "microsoft toolset only" feature.
Thanks.
Galen Boyer