Capturing database connection parameter
Hi,
I want to capture the database connection parameters in Java collaboration defination running on eGate5.1.
In eGate4.5, I can do it by calling this method: this.jCollabController.getEWayConnectionConfigAsProperties(String s), but I'm not sure how to do it in eGate5.1 since their framework are quite different.
Appreciate for the help. Thank you.
Regards,
Alex
How about using XA Transaction timeout parameter?
Similar Messages
-
Dynamic Parameter Prompting for Database Connection Password
Post Author: rsharp
CA Forum: Publishing
Hi
I've been finding recently that reports using dynamic parameters and published into Crystal Server prompt for the database connection password when the dynamic parameter is accessed. Thing is, this only started happening recently for new and already existing reports with dynamic parameters and I don't know why. In Crystal Reports the dynamic parameter can be accessed without a database connection prompt being displayed but not after publishing. (Maybe there's a problem with the Publishing Wizard?) Static parameters work just fine just as they always have, but I'm a bit mystified by the fact that dynamic parameters used to work (without prompting) but now they don't. Any advice or opinion would be much appreciated.Post Author: amr_foci
CA Forum: Publishing
from the CMC you have to set the default connection or wat connection should this report use,
go to this report in CMC, click process tab, and check the connection -
KIMYONG : Applications Database Connection Pool 관련 parameter 설명
Purpose
JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다.
The Applications Database Connection Pool is a pool of JDBC database connections that are shared among java applications. Applications obtain connections from the pool by using the getJDBCConnection(...) methods of AppsContext.
Essentially, each AppsContext has a single database connection associated with it at all times.
The AOL/J layer internally borrows and returns this connection to the pool as needed to maintain connection reference that is properly initialized for the current Java tier AOL security context and NLS state.
FND_MAX_JDBC_CONNECTIONS
============================
The maximum pool size is the maximum allowed sum of the number of available connections and thenumber of locked connections. If the pool reaches the maximum size and all connections are locked, new clients will not be able to borrow a connection until one of the current clients has returned one. The default setting for this parameter is essentially unlimited (about 2 billion).
FND_JDBC_BUFFER_MIN
======================
The buffer minimum is the minimum number of connections that the pool should try to maintain in the available list. When the buffer size falls below the buffer minimum, the pool maintenance thread will be notified to create new connections. When notified, the thread will immediately attempt to create the number of connections to fill the difference. New connections will not be created if the pool is already at its maximum size. When creating new connections the thread uses the attributes of the most recent client request that resulted in a new connection being created.
Setting this parameter to "0" will disable maintenance of the buffer minimum.
However, the buffer maximum will still be maintained.
Setting this parameter to a number greater than the maximum pool size(FND_MAX_JDBC_CONNECTIONS) will disable all buffer maintenance.
FND_JDBC_BUFFER_MAX
======================
The buffer maximum is the maximum number of connections that the pool should try to maintain in the available list. During heavy usage, the buffer may exceed this maximum. However, during periods of low usage, the maintenance thread will decrease the buffer size until the buffer maximum is reached.
If the value of this parameter is an integer, (for example "20") the buffer maximum is static. If the value is a percent (for example, "20%"), the buffer maximum is not constant but instead is calculated dynamically as a percent of total pool size. The buffer minimum is also taken into account when
determining a dynamic buffer maximum.
The exact expression used is:
maximum(t) = buffer minimum + ( (FND_JDBC_BUFFER_MAX/100) * size(t) )
where maximum(t) and size(t) are the buffer maximum and pool size at some time t.
The thread is configured to periodically check the buffer size. If the buffer size is greater than the maximum, the thread will remove either the number of available connections specified by FND_JDBC_BUFFER_DECAY_SIZE or the number of connections in excess of the buffer minimum, whichever is smaller. When connections are removed from the available list, the least recently used ones are removed first.
Setting this parameter to100%, or to a number equal to FND_MAXIMUM_JDBC_CONNECTIONS, or to a number less than or equal to FND_JDBC_BUFFER_MIN will effectively prevent the maintenance thread from ever removing any connections.
FND_JDBC_BUFFER_DECAY_INTERVAL
===================================
The buffer decay interval specifies how often the connection pool maintenance thread should check the buffer size. The thread will check the buffer size at most once every FND_JDBC_BUFFER_DECAY_INTERVAL seconds. The actual time between consecutive thread cycles will vary somewhat depending on the JVM load.
This parameter, along with FND_JDBC_BUFFER_DECAY_SIZE, allows the buffer decay rate to be tuned. For example, if the buffer decay size is 2 and the buffer decay interval is one minute, the buffer decay rate will never exceed two connections per minute. When connections are removed, the least recently used ones are removed first.
FND_JDBC_BUFFER_DECAY_SIZE
=============================
The buffer decay size specifies the maximum number of connections that should be removed during any single thread cycle during which the number of available connections is greater than the buffer size. This parameter, along with FND_JDBC_BUFFER_DECAY_INTERVAL, allows the buffer decay rate to be tuned.
FND_JDBC_MAX_WAIT_TIME
=========================
The maximum wait time specifies how much time a client should spend trying to get a connection. The borrow algorithm, used to borrow an object from the pool, contains check points at which the elapsed time is compared to the maximum wait time. If it exceeds the maximum wait time, then a null object will be returned to the client. The pre-configured value for the maximum wait time is
10 seconds.
FND_JDBC_SELECTION_POLICY
============================
The selection policy determines how a connection is selected from the list of available connections for a particular client. The connection pool is pre-configured to use a cost-based selection algorithm, which selects the connection that will require the smallest amount of initialization to match the
client's context.
FND_JDBC_USABLE_CHECK
===========================
The FND_JDBC_USABLE_CHECK parameter governs whether a pl/sql query is performed before giving a connection to a client. The pool checks whether a connection is usable before handing it to a client. This always involves checking that the connection is not null and is not closed. If FND_JDBC_USABLE_CHECK is set to true, then it also verifies that the connection can be used to perform a simple PL/SQL query. (This parameter may have to be set to "true" in order to clean up
connections to a database that has been restarted.)
FND_JDBC_CONTEXT_CHECK
==========================
The FND_JDBC_CONTEXT_CHECK parameter governs whether the AOL security context and NLS state is obtained from the database when the connection is returned to the pool. If FND_JDBC_CONTEXT_CHECK is "true", when the connection is returned to the pool, the AOL security context and NLS state will be obtained from the database. (This is implemented in the DBConnObj.isReusable() method). This check must be done when the connection is returned (rather than when it is borrowed) so that the selection matching algorithm has access to the actual
session context of the connections in the available list.
FND_JDBC_PLSQL_RESET
========================
The PL/SQL reset flag, set using the variable FND_JDBC_PLSQL_RESET, governs whether the PL/SQL state associated with a connection should be freed before the pool hands the connection to the client. By default this flag is false.
If the flag is set by true, by including the line "FND_JDBC_PLSQL_RESET=true" in the .dbc file, each connection to the database will have its PL/SQL state cleared before the pool returns the connection to the client.
This is how it works. After the pool selects a connection from the available list for a client, it initializes the connection. One of the things initialization does is to set a flag that is later used by SessionManager to determine if the apps initialization routine needs to be performed for the connection. When FND_JDBC_PLSQL_RESET has been set to "true", this flag will always be set to true. After the pool initializes the connection, it also checks whether the connection is usable. In this case, this check will include a call to DBMS_SESSION.RESET_PACKAGE, which frees the PL/SQL state. The table below summaries the affect of FND_JDBC_PLSQL_RESET and the other safety check parameters on borrowing a connection from the pool.
The FND_JDBC_PLSQL_RESET parameter has been added to only to address the case where production PL/SQL global bugs are known to exist. The performance of the pool is reduced by setting this flag to true.
Reference : Note 264599.1Purpose
JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다.
The Applications Database Connection Pool is a pool of JDBC database connections that are shared among java applications. Applications obtain connections from the pool by using the getJDBCConnection(...) methods of AppsContext.
Essentially, each AppsContext has a single database connection associated with it at all times.
The AOL/J layer internally borrows and returns this connection to the pool as needed to maintain connection reference that is properly initialized for the current Java tier AOL security context and NLS state.
FND_MAX_JDBC_CONNECTIONS
============================
The maximum pool size is the maximum allowed sum of the number of available connections and thenumber of locked connections. If the pool reaches the maximum size and all connections are locked, new clients will not be able to borrow a connection until one of the current clients has returned one. The default setting for this parameter is essentially unlimited (about 2 billion).
FND_JDBC_BUFFER_MIN
======================
The buffer minimum is the minimum number of connections that the pool should try to maintain in the available list. When the buffer size falls below the buffer minimum, the pool maintenance thread will be notified to create new connections. When notified, the thread will immediately attempt to create the number of connections to fill the difference. New connections will not be created if the pool is already at its maximum size. When creating new connections the thread uses the attributes of the most recent client request that resulted in a new connection being created.
Setting this parameter to "0" will disable maintenance of the buffer minimum.
However, the buffer maximum will still be maintained.
Setting this parameter to a number greater than the maximum pool size(FND_MAX_JDBC_CONNECTIONS) will disable all buffer maintenance.
FND_JDBC_BUFFER_MAX
======================
The buffer maximum is the maximum number of connections that the pool should try to maintain in the available list. During heavy usage, the buffer may exceed this maximum. However, during periods of low usage, the maintenance thread will decrease the buffer size until the buffer maximum is reached.
If the value of this parameter is an integer, (for example "20") the buffer maximum is static. If the value is a percent (for example, "20%"), the buffer maximum is not constant but instead is calculated dynamically as a percent of total pool size. The buffer minimum is also taken into account when
determining a dynamic buffer maximum.
The exact expression used is:
maximum(t) = buffer minimum + ( (FND_JDBC_BUFFER_MAX/100) * size(t) )
where maximum(t) and size(t) are the buffer maximum and pool size at some time t.
The thread is configured to periodically check the buffer size. If the buffer size is greater than the maximum, the thread will remove either the number of available connections specified by FND_JDBC_BUFFER_DECAY_SIZE or the number of connections in excess of the buffer minimum, whichever is smaller. When connections are removed from the available list, the least recently used ones are removed first.
Setting this parameter to100%, or to a number equal to FND_MAXIMUM_JDBC_CONNECTIONS, or to a number less than or equal to FND_JDBC_BUFFER_MIN will effectively prevent the maintenance thread from ever removing any connections.
FND_JDBC_BUFFER_DECAY_INTERVAL
===================================
The buffer decay interval specifies how often the connection pool maintenance thread should check the buffer size. The thread will check the buffer size at most once every FND_JDBC_BUFFER_DECAY_INTERVAL seconds. The actual time between consecutive thread cycles will vary somewhat depending on the JVM load.
This parameter, along with FND_JDBC_BUFFER_DECAY_SIZE, allows the buffer decay rate to be tuned. For example, if the buffer decay size is 2 and the buffer decay interval is one minute, the buffer decay rate will never exceed two connections per minute. When connections are removed, the least recently used ones are removed first.
FND_JDBC_BUFFER_DECAY_SIZE
=============================
The buffer decay size specifies the maximum number of connections that should be removed during any single thread cycle during which the number of available connections is greater than the buffer size. This parameter, along with FND_JDBC_BUFFER_DECAY_INTERVAL, allows the buffer decay rate to be tuned.
FND_JDBC_MAX_WAIT_TIME
=========================
The maximum wait time specifies how much time a client should spend trying to get a connection. The borrow algorithm, used to borrow an object from the pool, contains check points at which the elapsed time is compared to the maximum wait time. If it exceeds the maximum wait time, then a null object will be returned to the client. The pre-configured value for the maximum wait time is
10 seconds.
FND_JDBC_SELECTION_POLICY
============================
The selection policy determines how a connection is selected from the list of available connections for a particular client. The connection pool is pre-configured to use a cost-based selection algorithm, which selects the connection that will require the smallest amount of initialization to match the
client's context.
FND_JDBC_USABLE_CHECK
===========================
The FND_JDBC_USABLE_CHECK parameter governs whether a pl/sql query is performed before giving a connection to a client. The pool checks whether a connection is usable before handing it to a client. This always involves checking that the connection is not null and is not closed. If FND_JDBC_USABLE_CHECK is set to true, then it also verifies that the connection can be used to perform a simple PL/SQL query. (This parameter may have to be set to "true" in order to clean up
connections to a database that has been restarted.)
FND_JDBC_CONTEXT_CHECK
==========================
The FND_JDBC_CONTEXT_CHECK parameter governs whether the AOL security context and NLS state is obtained from the database when the connection is returned to the pool. If FND_JDBC_CONTEXT_CHECK is "true", when the connection is returned to the pool, the AOL security context and NLS state will be obtained from the database. (This is implemented in the DBConnObj.isReusable() method). This check must be done when the connection is returned (rather than when it is borrowed) so that the selection matching algorithm has access to the actual
session context of the connections in the available list.
FND_JDBC_PLSQL_RESET
========================
The PL/SQL reset flag, set using the variable FND_JDBC_PLSQL_RESET, governs whether the PL/SQL state associated with a connection should be freed before the pool hands the connection to the client. By default this flag is false.
If the flag is set by true, by including the line "FND_JDBC_PLSQL_RESET=true" in the .dbc file, each connection to the database will have its PL/SQL state cleared before the pool returns the connection to the client.
This is how it works. After the pool selects a connection from the available list for a client, it initializes the connection. One of the things initialization does is to set a flag that is later used by SessionManager to determine if the apps initialization routine needs to be performed for the connection. When FND_JDBC_PLSQL_RESET has been set to "true", this flag will always be set to true. After the pool initializes the connection, it also checks whether the connection is usable. In this case, this check will include a call to DBMS_SESSION.RESET_PACKAGE, which frees the PL/SQL state. The table below summaries the affect of FND_JDBC_PLSQL_RESET and the other safety check parameters on borrowing a connection from the pool.
The FND_JDBC_PLSQL_RESET parameter has been added to only to address the case where production PL/SQL global bugs are known to exist. The performance of the pool is reduced by setting this flag to true.
Reference : Note 264599.1 -
Parameter insert database connectivity
I'm currently having a little trouble getting this to work. Below is a picture of my block diagram, it includes pretty much everything there is to know about my error. As you can see it says it has a syntax error. I'm fairly new to labVIEW but I do quite a bit of database programming. The insert statments looks correct. I would assume the error lies within the values passed into the parameters. I've tried it both with and without single quotes around the values. I would also like to note that the 2 int32 convertsion were thrown in after the error was already there. Was just running out of ideas to try. Incase you can't recognize the VI. We have an open database vi -> parameterized query -> 2 set parameters -> exec query-> free object-> free conn-> close conn. This is the exact same layout for the database connections as is in the database connectivity manual. I've already tested the connection to the database inserting a single value and that worked. For some reason now that I'm spliting the values coming out of the DAQ assistant and made it a parameterized query, it is no longer working. Any help would be great. Thanks.
[As far as the special characters in the insert
string I wouldn't believe there would be any unless they some how get
added automatically. If they are is that a common issue? ]
I was just making sure human error didn't creep in when the INSERT string was created. It's bit me more than once.
Have you tried hard coding some Voltage and Current values into the Set Parameter Value VI's? You might also try setting the "auto-detect parameters" in the Create Parameterized Query VI to TRUE and disconnecting the Parameters array constant. Also, check the string "Current" in the Parameter constant array (index 1), make sure there's no space at the end of the name.
“A child of five could understand this. Send someone to fetch a child of five.”
― Groucho Marx -
I am using the database connectivity (ADO based) tool and I want to be able to insert a null values.
I have included a simple VI that demonstrates how this works with SQL toolkit .
Null values are very useful and occur frequently in dealing with data. I wish that LabVIEW handled them much better - (e.g. there is not datatype in LabVIEW corresponding to a Null value).The VI was not attached but I'm going to answer with what I have here.
- Currently, the Database Toolset converts NULLs to the default value for LabVIEW data types (ie, False for Boolean, empty strings, zero for numbers, empty arrays, etc). In the user manual there is an example that shows database records containing NULL values being first converted to a string, empty strings (the NULLs) are then converted to NaNs instead of the usual zero value. This method requires you to know what data types each field contains and that they know what to look for and how to convert the data.
You can go to this following link to suggest that a null datatype be implemented:
https://sine.ni.com/apps/we/nicc.call_me?p_country=&p_lang_id=US&p_form_id=58
-Also you cannot leave par
ameters values empty because there is a big difference between executing an SQL statement and doing a Parameterized Query, especially when looking at the low-level ADO layer.When doing Parameterized Queries, you MUST specify all parameter values - leaving them empty results in ADO trapping errors rather than using a default value.
Regards,
Cyril Bouton
Applications Engineer
National Instruments
Cyril Bouton
Active LabVIEW Developper -
Problem in getting the database connection from a connection pool
Hai All,
I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
I am using the Oracle database 8.1.7.
I have configured my connection pool, datasource and JNDI in weblogic.
In my java program i have the following code to retrieve the connection.
import java.sql.*;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
class jdbcshp1 {
public static void main(String[] args) {
Connection connection = null;
try {
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory"); // Wanna get rid of this.
ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
// Get a context for the JNDI look up
Context ctx = new InitialContext(ht);
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
//Create a connection object
connection = ds.getConnection();
The above code is working fine but, the two ht.put statements are creating problem.
The problem is, after converting the application into WAR file it can be deployed
on any machine or different port on same machine. My application fails if its deployed on
weglogicserver which is at different port.
Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
any help is appreciated.
Thanks in advance
Pooja.Hai All,
Firstly, thanks for ur reply.
Even i have seen some code which uses context constructor with out any parameter and works fine.
i dont understand why its not working for my code.
When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
Context ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
connection = ds.getConnection();The error is as follows:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
I appreciate all ur valuable help.
Thanks once again.
Pooja. -
Crystal Report Viewer Not Releasing Oracle Database Connections
I have a very simple vb.net 3.5 web application that uses the Crystal Report viewer 2008 to open a report. My requirements are as follows:
1. Reports are built by another company and provided to us and used in a web environment
2. All reports contain parameter fields
3. The web application must be generic enough that a report can be added to a list and the user simply selects the report and provides database login information. The Crystal report viewer with handle the request for parameter values and prompt the user for their values.
4. All reports connect to an Oracle 10g server.
The above requirements have been meet and we have an extremely simple web application that runs the reports. It is working very well other than the crystal report viewer is not releasing the database connections. This is bad because the credentials are on a per user basis and that same user must login to a different oracle application simultaneously. They are being denied access because the credentials are already in use. We do not have control nor influence over the policies in use on the Oracle server. Ideally we would like to control the Crystal Report viewer so that it closes connections after use.
The web application code is:
Private Sub viewReports_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
If Not IsPostBack Then
ConfigureCrystalReport()
End If
End Sub
Private Sub ConfigureCrystalReport()
'Load the Crystal Report viewer with a report.
Try
Dim reportPath As String = Server.MapPath(Session("reportname"))
crViewer.ReportSource = reportPath
Catch ex As Exception
Response.Write(Server.MapPath(Session("reportname")) & "
" & ex.Message.ToString & "
" & ex.StackTrace.ToString)
End Try
End Sub
Can anyone shed some light on this topic? Thank youHello, Timothy;
By default, having the report in session will hold it open for 20 minutes.
If you create the report as a ReportDocument object you can take it out of session and release it more efficiently. That will release the connection.
Private Sub ConfigureCrystalReports()
If (Session("hierarchicalGroupingReport") Is Nothing) Then
hierarchicalGroupingReport = New ReportDocument()
hierarchicalGroupingReport.Load(Server.MapPath("Hierarchical Grouping.rpt"))
Session("hierarchicalGroupingReport") = hierarchicalGroupingReport
Else
hierarchicalGroupingReport = CType(Session("hierarchicalGroupingReport"), ReportDocument)
End If
myCrystalReportViewer.ReportSource = hierarchicalGroupingReport
End Sub
In the Form Unload of the Viewer:
'Take the report out of session
Session("hierarchicalGroupingReport") = Nothing
Session.Contents.Remove("hierarchicalGroupingReport")
'Clean up the ReportDocument object
hierarchicalGroupingReport.Close
hierarchicalGroupingReport.Dispose()
hierarchicalGroupingReport = Nothing
GC.Collect()
Elaine -
Database connection pooling with weblogic 8.1.
Hai All,
I am new to weblogic database connection pooling.
I am using Weblogic8.1 and want to use connection pooling to get a jdbc connection. my database server is Oracle 8.1.7.
Things which i have done using the weblogic admin console.
I have created a Jdbc connection pool named myconnectionpool.
I have created a datasource named mydatasource.
and named the JNDI as myjndi.
Is the above process correct to create the connection pool in the weblogic8.1.
I am not aware of the java code to get the database connection object from the connection pool which i have created.
can any one please let me know the java code to get the connection from the pool.
Any help is appreciated
Thanks in advance
pooja.Hai
I have tried using the code u have mentioned but it returned me
an error which is below.
C:\javaexamples\Javaprograms\JDBC>java jdbcexampleconnectionpool
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
I have added the following lines code, which i read in some weblogic documentation. The code i added is below and it worked fine.
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
Context ctx = new InitialContext(ht);I am not sure what the above code does.
Can anyone let me know what does the above code do.
Thanks a lot and i appreciate ur help,
Pooja. -
Database connection Pooling in TOMCAT
I am trying Database connection Pooling in TOMCAT
I am getting the following error
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
My Web.xml in $CATALINA_HOME\conf\web.xml
<resource-ref>
<res-ref-name>WMSPREF</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and my server.xml in
$CATALINA_HOME\conf\server.xml
<ResourceParams name="WMSPREF">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@10.94.100.148:1521:WMSPREF</value>
</parameter>
<parameter>
<name>username</name>
<value>wmsmigrate</value>
</parameter>
<parameter>
<name>password</name>
<value>abnwms</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
And my database.jsp : code
Context ctx = new InitialContext();
Context envContext = (Context)ctx.lookup("java:comp/env");
DataSource ds = (DataSource)envContext.lookup("WMSPREF");
conn = ds.getConnection();What version of Tomcat do you have? 4? 5? 5.5?
Have you defined a Resource entry in server.xml as well as the ResourceParams?
I have never had any luck configuring a datasource in the server.xml file.
What HAS worked for me is putting the config into a myWebApp.xml file.
My web context is "myWebApp"
The name of the file is "myWebApp.xml"
For Tomcat4 for this goes in the webapps directory
For Tomcat5 this goes in the [TOMCAT_HOME]/conf/Catalina/localhost directory
<?xml version='1.0' encoding='utf-8'?>
<Context path="/myWebApp" docBase="myWebApp" debug="1" reloadable="true" crossContext="true" >
<Resource name="WMSPREF" auth="Container"
type="javax.sql.DataSource">
</Resource>
<ResourceParams name="WMSPREF">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@10.94.100.148:1521:WMSPREF</value>
</parameter>
<parameter>
<name>username</name>
<value>wmsmigrate</value>
</parameter>
<parameter>
<name>password</name>
<value>abnwms</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>Cheers,
evnafets -
Could not load library for database connection LCA
Hi,
I am facing RFC connection prblem while connectiong to database. I have installed SCM5.1 and live cache in single server
Please find the logs.
Work process log:
B Mon Jul 20 11:19:13 2009
B create_con (con_name=LCA)
B Loading DB library 'E:\usr\sap\SC7\DVEBMGS03\exe\dbsdbslib.dll' ...
M *** ERROR => DlLoadLib: LoadLibrary(E:\usr\sap\SC7\DVEBMGS03\exe\dbsdbslib.dll) Error 126 [dlnt.c 241]
M Error 126 = "The specified module could not be found."
B *** ERROR => Couldn't load library 'E:\usr\sap\SC7\DVEBMGS03\exe\dbsdbslib.dll'
[dbcon.c 4731]
B ***LOG BYG=> could not load library for database connection LCA [dbds#1 @ 1035] [dbds 1035 ]
A
A Mon Jul 20 11:21:58 2009
A GENER starting remote generation: /SAPAPO/OM_SYNC_LC_DB (requested by W1).
B
SM21:
No shared library found for the database with ID LCA|
No shared library found for the database with ID LCA
/SAPAPO/OM17|/SAPAPO/OM_SYNC_LC_DB|K |SAP Web AS Problem|SBAC |
Documentation for system log message BY G :
As well as the standard connection, an attempt was made to set up
another database connection, under the specified ID. The Shared Library
for this second database could not be found.
The Shared Library is usually found in the the Executable
directory (profile parameter DIR_LIBRARY) under the name dbs
<dbs>slib<os_ext>. <dbs> stands for the database type and <os_ext>
stands for the operating system-specific extension of the Shared
Libraries.
The database type is determined from the entry that corresponds to the
specified DB ID in the table DBDCON. Check whether the data in this
entry is correct.
ST22
Runtime Errors DBIF_DSQL2_CONNECTERR
Exception CX_SY_NATIVE_SQL_ERROR
Date and Time 20.07.2009 11:22:21
Short text
Error setting up a secondary database connection
What happened?
Connection to database system not possible with identifier "LCA".
|----
System environment
SAP-Release 700
Application server... "
Network address...... "
Operating system..... "Windows NT"
Release.............. "5.2"
Hardware type........ "8x AMD64 Level"
Character length.... 16 Bits
Pointer length....... 64 Bits
Work process number.. 8
Shortdump setting.... "full"
Database server... "
Database type..... "ORACLE"
Database name..... "SC7"
Database user ID.. "SAPSC7"
Terminal................. " "
Char.set.... "C"
SAP kernel....... 701
created (date)... "Jul 6 2009 23:47:55"
create on........ "NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00"
Database version. "OCI_10201_SHARE (10.2.0.2.0) "
Patch level. 50
Patch text.. " "
Database............. "ORACLE 9.2.0.., ORACLE 10.1.0.., ORACLE 10.2.0.."
SAP database version. 701
Operating system..... "Windows NT 5.0, Windows NT 5.1, Windows NT 5.2, Windows
NT 6.0"
Information on where terminated
Termination occurred in the ABAP program "SAPLSLCAPPS" - in
"LCA_EXISTS_LCA_ROUTINE".
The main program was "/SAPAPO/TS_BATCH_RUN ".
In the source code you have the termination point in line 23
of the (Include) program "LSLCAPPSU05".
The program "SAPLSLCAPPS" was started as a background job.
Job Name....... "MACROS"
Job Initiator.. "SC7GEN"
Job Number..... 10222002
The termination is caused because exception "CX_SY_NATIVE_SQL_ERROR" occurred
in
procedure "LCA_EXISTS_LCA_ROUTINE" "(FUNCTION)", but it was neither handled
locally nor declared
in the RAISING clause of its signature.
The procedure is in program "SAPLSLCAPPS "; its source code begins in line
1 of the (Include program "LSLCAPPSU05 ".
Please help me to resolve the issue.
SurajHi Natalia Khlopina,
I have raised OSS message to SAP.
Below is the information
E:\usr\sap\SC7\SYS\exe\uc\Copy_ of_NTAMD64_15062009>sdbregview -l
Server Utilities e:/sapdb/programs 7.7.02.08 64 bit valid
DB Analyzer e:/sapdb/programs 7.7.02.08 64 bit valid
PCR 7301 e:/sapdb/programs 7.3.01.21 valid
PCR 7500 e:/sapdb/programs 7.5.00.42 64 bit valid
SAP Utilities e:/sapdb/programs 7.7.02.08 64 bit valid
APO LC APPS f:/sapdb/lcs/db/sap 6.00.004 64 bit valid
Redist Python e:/sapdb/programs 7.7.02.08 64 bit valid
Base e:/sapdb/programs 7.7.02.08 64 bit valid
JDBC e:/sapdb/programs 7.6.03.02 valid
Messages e:/sapdb/programs MSG 0.5010 valid
ODBC e:/sapdb/programs 7.7.02.08 64 bit valid
SQLDBC 77 e:/sapdb/programs 7.7.02.08 64 bit valid
Database Kernel f:/sapdb/lcs/db 7.7.02.08 64 bit valid
Loader e:/sapdb/programs 7.7.02.08 64 bit valid
SQLDBC e:/sapdb/programs 7.7.02.08 64 bit valid
SQLDBC 76 e:/sapdb/programs 7.6.01.15 64 bit valid
Fastload API e:/sapdb/programs 7.7.02.08 64 bit valid
C:\Documents and Settings\sc7adm>disp+work
disp+work information
kernel release 701
kernel make variant 701_REL
compiled on NT 5.2 3790 Service Pack 1 x86 MS VC++ 14.00
compiled for 64 BIT
compilation mode UNICODE
compile time Jul 6 2009 23:47:55
update level 0
patch number 50
source id 0.050
supported environment
database (SAP, table SVERS) 700
701
operating system
Windows NT 5.0
Windows NT 5.1
Windows NT 5.2
Windows NT 6.0
Thanks for quick responce.
Suraj -
Problem in using context param for storing database connection information
Hello Friends,
I am new to struts & jsp.I am developing a project in struts.I have 1 jsp page called editProfile.jsp.On submitting this page it will call 1 action class.The action class in turn will call the Plain old java class where I have written the logic for updating User Profile.
I have created context-param in web.xml for database connection information like dbURL , dbUserName , dbPassword , jdbcDriver.Now I want to use these connection information in my Business logic(Plain Old Java Class).As we can use context parameter only in jsp & servlets , I am setting the variables of my business logic class with these context param in jsp itself.
now when I am calling the updateProfile method of Business logic class from Action class it is giving error as all the connection variables which I set in jsp for my business logic class has become null again.
I am not getting.If once I have set those variables how come they are becoming null again???Please help me.Any Help will be highly appreciated.Thanx in advance.This is the code I have written
web.xml file
<context-param>
<param-name>jdbcDriver</param-name>
<param-value>oracle.jdbc.driver.OracleDriver</param-value>
</context-param>
<context-param>
<param-name>dbUrl</param-name>
<param-value>jdbc:oracle:thin:@localhost:1521:gd</param-value>
</context-param>
<context-param>
<param-name>dbUserName</param-name>
<param-value>system</param-value>
</context-param>
<context-param>
<param-name>dbPassword</param-name>
<param-value>password</param-value>
</context-param>
EditProfile.jsp
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@ page import="java.sql.*" %>
<jsp:useBean id="EditProfile" scope="application"
class="com.myapp.struts.EditProfile"/>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Edit My Profile</title>
</head>
<body>
<form action="submitEditProfileForm.do" focus="txt_FirstName" method="post">
<%
EditProfile.setjdbcDriver(application.getInitParameter("jdbcDriver"));
EditProfile.setdbURL(application.getInitParameter("dbURL"));
EditProfile.setdbUserName(application.getInitParameter("dbUserName"));
EditProfile.setdbPassword(application.getInitParameter("dbPassword"));
-----------more code goes here------------
EditActionProfile.java
package com.myapp.struts;
import javax.servlet.jsp.jstl.core.Config;
import org.apache.struts.action.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
public class EditProfileAction extends Action {
public EditProfileAction()
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
try
if (isCancelled(request))
return mapping.findForward("mainpage");
EditProfileForm epf = (EditProfileForm)form;
EditProfile ep = new EditProfile();
String temp = ep.updateProfile(epf.getTxt_FirstName(),epf.getTxt_MiddleName() , epf.getTxt_LastName() , epf.getTxt_Address() , epf.getTxt_Email() );
if(temp.equals("SUCCESS"))
return mapping.findForward("success");
else
return mapping.findForward("failure");
catch(SQLException e)
System.out.println("error" + e.getMessage());
return mapping.findForward("failure");
EditProfile.java class (My Business Logic Class)
package com.myapp.struts;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.*;
public class EditProfile {
private String dbURL;
private String dbUserName , jdbcDriver;
private String dbPassword;
private Connection con;
private Statement stmt;
public EditProfile()
public void setdbURL(String s )
this.dbURL = s;
public void setdbUserName(String s )
this.dbUserName = s;
public void setdbPassword(String s )
this.dbPassword = s;
public void setjdbcDriver(String s )
this.jdbcDriver = s;
public String updateProfile(String firstname , String middlename , String lastname , String address , String email)
throws SQLException, ClassNotFoundException , java.lang.InstantiationException , IllegalAccessException
try
String s1 = new String("update usr set first_name='" + firstname + "' , middle_name='" + middlename + "' , last_name='" + lastname +"' , address='" + address + "' , email_id='" + email + "' where usr_key=1" );
con = this.init();
System.out.println("after init");
stmt = con.createStatement();
int rslt = stmt.executeUpdate(s1);
System.out.println("after excute update");
stmt.close();
if(rslt>=1)
return "SUCCESS";
else
return "Failure";
finally
if (null != con)
con.close();
public Connection init() throws SQLException, ClassNotFoundException
Class.forName(jdbcDriver);
con = DriverManager.getConnection(dbURL, dbUserName, dbPassword);
return con;
public void close(Connection connection) throws SQLException
if (!connection.isClosed())
connection.close();
} -
Changing Database connection at runtime in CR2008
Hi,
I have a VS2008 application which is using CR2008 to generate pdf reports for the user. Problem is I am not able to change the database connection to any server other than the one that was used to create the report template.
My environment has CR2008 SP2. I have tried reports with no paramter as well as the ones with parameters both dont seem to work.
I have already tried a couple of things:
a) report document refresh after loading it
b) setting the database connection as
this._crReport.DataSourceConnections[0].SetConnection(dbServerName, dbName, dbUserId, dbPwd);
c) setting the database connection as
tbls = this._crReport.Database.Tables;
bool test = false;
foreach (Table tbl in tbls)
tblLogonInfo = tbl.LogOnInfo;
tblLogonInfo.ConnectionInfo = connInfo;
tbl.ApplyLogOnInfo(tblLogonInfo);
test = tbl.TestConnectivity(); ** note this alwys return a true for the changed database server
I have read a couple of thread but none has worked for me...Is this a known issue with CR2008?
Thanks
KajalHi Kajal,
I am assuming that you are not changing the schema of the report at any point of time. I would suggest you to try pointing to the other database through designer to make sure that you can hit the database and the schema is correct. You can also create a udl file to check the database connectivity.
Then just for testing purpose you can try the following code:
ReportDocument reportDoc = new ReportDocument();
reportDoc.Load("path of the report");
reportDoc.SetDatbaseLocation("uid","pwd","Servername","tablename");
reportDoc.SetParameterValues("Parameter-Name","values");
CrystalReportViewer.ReportSoure=reportDoc;
Does that help?
Thanks. -
When and How to close database connection in JSP?
Hi there,
I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
Thanks in advance.
Lonely Wolf
<%@ page session="true" language="java" %>
<jsp:include page="checkauthorization.jsp" />
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<%--
Execute query, with wildcard characters added to the
parameter values used in the search criteria
--%>
<sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
SELECT * FROM computer where status=0
order by s_code
</sql:query>
<html>
<head>
<title>Search Result</title>
</head>
<body bgcolor="white">
<center>
<form action="checkin.jsp" method="post">
<input type="submit" value="Back to Check-in Page">
</form>
<c:choose>
<c:when test="${availablecomputerList.rowCount == 0}">
Sorry, no available computer found.
</c:when>
<c:otherwise>
The following available computers were found:
<table border="1">
<th>Computer</th>
<th>Description</th>
<th>Status</th>
<c:forEach items="${availablecomputerList.rows}" var="row">
<tr>
<td><c:out value="${row.s_code}" /></td>
<td><c:out value="${row.description}" /></td>
<td><c:out value="${row.status}" /></td>
</tr>
</c:forEach>
</table>
</c:otherwise>
</c:choose>
</center>
</body>
</html>when should you close the connection? when you're done with it.
how should you close the connection? like this: conn.close();
that said, doing this in a JSP page is bad form and not recommended
JSP's typically don't contain ANY business or data logic -
Sybase Connection Error - cannot establish database connection
BO Data Services Tool -> Creation of new Data Store -> Sybase ASE
When I tried to create a sybase datastore(New connection), I've got this error message. But I am able to connect to sybase database with client application with same connection parameter. I appreciate if someone come across same issue.
ERROR MESSAGE
*WARNING: Cannot establish database connecton.
u2018Sybase connecton error: <Sybase ASE Server message number <1640> State <2> Severity <16> From Server <tstlS03>: Message Text is:
Adaptve Server requires encrypton of the login password on the network.
Sybase ASE Server message number <4002> State <1> Severity <14> From Server <tstlSO3>: Message Text is: Login failed.
Sybase CS Library message number <6717S468> Severity <4>: Message Text is: ct_connectO: protocol specific layer: external error: The attempt to connect to the server failed.>.u2019 lODI- 1111341)I tried to create repositories for sybase, it failed. But it succeeded when created datastore. The procedures's as follow:
1. Create ODBC for this sybase connection, and it should display "Connection successful" when you click "Test connection".
(you need to specify several parameters like user id & password, server,database name and file, etc.)
2. Create datastore by using ODBC connection. -
Immediate HELP in Tomcat 5 to Postgresql 7.4 database connectivity problem
Hi,
I failed to connect Tomcat 5.0.24 with Postgresql
7.4.2. The files created by me and the changes i had
made in the existing files are rates.jsp,
conversionDAO.java, web.xml and server.xml. The error
message on the top of the rest of it was "The value of
useBean class attribute converter.conversionDAO is
invalid". So far I found out that the coding for
database connectivity purpose in conversionDAO.java
cause the error. Another thing is Postgresql jdbc
driver is required to set in the CLASSPATH for the
java file to access the Postgresql database. I don't
know where should I put it in Tomcat for web
application. Anyway, I put it in
$CATALINA_HOME/shared/lib according the book i
refered. I do the database connectivity coding refer
to the Tomcat Kick Start book from Sams Publishing.
Below are the coding involved, please show me the
mistake i had made. Thank you.
----server.xml----
<Context path="/database"
docBase="${catalina.home}/webapps/database" debug="0"
reload="true">
<ResourceParams name="jdbc/conversion">
<parameter>
<name>username</name>
<value>myusername</value>
</parameter>
<parameter>
<name>password</name>
<value>mypassword</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.postgresql.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:postgresql://localhost/conversion</value>
</parameter>
</ResourceParams>
</Context>
----web.xml----
<servlet>
<servlet-name>conversionDAO</servlet-name>
<servlet-class>converters.conversionDAO</servlet-class>
</servlet>
<resource-ref>
<res-ref-name>jdbc/conversion</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
----conversionDAO.java----
public conversionDAO() throws SQLException,
NamingException
Context init = new InitialContext();
Context ctx = (Context)
init.lookup("java:comp/env");
DataSource ds = (DataSource)
ctx.lookup("jdbc/conversion");
con = ds.getConnection();
select = con.prepareStatement(
"SELECT rate FROM Exchange WHERE src= ? AND dst =Immediate HELP in Tomcat 5 to Postgresql 7.4 database connectivity problem (cont.)
Errors log
2004-06-06 01:07:53 StandardContext[servlets-examples]SessionListener: contextDestroyed()
2004-06-06 01:07:53 StandardContext[servlets-examples]ContextListener: contextDestroyed()
2004-06-06 01:07:53 StandardContext[jsp-examples]SessionListener: contextDestroyed()
2004-06-06 01:07:53 StandardContext[jsp-examples]ContextListener: contextDestroyed()
2004-06-06 01:07:59 StandardContext[balancer]org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
2004-06-06 01:08:00 StandardContext[jsp-examples]ContextListener: contextInitialized()
2004-06-06 01:08:00 StandardContext[jsp-examples]SessionListener: contextInitialized()
2004-06-06 01:08:00 StandardContext[servlets-examples]ContextListener: contextInitialized()
2004-06-06 01:08:00 StandardContext[servlets-examples]SessionListener: contextInitialized()
2004-06-06 01:08:01 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /rates/rates.jsp(5,0) The value for the useBean class attribute converters.conversionDAO is invalid.
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:357)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:141)
at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1217)
at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
at org.apache.jasper.compiler.Generator.generate(Generator.java:3261)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:422)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:507)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
----more----
Maybe you are looking for
-
I cannot send email from my iPhone 4 but can send by yahoo app
hi, this was the problem i encountered since i update my latest ios 7.1.2. but i can send o reply by using safari and yahoo apps. plz guide me to clear and can send emails o reply. thanks.
-
How can you tell if a thread can't get a lock on an object immediately?
A thread wishes to synchronize on an object called obj. When it hits the line synchronized (obj) it has to wait as another thread holds the lock. I want some code to behave differently if it cannot get the lock immediately. Is there a way to tell if
-
Install EBS on local disk from remote win 2003? Can't pass file space check
I have a portable 250G hard disk on my poor performance win xp,I want to install EBS 12 on my portable hard disk,but I xp system's performance is poor,so I connect to a fine performance win 2003 through mstsc and I can access my 250G hard disk from r
-
Help Music video's won't play now
Dear forum, I hope someone can help.??? Have just updated my iTunes to 7.6 and when I try to play some of my purchased music videos or even view preview vidoes from I-store all I get is the sound but the picture is just green with no visual. Have mad
-
How to load the CategoryName, instead of CategoryID in ListView?
I have a Listview control in a Windows Form. The listview contains 3 columns - CategoryID - Product Description - Price The question is: how to load the "Category Name", instead of "Category ID"? Does listview support Dictonary Blinding? Please help