Thread Pooling In Java Servlet Environment

Aug 17, 1998

Anyone have any experience with running MS SQL Server web applications using Java servlets with connection pooling? Any settings/tricks/traps that we should be aware of?

Our basic problem is that under CERTAIN senarios (which we haven`t been able to strictly identify yet), it appears that each browser client has to wait for the last client to finish - only shared locks are being applied to the database.

View 1 Replies


ADVERTISEMENT

Executing An MS SQL Stored Procedure From A Java Servlet

Jul 20, 2005

I'm trying to use a servlet to process a form, then send that data toan SQL server stored procedure. I'm using the WebLogic 8 App. server.I am able to retrieve database information, so I know my applicationserver can talk to the database.I've determined the failure occurs when the the following statement isexecuted: cstmt.execute(); (due to the failure of println statementsplaced afterwards). I get the following error after trying to executethe stored procedure call:[Microsoft][ODBC SQL Server Driver][SQL Server]Could not find storedprocedure 'insertTheForm'The username and password i'm using to connect is a Windows user withadmin rights. It is also associated with the Odbc connection--and ofcourse is a database user..with full rights. I have executablepermissions on the stored procedure set up as well. I did a microsoftrecommended registry fix as well (for a previouserror:http://support.microsoft.com/defaul...;en-us;Q238971).Am I missing something? I posted my servlet code below.Thanks for any help!DineshformHandlingServlet.class-------------------------package showme;/** formHandlingServlet.java** Created on July 6, 2003, 7:01 PM*/import javax.servlet.*;import javax.servlet.http.*;import java.io.*;import java.sql.*;import java.text.DateFormat;/**** @author Administrator*/public class formHandlingServlet extends HttpServlet {private static final String email1 = "email";private static final String password1 = "password1";private static final String password2 = "password2";private static final String displayname = "displayname";Connection dbConn = null;// create a persistent conneciton to the SQL serverpublic void init() throws ServletException{String jdbcDriver = "sun.jdbc.odbc.JdbcOdbcDriver";String dbURL = "jdbc:odbc:Con2";String usernameDbConn = "dinesh";String passwordDbConn = "werty6969";try{Class.forName(jdbcDriver).newInstance();dbConn = DriverManager.getConnection(dbURL, usernameDbConn,passwordDbConn);}catch (ClassNotFoundException e){throw new UnavailableException("jdbc driver not found:" + dbURL);}catch (SQLException e){throw new UnavailableException("error: " + e);}catch (Exception e){throw new UnavailableException("error: " +e);}}public void doPost(HttpServletRequest request, HttpServletResponseresponse) throws ServletException, IOException{response.setContentType("text/plain");PrintWriter out = response.getWriter();//extract parameter information from register.jspString email1 = request.getParameter("email1");String password1 = request.getParameter("password1");String password2 = request.getParameter("password2");String displayname = request.getParameter("displayname");try{//make a callable statement for a stored procedure.//It has four parametersCallableStatement cstmt = dbConn.prepareCall("{call insertTheForm(?, ?, ?, ?)}");//set the values of the stored procedure's input parametersout.println("calling stored procedure . . .");cstmt.setString(1, email1);cstmt.setString(2, password1);cstmt.setString(3, password2);cstmt.setString(4, displayname);//now that the input parameters are set, we can proceed to execute theinsertTheForm stored procedurecstmt.execute();out.println("stored procedure executed");}catch (SQLException e){throw new UnavailableException("error: " + e);}}}

View 3 Replies View Related

Reporting Services :: Connecting SSRS With Java Servlet

Mar 30, 2013

I am developing a J2ee application in which the the Java servlet communicate with the MS reporting services through URL Access. I am using Apache tomcat as application server to run Java servlets. Servlet gets report name, its parameters and forms an URL and send a request to SSRS. The problem is that the RS is not returning any cookie . And I get [HTTP/1.1 400 Bad Request].

Both my Reporting server and the Tomcat server are running in Same machine. Reporting Services and MS SQL Server 2008 R2 are configured for Windows Integrated authentication.To login to the Reporting server i am using my local system Administrator.

View 8 Replies View Related

CLR With Thread Pooling Using Context Connection=true

Mar 15, 2008

Hi

I have a DLL deployed in SQL2005 which uses Thread pool. Since DLL exists in DB we can directly access it using context connection = true.

In my case the following works fine, if i execute the same out side Threadpool

SqlCommand cmd = new SqlCommand("select 1...", connection);
SqlContext.Pipe.ExecuteAndSend(cmd);


When i execute inside threadpool, either by passing opened connection object, or tried to open connection to "context connection = true" i am getting following error.


System.InvalidOperationException: The requested operation requires a Sql Server execution thread. The current thread was started by user code or other non-Sql Server engine code. at Microsoft.SqlServer.Server.SmiContextFactory.GetCurrentContext() at Microsoft.SqlServer.Server.SqlContext.get_CurrentContext() at Microsoft.SqlServer.Server.SqlContext.get_Pipe() at hiqidty4.hiqidty4.Identify_Search(Object identifyin)


Let me know if i am missing any more here


Thanks in advance

View 1 Replies View Related

Codepage 932 Is Not Supported By The Java Environment.

Nov 21, 2006

I have a JDBC type 4 driver, connecting to a Japanese SQL Server 2000. The connection gives this SQL exception:

SQLException: Codepage 932 is not supported by the Java environment.

SQL State: null

SQL Code: 0

This same software has been in use and working just fine for over 2 years with other servers. Does anyone know the solution to this problem?

Thanks!

pds2

View 6 Replies View Related

How To Deploy Updated Database From Development Environment To Live Environment?

Nov 16, 2005

I have finished a change request from our client. I need to update clients' database with the one in developments.Here is the changes i made to database:Added/Changed some tablesAdded/Changed some stored proceduresAdded data to some dictionary tableThe data in clients' current database MUST be kept. So how can I merge the changed information to clients' database?

View 3 Replies View Related

Pooling

Jun 5, 2007

Im using SQL Express and ADO.

The connection string im using is

"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=mydatabase;Data Source=TESTBOXSQLEXPRESS"



The problem i have is there are lots of alerts generated in the security evenlog which are login events almost every second. Our app has many different threads and processes accesing the same database in a Queue fashion. What im concerned by looking at these logs and also looking at the connections opened is that i see all the connections open and close every second and so no connection pooling is happening.

Am i missing something ?







View 8 Replies View Related

The Use Of Pool Or Pooling?

Jul 13, 2006

1) What is the use of pooling actually?
I have an online application using SQL server, where I can check the connection pool from, SQL Server Enterprise Manager->Microsoft SQL Server->SQL Server Group->LOCAL->Management->Current Activity->Process Info.
2) In the connection pool, when I log into my system, a connection is made as I run query using stored procedure thus making the process available in the connection pool. Now when I am done and log out of the system, does the process suppose to stay there or not (the connection closed) and making it disappear from the pool?
I read from some forum that pooling is a good thing as it make accesing data faster.

View 2 Replies View Related

Connection Pooling In ADO

Feb 21, 2007

When i run this

sp_who


I see the connection showing up and in the next second it is gone.


The connectionstring i have is


Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False;pooling=true;Min Pool Size=2;Max Pool Size=50;Connection
Lifetime=120;Initial Catalog=test;Data Source=TESTMACHINESQLEXPRESS;


And then in the log, the log grows almost every second 3 entiries !!
"Login succeeded for user 'TESTMACHINEUser'. Connection: trusted...."
"Login succeeded for user 'TESTMACHINEUser'. Connection: trusted...."
"Login succeeded for user 'TESTMACHINEUser'. Connection: trusted...."


So the problem is that pooling does not seem to work. I dont see any
connections being held for more than 1 second

View 1 Replies View Related

Lightweight Pooling

Jan 15, 2004

I tried to use xml_prepare_document stored procedure when lightweight pooling is enabled. It does not work.
I tried to use sp_configure 'lightweight pooling', 0 and reconfigure.... It doesnt work.

Is there a way to disable lightweight pooling without restarting mssqlserver?

Thanks

Jordi

View 1 Replies View Related

Connection Pooling

Sep 28, 2007

I am looking for some guidelines for SQL Server connection pooling.
I would like to know the number of recomended connections for a SQL server based upon number of CPU's and or memory and I want to monitor or check the connection pooling? I would also like to know any guidelines around SQL server connection pooling.

View 2 Replies View Related

Connection Pooling

Dec 22, 2005

Hi,I'm using ASP 3.0 and ADO with a web based MS SQLServer 2000 database.Webpage forms collect criteria for SQL queries (dynamic SQL?). These are mostlySelect queries to return inventory lists. Inventory details are posted bymeans of Insert Update and Delete queries. All connections use the sameconnection string. A new connection is opened each time the data is accessedand closed and set to null/nothing afterwards. If site traffic becomes highwill connection pooling be handled automaticaly (by MTS)?Many thanksRay Allison

View 1 Replies View Related

Connection Pooling.

May 14, 2007

I have created an instance of sqlconnection and using transaction i am executing 5 insert statements (Database - SQL Server 2005). I have the finally block where i call the dispose method of the transaction and close method of the connection object.I often get the below mentioned error:



Exception Type: System.InvalidOperationException

Message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

TargetSite: System.Data.ProviderBase.DbConnectionInternal GetConnection(System.Data.Common.DbConnection)

Source: System.Data

How do i resolve the above issue?

View 8 Replies View Related

Connection Pooling

Feb 25, 2008

Hi
I have a Community Server Forum in my site with a 2500 hit per day and I confused with Connection Pooling.
Is it necessary for my site to use Connection Pooling? If it€™s necessary, what is the best value for following items in order to maximize performance?

Pooling
Connection Reset
Enlist
Max Pool Size
Min Pool Size
Connection Lifetime
Thank you very much.

View 1 Replies View Related

Question About Connection Pooling

Jul 23, 2006

If I have two ASP.NET applications installed on the same machine, and both are using the same connection string  to access SQL Server 2005. Are they share the same pool or use separated pools?
I need to be sure that how many connections would be connected to my database server. For example, the max. connection pool size is 100, if both Web app share the same pool, then there're may be maximum 100 connections to database. It they use separated pools, then connections may grow to 200.

View 4 Replies View Related

Connection Pooling Issues!

Dec 1, 2006

I've got a function that returns a connection to a DataReader:static public SqlDataReader GetDR(string sql, string connString)
{
SqlConnection myConn = new SqlConnection(connString);
SqlCommand cmd = new SqlCommand(sql, myConn);
SqlDataReader dr;

myConn.Open();
dr = cmd.ExecuteReader();

return dr;
}I call it like so:SqlDataReader dr = PAS.GetSqlDataReader.GetDR(sql, connString);And I'm always careful to close the connection when I'm done using it via dr.Close(). Except I just started noticing that when I run my app andstart doing a fair amount of work around it - I very quickly get a timeout that I've run out of connections. D'oh! I've triple checked my code andverified that I always remember to close my connections. It's there - every single time!So I'm obviously missing something. Should I not be using a function like GetDR since it doesn't close the connection within the function? 

View 4 Replies View Related

SQL Server Connection Pooling

Jan 16, 2007

Hello, I have a question about Connection Pooling. I use the following Code on three defferent machines with the same result. No machine has any special configuration. OS is Win XP Pro Sql Server 2005. One Server has Windows 2003 Web Edition with Sql Express 2005. 1 for(int i=0; i<500;i++) {
3 SqlConnection con = new SqlConnection("Data Source=127.0.0.1\DB;Initial Catalog=Test;User Id=sa;Password=secret;Connection Lifetime=30;Pooling=true;");
4 SqlCommand cmd = new SqlCommand("SELECT TOP 1 * FROM test", con);
5 con.Open();
6 IDataReader reader = cmd.ExecuteReader();
7 reader.Close();
8 con.Close();
9 con.Dispose();
10 }
11
 When  monitoring  The Counter  logins/sec in Perfmon  logins/sec getsup to 500 per second  when i call this method (everytime!). MSDN says when logins/sec does not stay zero after initial call, pooling does not work. Can you tryy it on your machine an tell me what experience you make? Does Pooling really does not work?  

View 5 Replies View Related

Optimizing Connection Pooling

Feb 16, 2007

Hi, I'm trying to optimize an ASP.NET 2.0 app where, with a load of 100 users, the CPU usage on the web server is a reasonable <20% but the db server (SQL Server 2005) often goes up to 100% and never below 20%. When viewing the Performance Monitor counter SQL Server :General Statistics/User Connections this shows that there are 50-65 connections. When the number of connections go up the db server's CPU usage also goes up along with web page response times.When viewing the Sql server Activity Monitor it, for all connections, always says that the Login Time and the Last Batch are the same. This has got me wondering if no connections are pooled and that all connections always are closed and reopened and that would explain why the db server is so jammed.Could someone give me some pointers as what to check to find optimization points. Regards,Mathias 

View 2 Replies View Related

What Prevents Connection Pooling?

Jun 9, 2007

There's always been a lot of confusion about what prevents connection pooling -- when I was learning .Net 1.0, I was told that any differences in connection strings -- even cosmetic ones -- would prevent pooling (or, more accuratlely, that they could only share connections with identically formatted connections).  For example,
conn string1 =




Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

View 2 Replies View Related

Connection Pooling In Sql Server

Jun 10, 2008

I want to know what is min size ,max size,Connection Timeout and Connection Leak in connection pooling i have searched it on Google i found this below answer but still i have a confusion Please explain me in simple language with example"Setting
an initial size other than zero can reduce the start time of the client
applications because it ensures that a certain number of connections
are always available. That could be an issue at around 09:00 in the
morning when all users start their applications and connect to the
server at the same time.

 Setting the maximum size of the connection pool is
usefull if you suspect that you have blocking problems due to the large
number of concurrent queries. In this case you may be able to reduce
blocking by limiting the maximum size of the connection pool. Of
course, the pool already limits the number of concurrent connections,
so you may never encounter this problem"

View 2 Replies View Related

Connection Pooling Problem

Jan 4, 2005

Can anybody help me to solve this problem

I have a web application. In this app i have one class genral for database transections. I create new object of this class on every page in page load event & dispose it on UnLoad event. After sometime this app gives connection pooling exception.

Means connection are not closed, but i disposed the object like

tmpDatabase.Dispose()
tmpDatabase = Nothing

Plz can anybody tell me the mistake i m doing.

Thanx

View 4 Replies View Related

Connection Pooling Question

Nov 7, 2005

Hi,

I was asking in one Technical Test, the question is not exactly like,
but i want post the outline of that(because i don't remember the exact
one)

Suppose u have connection with Sql Server database, and let say some 30
users are already connected (through some aspx page), if one more new
request is coming, is it created new path or it will reallocate or
destroy existing connection poll and assign??

Can anybody tell me?

if possible please post some of Basic and Adavanced questions regarding Sql Server (with aspx)

Thanks
Jen

View 2 Replies View Related

Cannot Get Connection Pooling To Work

Jun 27, 2001

Hi everyone

I am using VB5 SP3 and ADO 2.5 to connect to SQL Server 7 SP2 and I'm trying to test connection pooling.

I open three ADO Connection objects as follows:

Set con = New Connection
con.Open "Provider=SQLOLEDB;Data Source=(local);Initial Catalog=pubs;User ID=sa;Password=;OLE DB Services=-1"

The second and third connections open virtually instantly, which seems to indicate that pooling is working, however, when I list processes in SQL Server it shows one process for each separate ADO connection. I thought the whole point of pooling was to make all these ADO connections map to the one physical connection and therefore one process. What is going on?

Just to make sure, I also tried it with RDO 2.0 and ODBC connection pooling and I get exactly the same results.

I'm very worried about this because it could result in our using up twenty or so SQL Server connection licences per workstation instead of one.

View 2 Replies View Related

Pooling Connection Object

Jul 20, 2005

Hello:How does one pool a connection object? I have the same application runningon 4 different machines, all connecting to the same server/SQL Server 2000instance for DB activity.Some posts have mentioned pooling the connection objects to reduce overhead,but how do I do that for the 4 separate computers.Appreciate any response.Regards,Ryan Kennedy

View 1 Replies View Related

How To Configure Connection Pooling

Jul 20, 2005

Hi,Is there a way to control the connection pools using SQL Server 2000? Iknow how to alter the connection string to dothis(http://msdn.microsoft.com/library/d...ry/en-us/cpguide/html/cpconconnectionpoolingforsqlservernetdataprovider. asp), but I amlooking for a setting in SQL Server that allows me ultimate control over allconnections to the DB. eg: I'd like all connection pools to timeout after5min of inactivity, set the maximum pool size, etc. I am assuming that thereis some part of the GUI that allows this, or maybe even some (ugh) registryediting! ;-)Thanks,Lance

View 1 Replies View Related

Connection Pooling Basics.

Feb 15, 2008



We have an large SQL database being accessed by a C# application. Each hit on the database opens a connection then closes it when done. We are currently experiencing errors when more than 20 users access the database at one time. One of the things I am wondering is if we are using connection pooling. From BOL I am lead to believe connection pooling is off by default. Can I turn on connection pooling as a default in SQL Server or do I pass 'pooling=true' as a parameter on each connection string?

Thanks.

View 5 Replies View Related

IIS Using Odbc Connection Pooling

Apr 2, 2008

Hello,

I use IIS 6.0 with php and the authentication method is the €śintegration windows authentication€?

I have a problem i d€™ like to use odbc connections pooling to access my database, however the authenticated user must be member of the administrator group to use this feature.

Best regards

sltex

View 3 Replies View Related

ODBC Connection Pooling With IIS 6

Oct 23, 2007



Hello,

I tried without success to activate ODBC connection pooling for an ASP (classic) application running on Windows Server 2003. I used the ODBC administration applet and created the registry value described in "INFO: How to Enable Connection Pooling in an ODBC Application".

What are the steps to correctly activate ODBC connection pooling with IIS 6?

Thank you for your answers,
Radu

View 2 Replies View Related

SQL Server ADO Connection Pooling

Apr 10, 2007



Hi



I would like to find out, what is the actual formula to set the right amount of connection pool size in a conn string. In my scenario, when 400 concurrent users are logged into the website, SQL Server starts timing out. I am thinking the following connection string should fix it, but I would appreciate if I can get some tips to optimize connection pooling. I really need to find out the criteria or the formula to set connection pool size in a connection string. I got the following conn string over the web, by just searching for optimized connection pools, but I am not sure if this will work. Also please explain max and min, and how what criteria do i use to set that size, I mean what does in the following example min pool size of 5 and max pool size of 60 means. Thanks.



conn.ConnectionString = "integrated security=SSPI;SERVER=YOUR_SERVER;DATABASE=YOUR_DB_NAME;Min Pool Size=5;Max Pool Size=60;Connect Timeout=2;"; // Notice Connection Timeout set to only two seconds!

View 3 Replies View Related

SQL Server Connection Pooling

Apr 10, 2007

Hi



I would like to find out, what is the actual formula to set the right amount of connection pool size in a conn string. In my scenario, when 400 concurrent users are logged into the website, SQL Server starts timing out. I am thinking the following connection string should fix it, but I would appreciate if I can get some tips to optimize connection pooling. I really need to find out the criteria or the formula to set connection pool size in a connection string. I got the following conn string over the web, by just searching for optimized connection pools, but I am not sure if this will work. Also please explain max and min, and how what criteria do i use to set that size, I mean what does in the following example min pool size of 5 and max pool size of 60 means. Thanks.



conn.ConnectionString = "integrated security=SSPI;SERVER=YOUR_SERVER;DATABASE=YOUR_DB_NAME;Min Pool Size=5;Max Pool Size=60;Connect Timeout=2;"; // Notice Connection Timeout set to only two seconds!

View 1 Replies View Related

Got Time Out Expired Error After Pooling

Mar 4, 2008

The database connection was ok without specify any pooling parameter, however, after I decide to put pooling parameter to the connection string. I frequently expierence "Time out expired" exception.Here is the connection string: "Pooling = True; Min Pool Size = 5; Max Pool Size = 100;Server = servername; AttachDbFilename = database_file; Integrated Security = True;"As you see, it is not much different from default value. I was thinking may be I should give a "Time out" value to the connection, will this help? 

View 1 Replies View Related

Connection Pooling Not Working With SqlDataSource

Jun 14, 2008

My total test page is shown below.  I monitor the connections by SP_WHO2.  Without the second call, connection pooling seems to be working, ie I refresh my browser repeately but the number of connections as seen from SP_WHO2 does not increase.
However, if I have the second call, every time I refresh the page at the browser, the number of connections increases by one.  This is obviously not acceptable in a real world application.
I tried both Integrated Authentication (with no impersonation) and using a hardcoded service account.  Both have the exact same results.  In fact this test is not about multi-user yet, it is the same single user just refreshing the same page.
May I know what have I done wrong?  All the documentation from Microsoft says close the connection after using it.  In the case of SqlDataSource how do I close the connection?
Thanks 
 <%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
SqlDataSource1.SelectCommand = "Select ID from Master";
System.Data.SqlClient.SqlDataReader reader =
(System.Data.SqlClient.SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
if (reader.HasRows && reader.Read())
Label1.Text = reader["ID"].ToString();
SqlDataSource1.Dispose();

//second call: read from another table
SqlDataSource1.SelectCommand = "Select Name from Students";
reader = (System.Data.SqlClient.SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
if (reader.HasRows && reader.Read())
Label1.Text += reader["Name"].ToString();

reader.Close();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:myConnectionString %>"
DataSourceMode="DataReader"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
 

View 2 Replies View Related

Load Balancer And Connection Pooling

Mar 30, 2007

Guys,

We have 2 main database servers, with our clients accessing either one DB or another via a website click. Our application, in the background, chooses randomly, which server to connect to. This approach achieves simulated load balancing.

For efficiency purposes, we also have the application manage connection pooling.

Recently, we realized that our current "simulated load balancing" is not good enough, as it blindly chooses which server to connect to, without considering the current workload of that server. We are now considering to acquire a load balancer [i.e. hardware piece] so that the load is balanced more wisely, by it. Our only concern is connection pooling. Will connection pooling still work with the new, proposed topology [i.e. applications sit to the left of the load balancer and the db servers to the right of it, with the load balancer in the middle].

If anyone has had any experience with this and could share or give advice, it would be appreciated.


Thanks a lot!

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved