I have a database class that I've been starting to use with my ASP apps and I was wondering about having too many database connections on one page. I'm beginning to write other classes that use the database class to reach into a table and pull data out.
Say for instance I have these classes:
Database
Users
News
Reviews
All of these classes have a method like getUserByID() or getNewsByID() but they are all using a private database object from the Database class.
Are they all using the same connection behind the scenes (underneath ASP) or are they all actually using separate connections? And if in fact they are using different connections then is there a common design patterns that alleviates the pressure by passing around the same DB object?
It makes me a bit uncomfortable to know that every class is creating a new Database object and a new connection on top of that; however, if you were pulling data from a MS SQL database for the users and an Access (ugh) database for the Reviews this would be necessary.
Is there a function or a script that I can use to monitor the connections to my SQL database. I want to see if any of my connection objects aren't closed (I have many ASP files and it's easy to forget to code something like this: PHP Code:
I am currently developing a coursework for uni that involves inserting some values into a Access database. I know how to do this, however I am trying to use different insert statements to insert data into different tables, however all the input field are on the same page. Code:
I have a question on DB Connection. My ASP requires me to create 2 DB connections to 2 different database.
2004.mdb & Information.mdb. In this 2004.mdb, I have 12 tables(tbl1,tbl2...tbl12).
And in Information.mdb, I have a table called t_information. This table houses all the names of tables from 2004.mdb.
In my ASP page, there is a drop down list. As you can guess, this drop down list retrieves the values from table t_information that resides in Information.mdb.
When I select the table that I want to display & click the submit button, I will have to create connection to this 2004.mdb that has all the tables(tbl1..tbl12) and display the selected table. Am I right? So, to achieve the displaying of the selected data, I have to create connection to both 2004.mdb & Information.mdb right? Is that possible? I mean, can I really create/establish these 2 database connections on the same ASP page?
I really need advices on this people. Do hope to see replies here. And I understand that we can TableDef in Access? Can anyone explain to me what does TableDef do? And how to go about creating it?
Wondering about best practices as regarding database connections and usage (MS SQL). Was building a class to contain all of the methods and suddenly wondered if this was the best way? Using a sledgehammer to crack a walnut etc.... Code:
I would like to be able to control the downloading of (my own)music files from my music site other than letting the user right click and "Save target As" on a hyperlink.
"Save Target As" must issue a command of some sort to the server. I would like to be able to issue that command myself under program control.
I want to design a page which has lots of criteria on which I want to be selected by using checkbox's. I then want to pass only the criteria that have been checked and store them in an Access DB, and leave the items that have not been ticked alone.
i got 2 tables...on the table "times" i only null the records column "dtime" (if it is not null) and save this records column "username"... straight after that i need to select on the second table "useringo" the record with the same username that its time was nulled and to null its column "msginfo"
i realy need your suggestion to how to do this...i do not want to run on all this tables every time...i want it be most minimal and smart.
My application runs on ASP and the business logic is embedded in Dlls written in VB. The application hosts a list of articles for the user to view and these are accessible through some complex urls like "http://mysite/articles/category1?articleid=34512". I would like to denote a friendly url to these articles such as "http://mysite/articles/kb_TaxPlanning.asp". I am thinking of using an ISAPI filter to do the work for me. My friend was trying on using a httphandler, but it did not work. Please share with us the resources for creating an isapi filter for the same. Also how to use the same for the expected result?
I have some values that I want to display as percent, such as the retail price/wholesale price. In some instances, the wholesale price is zero, so I get a division by zero error.
What can I do to avoid this?
Also, how can I get this to only show two decimals, instead of it going .##### the way it does. I want it to look like .45%
I'm trying to query a set of data from MSSql which contains field type "text" for unlimited length of characters.
I make a query and store the data into a recordset. However, soon as the page try to access the unlimited field, it seems as if the recordset looses all the data it was holding.
Does anyone know how to get around this problem? or what's causing this? I dont even get an error msg. It just doesn't show anything as if there was nothing there.
I'm trying to make the following asp code work using a DNS-Less connection on a windows 2000 server running IIS and ODBC 4.0 driver.
The Access database (odbc_exmp.mdb) was made using Access 2002. The code works if I set up a DNS on the server under the ODBC drivers. What I'm I doing wrong and what do I change the code to, to make it work using DNS-Less connection? Code:
Right, which do you use? If your using DSNless, then STOP! It's SLOWING down your code and making it UGLY!!
Why? Lets look...
UGLY! Which looks better [vbs] "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.mappath("./data/vote.mdb") [/vbs] or [vbs] "DSN=databaseStuff" [/vbs]
Its also easier to manage and will cause less typing errors. Think about it, it makes sense!
SPEED Everytime you run a DSNless connection inside an ASP page the connection string needs to be verified,but a DSN connection is only verified when it is created! Meaning the DSN connection is indeed faster.
I am not sure what is wrong with this code. I have tested it at home, used in on previous webpages, and with previous employers. But I am getting this error at my current employers server: Code:
I've been using ASP.NET for a couple years now and I'm trying to fall back into ASP for a new position I've acquired...and I'm having a bit of trouble remembering. I'm running to a problem where the basic logic is as follows:
Query
Do While Not rs.EOF Query based on value in rs Another query based on value in rs Loop
There is no explicit connection object, they all use the same connection string however. When I limit myself to one query within the Do/Loop, I don't have any problems. However, when I add another query in there, it bombs with: Operation is not allowed when the object is open.
I'm assuming it's referring to the connection string being reused, but why would it allow one additional connection, but not two. I can't really close this connection before needing to requery. Is there anyway around this, or am I missing something entirely?
someone on another forum expressed that dreamweaver "tends to drive the programmer to creat implicit connections and their effect on performance".could someone explain this to me? a provide some better code? (we no longer are required to use dream weaver to develop code for the app).
in my main page i need to retreive record set from the database as well as search for products. but the recordsets i need to retrieve are located in a different table then the products i need to search. is this possible to do ?
I am programming a rather large site which will hopefully attract thousands of visits per day. I have been told by other people that MS access begins to struggle once it has about 15 active connections.
Since I am currently using MsAccess to test my scripts along with IIS 5.0 or whatever it is, I guess that at some stage I am going to have to convert all my stuff so that the data is in an SQLServer Database, and that the scripts can read and write to it. could anyone tell me what the transition is like. should I consider using SQL Server from the beginning or will I just have to change a few lines on each page.
On my website, I want to provide 3 pieces of statistics that will require 3 queries to my SQL database. As much as I'd like these to be live, they are part of a footer that will load each time for about 10 pages on my site. I am thinking that, although they are simple queries, it may be just too much.
What do you recommend? I could open the connection, run the query and then close it, each time. Would this be a recommend plan? Or, should I create a daily task that builds a simple text file with those query results and just pull those in each time the footer is loaded? This would not be live, but I can deal with it.
I get somthing like "Max Connection limit is reached" error msg when trying to access a page. I wonder it is got to do with winxp pro sp2 patch which only limit 10 tcp connections? Running ms access as database and IIS 5.1.
how I might go about displaying all current open db connections in ASP, either for a particular web app/page or hopefully all of IIS ? We are having a few issues with IIS hanging and we feel that it is related to db connections that were opened and not closed. I would like to be able to write an ASP page that could show me the current amount of open db connections from IIS.
I need to do this from the IIS side not the SQL Server side. I can already see the number of sessions in SQL Server but I am more interested in trying to find asp pages which have opened a connection to some db and not cleaned up properly afterwards.
Is there a way that i can force a drop of all connections to a database. My problem is Access keeps locking my database, i have multiple users using this database, at different periods of the day, and i need a way to clear all connections, i.e at set points throughout the day or at request.
I do close the connection and set all record sets to nothing not sure what else i am missing?
What is the maximum number of connections that will work when using ASP pages with a MS Access database. I've seen some information that leads me to believe that up to 20 simultaneous users is a practical limit?
What I have is two db servers that mirror eachother. What i want to do is if the first server timesout then try to connect to the second server. It there a way to set a timeout and have these switch accordingly?
I have a site which has extensive database activity. What I do is for each procedure I open a connection to the database and close it as and when I leave the procedure. However, in long run I find that some connection to the database is not properly closed causing the site to hang. This has become a big headache for me.
Trying to find what is going wrong I logged opening /closing of connections to the database and found that at some points the connections are not closed resulting in large no. of active connections to the database.
But if I go through the script I cannot really understand why that connection was not closed since the script ensure that the connection is closed before exiting the procedure.
Is there any way where I can check the database may be during night time and close all existing connections to the database. I repeat all my connections to the database are done at the procedure level.
I was wondering if it was possible to have multiple server connections in one asp application. Like if one connection to the main sql server failed, it would connect to the backup sql server.