Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Sunday, March 25, 2012

Connecting to SQL 2005 via DBI Perl and Vista problems.

I am trying to connect to a 2005 SQL server though perl using the DBI module.
When the perl script is uploaded to my web server the connection is made with
no problems but if I download the file to my local machine and run the file I
get "[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
have added the DSN into Vista 6 times and the test run fine but I can not run
this perl script, or any other perl script that uses DBI to get to the SQL
server. Can anyone help me?
Never Mind, found it. Why do the answers only show up after asking for help.
Found this site
http://msmvps.com/blogs/spywaresucks/archive/2007/05/11/897398.aspx
and whent via run command to the syswow64 version of ODBC and added it in
there and worked. But I find it really odd that when I when to the ODBC via
Admin Tools in Control Panel it was not working. O, well.
"Eagle_f90" wrote:

> I am trying to connect to a 2005 SQL server though perl using the DBI module.
> When the perl script is uploaded to my web server the connection is made with
> no problems but if I download the file to my local machine and run the file I
> get "[Microsoft][ODBC Driver Manager] Data source name not found and no
> default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
> have added the DSN into Vista 6 times and the test run fine but I can not run
> this perl script, or any other perl script that uses DBI to get to the SQL
> server. Can anyone help me?

Connecting to SQL 2005 via DBI Perl and Vista problems.

I am trying to connect to a 2005 SQL server though PERL using the DBI module
.
When the PERL script is uploaded to my web server the connection is made wit
h
no problems but if I download the file to my local machine and run the file
I
get "[Microsoft][ODBC Driver Manager] Data source name not found and
no
default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
have added the DSN into Vista 6 times and the test run fine but I can not ru
n
this PERL script, or any other PERL script that uses DBI to get to the SQL
server. Can anyone help me?Never Mind, found it. Why do the answers only show up after asking for help.
Found this site
http://msmvps.com/blogs/spywaresuck.../11/897398.aspx
and whent via run command to the syswow64 version of ODBC and added it in
there and worked. But I find it really odd that when I when to the ODBC via
Admin Tools in Control Panel it was not working. O, well.
"Eagle_f90" wrote:

> I am trying to connect to a 2005 SQL server though PERL using the DBI modu
le.
> When the PERL script is uploaded to my web server the connection is made w
ith
> no problems but if I download the file to my local machine and run the fil
e I
> get "[Microsoft][ODBC Driver Manager] Data source name not found a
nd no
> default driver specified (SQL-IM002)(DBD: db_login/SQLConnect err=-1);" I
> have added the DSN into Vista 6 times and the test run fine but I can not
run
> this PERL script, or any other PERL script that uses DBI to get to the SQL
> server. Can anyone help me?

Tuesday, March 20, 2012

Connecting to Paradox

Hello,
I am trying to connect to paradox database for the purpose of updating
the record(s) in DTS ActiveX Script Task.
I used the following connection string. But I get an error while
connection. I have "UMTest.db" and "UMTest.px" files in the
"C:\MYDBPath" in my local drive.
Set objRs =3D CreateObject("ADODB.RecordSet"=AD)
DB_STRING =3D "Provider=3DMicrosoft.Jet.OLEDB.=AD4.0;Data
Source=3DC:\MYDBPath;Extended Properties=3DParadox 5.x;"
strSQL =3D " UPDATE UMTest SET Field1 =3D 1.222 WHERE Col1ID =3D '" & Value1
& "' AND Col2 =3D '" & Value2 & "'"
objRs.Open strSQL, DB_STRING
I get the following error.
Error Source: Microsoft Jet Database engine.
Error Description: No Value given for one or more required parameters.
Connection string looks alright to me. I don't know what is other
reason which is causing this error to happen.=20
Thanks.
You may try to create a User DSN first using ODBC Administrator. Instead of
DB_STRING="..", you can set DB_STRING=UserDSNNameYouCreated. To simplify it,
please do not include update command. Try to connect it first and see if it
works.
Thanks
Bei
"Yunus's Group" <yunusasmath@.gmail.com> wrote in message
news:1123266364.868066.278640@.g43g2000cwa.googlegr oups.com...
Hello,
I am trying to connect to paradox database for the purpose of updating
the record(s) in DTS ActiveX Script Task.
I used the following connection string. But I get an error while
connection. I have "UMTest.db" and "UMTest.px" files in the
"C:\MYDBPath" in my local drive.
Set objRs = CreateObject("ADODB.RecordSet"X)
DB_STRING = "Provider=Microsoft.Jet.OLEDB.X4.0;Data
Source=C:\MYDBPath;Extended Properties=Paradox 5.x;"
strSQL = " UPDATE UMTest SET Field1 = 1.222 WHERE Col1ID = '" & Value1
& "' AND Col2 = '" & Value2 & "'"
objRs.Open strSQL, DB_STRING
I get the following error.
Error Source: Microsoft Jet Database engine.
Error Description: No Value given for one or more required parameters.
Connection string looks alright to me. I don't know what is other
reason which is causing this error to happen.
Thanks.

Connecting to Paradox

Hello,
I am trying to connect to paradox database for the purpose of updating
the record(s) in DTS ActiveX Script Task.
I used the following connection string. But I get an error while
connection. I have "UMTest.db" and "UMTest.px" files in the
"C:\MYDBPath" in my local drive.
Set objRs =3D CreateObject("ADODB.RecordSet"=AD)
DB_STRING =3D "Provider=3DMicrosoft.Jet.OLEDB.=AD4.0;Data
Source=3DC:\MYDBPath;Extended Properties=3DParadox 5.x;"
strSQL =3D " UPDATE UMTest SET Field1 =3D 1.222 WHERE Col1ID =3D '" & Value1
& "' AND Col2 =3D '" & Value2 & "'"
objRs.Open strSQL, DB_STRING
I get the following error.
Error Source: Microsoft Jet Database engine.
Error Description: No Value given for one or more required parameters.
Connection string looks alright to me. I don't know what is other
reason which is causing this error to happen.=20
Thanks.You may try to create a User DSN first using ODBC Administrator. Instead of
DB_STRING="..", you can set DB_STRING=UserDSNNameYouCreated. To simplify it,
please do not include update command. Try to connect it first and see if it
works.
Thanks
Bei
"Yunus's Group" <yunusasmath@.gmail.com> wrote in message
news:1123266364.868066.278640@.g43g2000cwa.googlegroups.com...
Hello,
I am trying to connect to paradox database for the purpose of updating
the record(s) in DTS ActiveX Script Task.
I used the following connection string. But I get an error while
connection. I have "UMTest.db" and "UMTest.px" files in the
"C:\MYDBPath" in my local drive.
Set objRs = CreateObject("ADODB.RecordSet"_)
DB_STRING = "Provider=Microsoft.Jet.OLEDB._4.0;Data
Source=C:\MYDBPath;Extended Properties=Paradox 5.x;"
strSQL = " UPDATE UMTest SET Field1 = 1.222 WHERE Col1ID = '" & Value1
& "' AND Col2 = '" & Value2 & "'"
objRs.Open strSQL, DB_STRING
I get the following error.
Error Source: Microsoft Jet Database engine.
Error Description: No Value given for one or more required parameters.
Connection string looks alright to me. I don't know what is other
reason which is causing this error to happen.
Thanks.

Sunday, March 11, 2012

connecting to database from script component

Can someone please send me some sample code on how to connect to the database from the script component? I tried using the connection manager to establish a connection and then use it inside my code in VB.NET but it did not work. Please send me some samples.did you try using ado.net to connect to the database?|||

See also http://msdn2.microsoft.com/en-us/library/ms135897.aspx

And here is a sample of destination component:
http://msdn2.microsoft.com/en-us/library/ms135939.aspx

connecting to database from script component

Can someone please send me some sample code on how to connect to the
database from the script component? I tried using the connection manager to
establish a connection and then use it inside my code in VB.NET but it did
not work. Please send me some samples.Shiva
InVB.net you can specify app.config file to communiccate with a database,
have you read about it?
"Shiva" <arbitsquare@.hotmail.com> wrote in message
news:%23JFufYzjGHA.4716@.TK2MSFTNGP03.phx.gbl...
> Can someone please send me some sample code on how to connect to the
> database from the script component? I tried using the connection manager
> to establish a connection and then use it inside my code in VB.NET but it
> did not work. Please send me some samples.
>

Thursday, March 8, 2012

Connecting to a SQLServerCE database through vbscript

Is it possible to talk to a SQLServerCE database from a vbs script? If so, does anyone have an example?

Thanks,
Mike

Have a look at ADOCE: http://msdn2.microsoft.com/en-us/library/ms826696.aspx

Sunday, February 19, 2012

connecting in a script to another db

hi.

I've tried to use the exec sql connect to ... in query analyzer, but could not
get it to parse.

Can someone show me how in a script, say the middle, I can connect to another
database and execute the remaining script lines there.

This way I can have a script update two separate db's at once.

Thanks
Jeff

Jeff KishJeff,

You can specify the from clause of SQL statements as
DATABASE.OWNER.TABLE, as long as they are on the same SQL Server. You
may also utilize the USE DATABASE command to change which database you
script will execute in. But, if you have different servers you want to
access, then that will not work unless you have set up Linked Servers.
In which case you would add the servername to the beginning of your
sting: SERVERNAME.DATABASE.OWNER.TABLE.

Update Table1 set C1 = 'YES' from Table1 T1, Table2 T2 where
T1.ReportID = T2ReportID

use DB2 --This Example will use both Databases to update the column

Update Table 4 set C5 = 'Report Printed' from Table4 T4, DB1.DBO.Table1
T1 where T4.ReportID = T1.ReportID

Steve|||On 23 Mar 2006 13:16:41 -0800, "sdyckes" <stephendyckes@.gmail.com> wrote:

>Jeff,
> You can specify the from clause of SQL statements as
>DATABASE.OWNER.TABLE, as long as they are on the same SQL Server. You
>may also utilize the USE DATABASE command to change which database you
>script will execute in. But, if you have different servers you want to
>access, then that will not work unless you have set up Linked Servers.
>In which case you would add the servername to the beginning of your
>sting: SERVERNAME.DATABASE.OWNER.TABLE.
>Update Table1 set C1 = 'YES' from Table1 T1, Table2 T2 where
>T1.ReportID = T2ReportID
>use DB2 --This Example will use both Databases to update the column
>Update Table 4 set C5 = 'Report Printed' from Table4 T4, DB1.DBO.Table1
>T1 where T4.ReportID = T1.ReportID
>Steve
Thanks Steve. They will be on the same SQL Server, so I can run with this.

Regards
Jeff Kish

Friday, February 17, 2012

Connecting as a different user in a script

Is there a way to connect as a different user inside of a
script or SP? If so, could someone tell me the syntax (T-
SQL)? With that, I'd need to know how to disconnect or
close that connection and go back to the original
connection that ran the script.
Thanks,
VanUsername or login?
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Van Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:070c01c3c320$b7479f40$a501280a@.phx.gbl...
> Is there a way to connect as a different user inside of a
> script or SP? If so, could someone tell me the syntax (T-
> SQL)? With that, I'd need to know how to disconnect or
> close that connection and go back to the original
> connection that ran the script.
> Thanks,
> Van|||SQL Login. Connect as a different sql login from a script
or sp....
>--Original Message--
>Username or login?
>--
>Tibor Karaszi, SQL Server MVP
>Archive at:
>http://groups.google.com/groups?
oi=djq&as_ugroup=microsoft.public.sqlserver
>
>"Van Jones" <anonymous@.discussions.microsoft.com> wrote
in message
>news:070c01c3c320$b7479f40$a501280a@.phx.gbl...
>> Is there a way to connect as a different user inside of
a
>> script or SP? If so, could someone tell me the syntax
(T-
>> SQL)? With that, I'd need to know how to disconnect or
>> close that connection and go back to the original
>> connection that ran the script.
>> Thanks,
>> Van
>
>.
>|||For SQL Login, you can use xp_cmdshell which kicks off OSQL and use the appropriate user in the /U
script.
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Van Jones" <anonymous@.discussions.microsoft.com> wrote in message
news:1436a01c3c327$010a50e0$a601280a@.phx.gbl...
> SQL Login. Connect as a different sql login from a script
> or sp....
> >--Original Message--
> >Username or login?
> >
> >--
> >Tibor Karaszi, SQL Server MVP
> >Archive at:
> >http://groups.google.com/groups?
> oi=djq&as_ugroup=microsoft.public.sqlserver
> >
> >
> >"Van Jones" <anonymous@.discussions.microsoft.com> wrote
> in message
> >news:070c01c3c320$b7479f40$a501280a@.phx.gbl...
> >> Is there a way to connect as a different user inside of
> a
> >> script or SP? If so, could someone tell me the syntax
> (T-
> >> SQL)? With that, I'd need to know how to disconnect or
> >> close that connection and go back to the original
> >> connection that ran the script.
> >>
> >> Thanks,
> >>
> >> Van
> >
> >
> >.
> >

Friday, February 10, 2012

Connect to SQL Server 2005 Express Edition using SQLDMO

Hi!
I have small testing sqldmo.vbs script to check sqldmo connectivity:
Dim srv
Set srv = CreateObject("SQLDMO.SQLServer")
srv.LoginSecure = True
srv.Connect "(local)" ' Here is error when trying to connect to Express
Edition
MsgBox srv.VersionString
Under Windows 2000 with SQL Server 2000 it works fine.
But under Windows XP with SQL Server 2005 Express Edition my test fails
with message:
Windows Script Host
--
Script: C:\sqldmo.vbs
Line: 4
Char: 1
Error: Unspecified error
Code: 80004005
Source: (null)
--
I checked version of sqldmo.dll under Windows XP. It is 2000.85.1054.0.
File with the same version is included in Microsoft SQL Server 2005
Backward Compatibility Components. So i believe my test should work with
2005 Express Edition.
What am i doing wrong?Well for one make sure your instance of Express is set to allow remote
connections and that TCPIP is enabled. But in any case I don't think DMO is
upwards compatible with any 2005 editions. While some things may work it
certainly does not know about any of the new features. I believe what the
backwards compatibility part meant was that DMO in the 2005 install can talk
to 2000 machines. For 2005 you should use SMO.
Andrew J. Kelly SQL MVP
"Igor Solodovnikov" <IgorSolodovnikov@.discussions.microsoft.com> wrote in
message news:op.s253k8mfn8ihmu@.iw2k.helpmicro.local...
> Hi!
> I have small testing sqldmo.vbs script to check sqldmo connectivity:
> Dim srv
> Set srv = CreateObject("SQLDMO.SQLServer")
> srv.LoginSecure = True
> srv.Connect "(local)" ' Here is error when trying to connect to Express
> Edition
> MsgBox srv.VersionString
> Under Windows 2000 with SQL Server 2000 it works fine.
> But under Windows XP with SQL Server 2005 Express Edition my test fails
> with message:
> --
> Windows Script Host
> --
> Script: C:\sqldmo.vbs
> Line: 4
> Char: 1
> Error: Unspecified error
> Code: 80004005
> Source: (null)
> --
>
> --
> I checked version of sqldmo.dll under Windows XP. It is 2000.85.1054.0.
> File with the same version is included in Microsoft SQL Server 2005
> Backward Compatibility Components. So i believe my test should work with
> 2005 Express Edition.
> What am i doing wrong?|||Thank you for answer. Actually now i dont need any new features of 2005
editions. I need only old features accessible through old DMO.
Actually my test already working but it started to work only after full
system reboot. Restarting services does not helped me. So now i need some
investigation to figure out which particular configuration options affect
SQLDMO connectivity.
On Tue, 10 Jan 2006 18:26:52 +0200, Andrew J. Kelly
<sqlmvpnooospam@.shadhawk.com> wrote:

> Well for one make sure your instance of Express is set to allow remote
> connections and that TCPIP is enabled. But in any case I don't think
> DMO is
> upwards compatible with any 2005 editions. While some things may work it
> certainly does not know about any of the new features. I believe what the
> backwards compatibility part meant was that DMO in the 2005 install can
> talk
> to 2000 machines. For 2005 you should use SMO.
>|||hmm, try using ".\sqlexpress" in your connect statement.|||Thank you for your hint. ".\sqlexpress" really work. But now i have system
where ".\sqlexpress" works but "(local)" does not. Why? I need "(local)"
because my application has no clue to what version of SQL Server it
connects...
On Tue, 10 Jan 2006 19:34:34 +0200, jonel.rienton@.gmail.com
<jonel.rienton@.gmail.com> wrote:

> hmm, try using ".\sqlexpress" in your connect statement.
>|||(local) is your default sql server installation, .\sqlexpress is a
named instance; as you probably know, one can have multiple instance of
sql server installation in one box.|||If you really need (local) to work for some reason, your only option is to
uninstall SQL Express and reinstall it as the default instance in the
Advanced Options section of setup.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
<jonel.rienton@.gmail.com> wrote in message
news:1137097362.319395.67730@.g14g2000cwa.googlegroups.com...
> (local) is your default sql server installation, .\sqlexpress is a
> named instance; as you probably know, one can have multiple instance of
> sql server installation in one box.
>