Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Friday, March 9, 2012

experience a hard time to connect to the database my dbase is sql express ed 2005

hi to all , well i succesfully installed SQL server 2005 express edition in windows 2000 however when i am trying to connect my program thru ODBC im having a difficulty to connect. but based on my observation if i am not connected to the internet i cannot connect to my database but if i am connected to the internet i could access the SQL server 2005 express edition.i have read the hardware requirements for SQL server 2005 express edition i have upgraded the IE5 into IE6 SP1,windows 2000 SP4, even my memory to 1GB.but still i have the problem.

my question is, do i have to maintain my connection to the internet for me to have a smooth SQL connection?

BTW, i badly need the answer.Bigthanks!

-gae-

Have a look at my screencast for enabling Remote connections, that should help. They are available in the screencasts section of my site.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

Expects Parameters When It Should Not

Hi,
I have a stored proc that has one output parameter. When I call
this sp from my client program (an MS Access VBA) it has always worked fine,
but just recently started to give me a message saying that the stored
procedure is expecting a parameter named @.TPRD but did not receive it,
program fails. @.TPRD is the output parameter and is declared as such. I
have not changed the sp recently so there is no code change in the sp. I
do not administrate my SQL Server, but I did request my administrator to
grant me EXEC access to sp_debug so that I could run the stored procedure
debugger. My sp stopped working at about the same time. Do you think
these two events could be related? How to solve? The code for my
stored procedure is below:
ALTER PROCEDURE [ad\jmuseck].[SELECT_TPRD]
@.TPRD VARCHAR(6) OUTPUT
AS
SELECT @.TPRD = TPRD
FROM tblCurrentMonth
RETURN @.TPRD
----
The code in my client MS Access VBA program looks like this:
Function SelectTprd(Optional newval As Variant) As String
Dim cmdCommand As ADODB.Command
Dim prmTPRD As ADODB.Parameter
Set cmdCommand = New ADODB.Command
cmdCommand.ActiveConnection = CurrentProject.AccessConnection
cmdCommand.CommandType = adCmdStoredProc
cmdCommand.CommandText = "SELECT_TPRD"
cmdCommand.Parameters.Refresh
<--STARTED FAILING ON THIS LINE !!
Set prmTPRD = cmdCommand.CreateParameter("@.TPRD", adChar, adParamOutput)
cmdCommand.Execute
'Return the time period to the calling program.'
SelectTprd = cmdCommand.Parameters(1).Value
Set cmdCommand = Nothing 'Free memory
End FunctionHello, Joe
This problem is related to MS Access, more specifically to the OLEDB
provider that Access uses internally. Use one of the following
workarounds:
1. Do not use Parameters.Refresh; instead of this, add each of the
parameters of the stored procedure (even if they have default values)
to the Parameters collection, *in the same order that they are
defined*, using something like this:
cmd.Parameters.Append cmd.CreateParameter("@.ParameterName",...)
2. Use another connection, based on the SQL Server OLEDB provider
(instead of the internal Access OLEDB provider), i.e. instead of the
line:
cmdCommand.ActiveConnection = CurrentProject.AccessConnection
use the following:
cmdCommand.ActiveConnection = CurrentProject.BaseConnectionString
3. If you use at least ADO 2.6, set the NamedParameters property to
True (before setting the ActiveConnection property) and:
a) use Parameters.Refresh (after setting the ActiveConnection) and fill
only the input parameters you need with something like this:
cmd.Parameters("@.ParameterName")=Value
after cmd.Execute, you can get the value of the output parameter by
reffering to it the same way:
Variable=cmd.Parameters("@.ParameterName")
or:
b) do not use Parameters.Refresh, but add the input parameters that you
need (in any order) (it's not necessary to add the input parameters
that have default values) , and also the output parameters (before
setting the ActiveConnection), with something like this:
cmd.Parameters.Append cmd.CreateParameter("@.ParameterName",...)
after cmd.Execute, you can get the value of the output parameter by
reffering to it the same way as above:
Variable=cmd.Parameters("@.ParameterName")
For more informations about the last method, see:
http://msdn.microsoft.com/library/e...dparameters.asp
The easiest method would be the second one (using the
BaseConnectionString to open another connection).
Note: in this message, I wrote about the case when the procedure has
more input parameters, some of them having default values, in addition
to the output parameters. In your case, if you have just one (output)
parameter, some of my remarks do not apply (i.e. adding the parameters
in the same order that they are defined, etc).
Razvan

Wednesday, March 7, 2012

expanding databases in SQL 6.5

I have a SQL 6.5 database that we parse some data into everyday using
an access program. All this was devises and setup by a programmer that
I can't get in contact with anymore and it has actually run for about
five years without a hickup! But just a few days ago our parsing
program just stops dead before completing and I did get this error
message.

"exportaLLdataToSQLifnoerror(): number 3146 Description- odbd- call
failed. [Micorsoft][odbc SQL Server Driver] [sql server] Can't
allocate space for object 'syslogs' in database 'newpdatasql' because
the 'logsegment' segment is full. If you ran out of space in Syslogs,
dump the transaction log. Otherwise, use ALTER DATABASE or
sp_extendsegment to increase the size of the segment. (#1105)"

I have looked at the database in SQL referred to and I notice that it
says there is 200 MEg allocated for the log size and 250 meg for the
data size and that in both categories there is "0" space available.
When I select "EXPAND" on this page it takes me to a screen which has
a graphical presentation with a bar chart showing the available space
in red and the used space in blue on each of what it refers to as
'database devices". There are 10 items shown--
Temp_DB available space 30 used 30, Newplog 200 available 200 used,
NewpDev 250 available 250 used, MSDBlog available 2.00 used 2.00,
MSDBData 6 available 6 used, Master 50 available 50 used, Data_log
2.00 available 2.00 used, Dale_data 12 available 12 "free space" (
this one says free space instead of used?), Contact_log 25 available
15 used, Contact_dev 100 available 75 used.

So I can see on the first screen that there was 450 meg allocated to
this database called newpdatasql and that all 450 is being used. And
when I go to the next screen that shows the devices in this database
that many of them show that their available space is completely used.

The fix is probably to expand the available space for the database. On
the second graphical screen that shows the bar chart there is an
button called "expand now" that is greyed out except when you select
the different devices in a drop-down box at the top of the screen.
There are two drop down boxes -- one titled "data devices and one
titled log devices. THe only time the Expand now button is not greyed
out is when I select "Dale_Data, "Contact_log", or "Contact_dev". I
did select the "contact_Dev" device clicked on expand and it seemed to
I guess expand this device to a fully used level as after I did this
it says that the space available is still 100 meg ( see comments
above) but now instead of 75 used it says 100 used! Progress or what?
I guess I could do this for the other devices as well. One issue for
me is whether when the space available for a device is the same as the
space used does this mean that it is at maximum capacity in terms of
data or only that the space available on the disk for this device is
completely being made available as potential storage space?

Interestingly the original error message mentions "syslogs" and
"logsegment" neither are available as devices or are named in the
screens relating to database expansion.

Any help would be greatly appreciated.

My tollfree number is 866-957 1081.

Jeffrey Kilpatrick[posted and mailed, please reply in news]

Jeffrey Kilpatrick (jeff@.newportsecurities.com) writes:
> "exportaLLdataToSQLifnoerror(): number 3146 Description- odbd- call
> failed. [Micorsoft][odbc SQL Server Driver] [sql server] Can't
> allocate space for object 'syslogs' in database 'newpdatasql' because
> the 'logsegment' segment is full. If you ran out of space in Syslogs,
> dump the transaction log. Otherwise, use ALTER DATABASE or
> sp_extendsegment to increase the size of the segment. (#1105)"

On SQL 6.5 the transaction is a table, syslogs. So what happened is
that you run out of log space.

This could happen because the data import actually needs 200 MB of
log space, so your regular dumping of the transaction log does not
help.

But it could also you have never taken any transaction log backups,
and the database is not set to "truncate log on checkpoint". If the
case is that you don't care about T-log backups on this database, just
issue "DUMP TRANSACTION db WITH NO_LOG". And then execute:

sp_dboption db, "trunc", true

which sets on "truncate log on checkpoint" which is the same as simple
recovery in SQL2000.

Assuming now that you actually have to make the log space larger (which
my guess is that you don't), then I'll try to explain the oddities of 6.5.

> When I select "EXPAND" on this page it takes me to a screen which has
> a graphical presentation with a bar chart showing the available space
> in red and the used space in blue on each of what it refers to as
> 'database devices". There are 10 items shown--

In 6.5 all databases are on devices. A device may host a single database,
or it may host many. And a database can be spread out on several devices.
It is a confusing scheme in the NT world, but when Sybase devised this
they had Unix boxes in mind, where the devices typically would reside on
raw disk.

To expand your log, you first need to find some available space on
a device or create some new device space. While you add 25 MB to
that contact_dev, space, expanding the existing device or adding a
new device is a better way to go.

Whether you actually can extend a device I don't remember off-hand. But
as long as you have the disk space, you can always add a new device and
expand the log onto that one.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Sunday, February 26, 2012

Exit codes for successful install?

Hello everyone,
I'm calling MSDE setup from my installation program with:
setup.exe SecurityMode=sql REBOOT=ReallySuppress instancename="QSA"
sapwd=********** /l*v "C:\Program Files\SGM\MSDE.LOG"
I have seen this call return value 3010 (GetExitCodeProcess) on a W98SE and
a W2000 machine.
1) What does this return value mean (anything specific other than
'success')?
2) Are there more return values that indicate success?
(so that I can distinguish them from failure)
Thanks in advance
Jan
Jan Doggen, QSA Landsmeer, The Netherlands
Please remove the spam blocker from my email address when replying directly
Found the answer myself a few days later
http://msdn.microsoft.com/archive/de...us/dnarsql7/ht
ml/deploybus_depdbsol.asp
Exit Code Description
0 Successful installation (no reboot required)
3010 Successful installation (reboot required)
-1 Failed installation (logic or configuration error)
Other Failed installation (Win32 error code-see Endnote 6)
Jan
"Jan Doggen" <j.doggen@.BLOCKqsa.nl> schreef in bericht
news:OLNf#weMEHA.1348@.TK2MSFTNGP10.phx.gbl...
> Hello everyone,
> I'm calling MSDE setup from my installation program with:
> setup.exe SecurityMode=sql REBOOT=ReallySuppress instancename="QSA"
> sapwd=********** /l*v "C:\Program Files\SGM\MSDE.LOG"
> I have seen this call return value 3010 (GetExitCodeProcess) on a W98SE
and
> a W2000 machine.
> 1) What does this return value mean (anything specific other than
> 'success')?
> 2) Are there more return values that indicate success?
> (so that I can distinguish them from failure)
> Thanks in advance
> Jan
>
> --
> ----
-
> Jan Doggen, QSA Landsmeer, The Netherlands
> Please remove the spam blocker from my email address when replying
directly
>

Friday, February 24, 2012

Existing Oracle Program Prevents SQL Server Express Being Installed in Windows XP Pro that is in

Hi all,

Our Microsoft NT 4 Network has Oracle program for all the Windows XP Pro PC terminals to use. We did not have the SQL Server Express Beta version installed before. Recently our Computer Administrator tried to install the SQL Server Express Edition that is downloaded from Microsoft Website to my Windows XP Pro PC terminal without luck, because the Oracle program is already in our LAN Network and prevents the installation of the SQL Server Express. Please help and advise me how to get the SQL Server Express installed in this situation.

Thanks in advance,

Scott Chang

Hi Scott,

First off, you'll need to take a look at the installer logs to get an idea of why installation failed. The logs are in C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG and C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Files.

Second, I'm going to move this to the Setup forum so they can take a look at this once you've come back with information from the logs.

- Mike

|||Can you supply the exact error encountered when trying to install Express, as well as the logs referenced by Mike above?

Execution TIme Problem

I am trying to run a SQL Server procedure from a program in ASP.Net 2005. This procedure is to insert around 500 records(can exceed every month) in a table with 4 columns and is also containing another small procedure also. When this procedure is executed from online server, it shows timeout message as:

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

But when the same procedure is run from SQL Query Anayser it excute within seconds. How can i solve this problem , i need this solution urgently too.

Hope to get ur response soon.

Hello romita

Do you mind sharing some code. It would be helpful to try and figure out the problem

Also are you able to run SQL Profiler to check that statments that are hitting the databse from the aps.net application.

regards

G

|||

Hi Gonzo11,

Regarding the same problem posted yesterday, am enclosing the code of procedure below for ur reference. Please check n let me know if theres any solution.

CREATE PROCEDURE proc_userroyalty
@.month int, @.year int, @.joins int output, @.royalties int output, @.royaltyamt decimal output, @.netamt decimal output

as

declare @.joinamt bigint, @.user varchar(50), @.left int, @.middle int, @.right int, @.royalty decimal, @.regdate datetime , @.totalpairs int, @.lsdate varchar(50), @.bdate datetime, @.maxamt decimal, @.nxtmon int, @.totalroyal decimal, @.nxtdt datetime, @.nxtyr int

if exists(select * from db_bonusdetails where bd_purpose='R' and month(bd_date)=@.month and year(bd_date)=@.year and @.month<month(getdate()) and @.year<=year(getdate()) )
begin
select @.joins = count(*) from db_users where month(us_regdate)=@.month and yeaR(us_regdate)=@.year
select @.royalties=count(*) from db_tempbonus where temp_month<=@.month andtemp_year=@.year
if @.month<8 and @.year <=2007
begin
select @.joinamt=@.joins * 100
end
else
begin
select @.joinamt=@.joins * 120
end

select @.royaltyamt = floor(@.joinamt / @.royalties)
select @.netamt=sum(bd_amount) from db_bonusdetails where bd_purpose='R' and month(bd_date)=@.month and year(bd_date)=@.year group by bd_amount

end
else
begin
delete from db_bonusdetails where bd_purpose='R' and datepart(mm,bd_date)=@.month and datepart(yyyy,bd_date)=@.year

select @.joins=count(*) from db_users where datepart(month,us_regdate) = @.month and datepart(year,us_regdate) = @.year and us_status='Y'

exec proc_royal @.month, @.year
select @.royalties=count(*) from db_tempbonus where temp_month<=@.month andtemp_year=@.year

select @.joinamt=@.joins * 120

if @.royalties > 0
begin

select @.royaltyamt = floor(@.joinamt / @.royalties)
select @.lsdate=str(@.month) + '-' + '28' + '-' + str(@.year)
select @.bdate=convert(datetime,@.lsdate)


declare cur_bonus cursor
for select temp_user,temp_regdt from db_tempbonus where temp_month<=@.month andtemp_year=@.year

open cur_bonus
fetch next from cur_bonus into @.user,@.regdate

while @.@.fetch_status = 0
begin
select @.nxtdt=dateadd(mm,3,@.regdate)

if datediff(dd,@.nxtdt,getdate()) > 0
begin
select @.nxtmon=month(@.nxtdt)
select @.nxtyr=year(@.nxtdt)

SELECT @.totalpairs= SUM(mp_lcount) + SUM(mp_mcount) + SUM(mp_rcount)
FROM db_monthlypairs
WHERE (mp_month<=@.nxtmon ) and (mp_year <=@.nxtyr) AND (mp_user = @.user)

if @.totalpairs< 30
begin
select @.maxamt=25000
end
else
begin
select @.maxamt=50000
end
end
else
begin
select @.maxamt=50000
end

select @.totalroyal=sum(bd_amount) from db_bonusdetails wherebd_user=@.user and bd_purpose='R'

if @.totalroyal <@.maxamt or @.totalroyal is null
begin
insert into db_bonusdetails values(@.bdate,@.user,'R',@.royaltyamt)
end

fetch next from cur_bonus into @.user,@.regdate
end

close cur_bonus
deallocate cur_bonus

select @.netamt=sum(bd_amount) from db_bonusdetails where bd_purpose='R' and datepart(mm,bd_date)=@.month and datepart(yyyy,bd_date)=@.year

end
else
begin
select @.royalties=0
select @.royaltyamt=0
select @.netamt=0
end
end
GO

PROCEUDRE 2 - proc_royal to be executed within above one.

CREATE PROCEDURE proc_royal
@.month int , @.year int
AS


declare @.user varchar(50), @.regdt datetime, @.lcount int , @.mcount int, @.rcount int, @.uspos char(1), @.rows int, @.mainuser varchar(50), @.regdate datetime

declare cur1 cursor
for select mp_user, us_regdate from db_users,db_monthlypairs where mp_user=us_login and mp_month<=@.month and mp_year<=@.year and mp_user not in(select temp_user from db_tempbonus where temp_month<=@.month and temp_year<=@.year)
group by mp_user, us_regdate having sum(mp_lcount)>=1 and sum(mp_mcount) >=1 and sum(mp_rcount)>=1
open cur1
fetch cur1 into @.mainuser, @.regdate
while @.@.fetch_status=0
begin
declare cur2 cursor

for select us_login, us_regdate, us_position from db_users whereus_reference=@.mainuser and month(us_regdate) <= @.month and year(us_regdate)<=@.year
open cur2
fetch cur2 into @.user, @.regdt, @.uspos
while @.@.fetch_status=0
begin
if @.uspos ='L'
begin
select @.lcount=count(*) from db_users whereus_reference=@.user and month(us_regdate) <= @.month and year(us_regdate)<=@.year
select @.lcount = @.lcount + 1
end
else
begin
if @.uspos ='M'
begin
select @.mcount=count(*) from db_users whereus_reference=@.user and month(us_regdate) <= @.month and year(us_regdate)<=@.year
select @.mcount = @.mcount + 1
end
else
begin
select @.rcount=count(*) from db_users whereus_reference=@.user and month(us_regdate) <= @.month and year(us_regdate)<=@.year
select @.rcount = @.rcount + 1
end

end
fetch cur2 into @.user, @.regdt, @.uspos
end

close cur2
deallocate cur2

if @.lcount>=4 and @.mcount>=4 and @.rcount >=4
begin
insert into db_tempbonus values(@.mainuser, @.regdate, @.month, @.year)
end
fetch cur1 into @.mainuser, @.regdate
end

close cur1
deallocate cur1
GO

proc_royal is to add new members satisfying the condtitions to a table eah month. In the main procedure based on all records in this table that many records will be inserted in another one. This part came as updation in the project, so its very risky to change other codes as it might affect existing program.

Hope u got the idea of the procedure.

If theres any simple way with less execution time please let me know. By each month records can increase too, so solution has to be one for furture user too.

Awaiting ur response,

Regards,

Romita


|||

Basedon your post, the error occurs when the execution time beyond TimeoutProperty. When you are trying to connect or access to a Database tablewhich is having large volume of data, query execution time will bemore. There are two main Timeout property in ADO.NET.

1.Connection Timeout for Connection. It could be solved by settingConnectionTimeout property of Connection object in Connection String.
2. Timeout for Data access ( Command Object ). You can setCommandTimeoutproperty to Command object.I recommend you set CommandTimeOut propertyto bigger one value. Try this.

Please let me know whether this canhandle this problem or not.If you have any further questions, please feel free to let me know.

|||

Hello Romita,

Thank you for you reply. I will need some time to go over you SP.

In the meantime are you able to run the SQL Profiler and check what is actually hitting the DB and what is taking the longest time.

regards,

G

|||

Hi!

I have tried setting command timeout and connection timeout properties, but still this Time Out Expired exists. Just setting the Timeout property of each object is enough or some other changes are also reqd.

Actually i had tried executing the procedure without calling another procedure within, it didn;t solve my problem. Time is taking to insert 400-500 records at a time, but it cannot be programmed in other way too.

Pls let me know, if theres more to do in Timeout settings or if theres another solution.

Regards,

Romita

|||

Hello Romita,

I have looked at the code that you have sent but i fyou say that it is inserting 400-500 rows that generaly should not take a very long time.

You have to see which parts of the SP are taking up most of the time and address them first.

So, you would have to run SQL Server Profiler, that will help you identify what is hitting the database and what is taking the most time.
Once you identify that you can try to address that issue. For example, very often creating an index for a table ususaly helps.

Hope this helps

regards,
G