Ask a Question related to ASP Database, Design and Development.
-
Cecil Westerhof #1
Problems with views from Firebird
I have to maintain code written by someone else. It makes extensive use of
dynamic views and stored procedures. The strange thing is that when we
execute the statement "DROP VIEW MV_22_", that it never gives an error, but
is not always done. When I then try to delete it with Database Workbench, it
gives an error of in use. So it looks like sometimes connections are not
terminated correctly. Is there a way to find out where a connection is not
terminated correctly? Is there a way to make the timeout of a connection
shorter?
Cecil Westerhof Guest
-
Firebird 1.5
Where see examples of use ASP with Firebird ? thanks Vivian -
Problems with deleting views
The application I have to maintain uses dynamical views. I have the following code: oOrgDbConn.BeginTrans DropStr = "DROP VIEW MV_22_"... -
Mozilla Firebird
Thus spake David Purton: You can also apt-get install mozilla-tabextensions -- Nathan Poznick <poznick@conwaycorp.net> Solitude, though... -
Problems with large firebird gdb files > 2GB.
Hello, I have this configuration: linux rh 7.0, kernel 2.4.20, apache 1.3.27, with php 4.2.3 as apxs module with firebirdCS-1.0.3-64IO I have... -
Views inside views, execution plan & external WHERE clause
Here's my situation: Step 1: select * from employees where dept_no=1 and employee_no=1 ; -
Bob Barrows [MVP] #2
Re: Problems with views from Firebird
Cecil Westerhof wrote:
First of all, you need to figure this out. No error? That's just not right!> I have to maintain code written by someone else. It makes extensive
> use of dynamic views and stored procedures. The strange thing is that
> when we execute the statement "DROP VIEW MV_22_", that it never gives
> an error, but is not always done.
Are you using On Error Resume Next? If so, are you checking the Err object
immediately after attempting to execute this line? Are you checking the
connection's Errors collection?
Are you closing and destroying connection explicitly instead of depending on> When I then try to delete it with
> Database Workbench, it gives an error of in use. So it looks like
> sometimes connections are not terminated correctly. Is there a way to
> find out where a connection is not terminated correctly? Is there a
> way to make the timeout of a connection shorter?
automatic garbage collection?
By default, connections are kept open for 60 seconds in order to allow them
to be used by new processes instead of spawning new connections every time a
process needs one. This default time can be shortened but it is not really
recommended that you do so: you will reduce the scalability of your app due
to forcing new connections to be created every time a process needs one.
Each connection takes time to open, and it also uses memory both on the web
server and on the database server.
I question the need for all this dynamic stuff. As you are discovering, it
is impairing the scalability of your application.I don't know what kind of
task it would be to rewrite it, but it sounds as if it would be worth doing.
Perhaps you can do it in small steps. Start with the page where this problem
is occurring. Figure out a different way to perform its task without needing
to create and drop a view. It should be possible. Fix this issue then move
onto the next issue ...
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Cecil Westerhof #3
Re: Problems with views from Firebird
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:OWosEXVIEHA.3444@TK2MSFTNGP11.phx.gbl...right!> Cecil Westerhof wrote:>> > I have to maintain code written by someone else. It makes extensive
> > use of dynamic views and stored procedures. The strange thing is that
> > when we execute the statement "DROP VIEW MV_22_", that it never gives
> > an error, but is not always done.
> First of all, you need to figure this out. No error? That's just notThat is what I would think. I use On Error Resume Next, but after this I> Are you using On Error Resume Next? If so, are you checking the Err object
> immediately after attempting to execute this line? Are you checking the
> connection's Errors collection?
check the Err object. The code:
on error resume next
oOrgDbConn.BeginTrans
DropStr = "DROP VIEW " & arrViewNames(arrIndex)
f.WriteLine Now() & " " & "trying to drop view "
f.WriteLine Now() & " " & DropStr
oOrgDbConn.execute DropStr, adExecuteNoRecords
If(Err.number <> 0) Then
'Execution failed
f.WriteLine Now() & " " & "Did NOT succeed"
f.WriteLine Err.Description & vbCrLf & Err.number
closeConnections true
errorRaised "S000402",""
else 'Execution succeeded
on error goto 0
f.WriteLine Now() & " " & "Did succeed"
oOrgDbConn.CommitTrans
End If
f.WriteLine ""
In my log this gives:
4/13/2004 2:52:59 PM trying to drop view
4/13/2004 2:52:59 PM DROP VIEW SV_22_
4/13/2004 2:52:59 PM Did succeed
So it should be okay, but it is not. I even did put a 'on Error goto 0' to
get the possibility that the CommitTrans is not succesfull. At the moment a
create view is executed, I get:
unsuccessful metadata update
Table MV_22_ already exists
on>> > When I then try to delete it with
> > Database Workbench, it gives an error of in use. So it looks like
> > sometimes connections are not terminated correctly. Is there a way to
> > find out where a connection is not terminated correctly? Is there a
> > way to make the timeout of a connection shorter?
> Are you closing and destroying connection explicitly instead of dependingIt is code from someone else, but I am afraid that he is depending on> automatic garbage collection?
garbage collection. I have allready found a lot off problems I had to
change.
them> By default, connections are kept open for 60 seconds in order to allowa> to be used by new processes instead of spawning new connections every timedue> process needs one. This default time can be shortened but it is not really
> recommended that you do so: you will reduce the scalability of your appweb> to forcing new connections to be created every time a process needs one.
> Each connection takes time to open, and it also uses memory both on theThen this is not the problem. Even five minutes later I still get an in use> server and on the database server.
error.
doing.> I question the need for all this dynamic stuff. As you are discovering, it
> is impairing the scalability of your application.I don't know what kind of
> task it would be to rewrite it, but it sounds as if it would be worthproblem> Perhaps you can do it in small steps. Start with the page where thisneeding> is occurring. Figure out a different way to perform its task withoutI did this also. But they opted for something with Crystal Report. This> to create and drop a view. It should be possible. Fix this issue then move
> onto the next issue ...
needs a recordset. Because the way the data is organised, it is only to get
a recordset with a view. I allready wanted to rewrite the code, but I am not
allowed, because 'It works'. The only problem is that the system has to be
rebooted after every report. Another problem is that there are more then 20
reports, so my boss is afraid about the time it will take to rewrite
everything. (He does not see how much time I allready spend on it.)
Cecil Westerhof Guest
-
Bob Barrows [MVP] #4
Re: Problems with views from Firebird
Cecil Westerhof wrote:
That's strange, you are missing an argument. It should be:> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:OWosEXVIEHA.3444@TK2MSFTNGP11.phx.gbl...>>> Cecil Westerhof wrote:>>>>> I have to maintain code written by someone else. It makes extensive
>>> use of dynamic views and stored procedures. The strange thing is
>>> that when we execute the statement "DROP VIEW MV_22_", that it
>>> never gives an error, but is not always done.
>> First of all, you need to figure this out. No error? That's just not
>> right! Are you using On Error Resume Next? If so, are you checking
>> the Err object immediately after attempting to execute this line?
>> Are you checking the connection's Errors collection?
> That is what I would think. I use On Error Resume Next, but after
> this I check the Err object. The code:
>
> on error resume next
> oOrgDbConn.BeginTrans
> DropStr = "DROP VIEW " & arrViewNames(arrIndex)
> f.WriteLine Now() & " " & "trying to drop view "
> f.WriteLine Now() & " " & DropStr
> oOrgDbConn.execute DropStr, adExecuteNoRecords
oOrgDbConn.execute DropStr, ,adExecuteNoRecords
You should check for an error here. The error might not occur until the> If(Err.number <> 0) Then
> 'Execution failed
> f.WriteLine Now() & " " & "Did NOT succeed"
> f.WriteLine Err.Description & vbCrLf & Err.number
> closeConnections true
> errorRaised "S000402",""
> else 'Execution succeeded
> on error goto 0
> f.WriteLine Now() & " " & "Did succeed"
> oOrgDbConn.CommitTrans
transaction is committed.
I don't understand why he used an explicit transaction for a single
statement's execution, anyways. It is not needed: there will be an implicit
transaction. Instead of adding more error-checking, just comment out the
begintrans and committrans statements.
Again, I question this statement. Not with the idea that a view is needed.> I did this also. But they opted for something with Crystal Report.
> This needs a recordset. Because the way the data is organised, it is
> only to get a recordset with a view.
It's the "dynamic" part I question, but you know the application ...
That is a problem. Start documenting your time, I guess. And the server's> I allready wanted to rewrite the
> code, but I am not allowed, because 'It works'. The only problem is
> that the system has to be rebooted after every report. Another
> problem is that there are more then 20 reports, so my boss is afraid
> about the time it will take to rewrite everything. (He does not see
> how much time I allready spend on it.)
downtime.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Cecil Westerhof #5
Re: Problems with views from Firebird
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:um9T2GWIEHA.2688@tk2msftngp13.phx.gbl...If I do this I get:>> > That is what I would think. I use On Error Resume Next, but after
> > this I check the Err object. The code:
> >
> > on error resume next
> > oOrgDbConn.BeginTrans
> > DropStr = "DROP VIEW " & arrViewNames(arrIndex)
> > f.WriteLine Now() & " " & "trying to drop view "
> > f.WriteLine Now() & " " & DropStr
> > oOrgDbConn.execute DropStr, adExecuteNoRecords
> That's strange, you are missing an argument. It should be:
> oOrgDbConn.execute DropStr, ,adExecuteNoRecords
Wrong number of arguments or invalid property assignment
implicit> I don't understand why he used an explicit transaction for a single
> statement's execution, anyways. It is not needed: there will be anI will do that.> transaction. Instead of adding more error-checking, just comment out the
> begintrans and committrans statements.
I am only updating the application. Certainly the part with the views is a>>> > I did this also. But they opted for something with Crystal Report.
> > This needs a recordset. Because the way the data is organised, it is
> > only to get a recordset with a view.
> Again, I question this statement. Not with the idea that a view is needed.
> It's the "dynamic" part I question, but you know the application ...
little in the dark for me. It is a kind of spagetti.
Cecil Westerhof Guest
-
Bob Barrows [MVP] #6
Re: Problems with views from Firebird
Cecil Westerhof wrote:
> "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> news:um9T2GWIEHA.2688@tk2msftngp13.phx.gbl...Very strange. I assumed he had the ADO constants defined since he used the>>>>>> oOrgDbConn.execute DropStr, adExecuteNoRecords
>> That's strange, you are missing an argument. It should be:
>> oOrgDbConn.execute DropStr, ,adExecuteNoRecords
> If I do this I get:
>
> Wrong number of arguments or invalid property assignment
>
>
adExecuteNoRecords constant. Does he have Option Explicit at the top of the
script block?
Here is a good way to get the ADO constants defined in all your pages:
[url]http://www.aspfaq.com/show.asp?id=2112[/url]
In the meantime, just add this line to your page to verify that this is the
problem:
Const adExecuteNoRecords = &H00000080
Actually, the command type should also be specified:
Const adCmdText = &H0001
Const adExecuteNoRecords = &H00000080
....
oOrgDbConn.execute DropStr, , _
adExecuteNoRecords + adCmdText
HTH,
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest
-
Cecil Westerhof #7
Re: Problems with views from Firebird
"Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
news:ukDwZvWIEHA.716@TK2MSFTNGP12.phx.gbl...the> Cecil Westerhof wrote:>> > "Bob Barrows [MVP]" <reb01501@NOyahoo.SPAMcom> wrote in message
> > news:um9T2GWIEHA.2688@tk2msftngp13.phx.gbl...> Very strange. I assumed he had the ADO constants defined since he used the> >> >>> oOrgDbConn.execute DropStr, adExecuteNoRecords
> >>
> >> That's strange, you are missing an argument. It should be:
> >> oOrgDbConn.execute DropStr, ,adExecuteNoRecords
> > If I do this I get:
> >
> > Wrong number of arguments or invalid property assignment
> >
> >
> adExecuteNoRecords constant. Does he have Option Explicit at the top ofIn the code there is:> script block?
>
> Here is a good way to get the ADO constants defined in all your pages:
> [url]http://www.aspfaq.com/show.asp?id=2112[/url]
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common
Files\System\adamsado15.dll" -->
As I understood it, this does the same?
The code starts with TRANSACTION=REQUIRED. When using Option Explicit this
gives problems. When I comment this out I got a lot errors, but not in the
code that is used to drop the views. So I removed it again. Strange thing is
that now it als works with:
oOrgDbConn.execute DropStr, ,adExecuteNoRecords
Most of the times the created view is dropped and when not I now get the
message that the view is in use. From the 22 places where a view is created
only in 4 it still goes wrong. Now I have to find out what is done different
on these 4 places.
I changed this also.> oOrgDbConn.execute DropStr, , _
> adExecuteNoRecords + adCmdText
Thanks for the help.
Cecil Westerhof Guest
-
Bob Barrows [MVP] #8
Re: Problems with views from Firebird
Cecil Westerhof wrote:
It should>
> In the code there is:
> <!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common
> Files\System\adamsado15.dll" -->
>
> As I understood it, this does the same?That's because TRANSACTION is not declared. Add:>
> The code starts with TRANSACTION=REQUIRED. When using Option Explicit
> this gives problems.
dim TRANSACTION
You're welcome> When I comment this out I got a lot errors, but
> not in the code that is used to drop the views. So I removed it
> again. Strange thing is that now it als works with:
> oOrgDbConn.execute DropStr, ,adExecuteNoRecords
> Most of the times the created view is dropped and when not I now get
> the message that the view is in use. From the 22 places where a view
> is created only in 4 it still goes wrong. Now I have to find out what
> is done different on these 4 places.
>>>> oOrgDbConn.execute DropStr, , _
>> adExecuteNoRecords + adCmdText
> I changed this also.
>
> Thanks for the help.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Bob Barrows [MVP] Guest



Reply With Quote

