Design question for database connection in multithreaded socket-server
Dear community,
I am programming a multithreaded socket server. The server creates a new thread for each connection.
The threads and several objects witch are instanced by each thread have to access database-connectivity. Therefore I implemented factory class which administer database connection in a pool. At this point I have a design question.
How should I access the connections from the threads? There are two options:
a) Should I implement in my server class a new method like "getDatabaseConnection" which calls the factory class and returns a pooled connection to the database? In this case each object has to know the server-object and have to call this method in order to get a database connection. That could become very complex as I have to safe a instance of the server object in each object ...
b) Should I develop a static method in my factory class so that each thread could get a database connection by calling the static method of the factory?
Thank you very much for your answer!
Kind regards,
Dak
Message was edited by:
dakger
So your suggestion is to use a static method from a
central class. But those static-methods are not realy
object oriented, are they?There's only one static method, and that's getInstance
If I use singleton pattern, I only create one
instance of the database pooling class in order to
cionfigure it (driver, access data to database and so
on). The threads use than a static method of this
class to get database connection?They use a static method to get the pool instance, getConnection is not static.
Kaj
Similar Messages
-
LDAP design question for multiple sites
LDAP design question for multiple sites
I'm planning to implement the Sun Java System Directory Server 5.2 2005Q1 for replacing the NIS.
Currently we have 3 sites with different NIS domains.
Since the NFS over the WAN connection is very unreliable, I would like to implement as follows:
1. 3 LDAP servers + replica for each sites.
2. Single username and password for every end user cross those 3 sites.
3. Different auto_master, auto_home and auto_local maps for three sites. So when user login to different site, the password is the same but the home directory is different (local).
So the questions are
1. Should I need to have 3 domains for LDAP?
2. If yes for question 1, then how can I keep the username password sync for three domains? If no for question 1, then what is the DIT (Directory Infrastructure Tree) or directory structure I should use?
3. How to make auto map work on LDAP as well as mount local home directory?
I really appreciate that some LDAP experta can light me up on this project.Thanks for your information.
My current environment has 3 sites with 3 different NIS domainname: SiteA: A.com, SiteB:B.A.com, SiteC:C.A.com (A.com is our company domainname).
So everytime I add a new user account and I need to create on three NIS domains separately. Also, the password is out of sync if user change the password on one site.
I would like to migrate NIS to LDAP.
I want to have single username and password for each user on 3 sites. However, the home directory is on local NFS filer.
Say for userA, his home directory is /user/userA in passwd file/map. On location X, his home directory will mount FilerX:/vol/user/userA,
On location Y, userA's home directory will mount FilerY:/vol/user/userA.
So the mount drive is determined by auto_user map in NIS.
In other words, there will be 3 different auto_user maps in 3 different LDAP servers.
So userA login hostX in location X will mount home directory on local FilerX, and login hostY in location Y will mount home directory on local FilerY.
But the username and password will be the same on three sites.
That'd my goal.
Some LDAP expert suggest me the MMR (Multiple-Master-Replication). But I still no quite sure how to do MMR.
It would be appreciated if some LDAP guru can give me some guideline at start point.
Best wishes -
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 -
Set password for database connection at runtime
Hi there,
is it possible to set the password and/or the user for the database connection at runtime.
The use case is to read the values from a file and decrypt them, and the to establish the conenction. So that i don't habe to redeploy everything if there is a change.
Thanks in advance.How exactly do i set these values for the datasource?
Edited by: Alex on 15.02.2012 09:50
€: JDeveloper 11.1.1.5.0
The use case is, that there is a file with an encrypted password. This should be decrypted and then be used for the connection. So when this encrypted passowrd changes, i don't want to edit and deploay the app once again. Instead the new encrypted password should be decrypted via code an then be used.
Edited by: Alex on 15.02.2012 10:00 -
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 -
Run Labview as different windows user (for database connectivity)
I have to connect to a corporate remote MSSQL-Database on the network, using the database connectivity toolkit for LabVIEW.
The db-authentification is realized checking the windows user (ads) who acceses the datebase (not a database user / password which is standard in the database vis)
Therefore I have to run LabVIEW as the defined windows user, different than the logged in user on the pc.
Is that possible to realize with LabVIEW?
Other Windows-tools allow to define the windows user/password which "run" an application - how can I do that with LabVIEW?Hi Zav. There is a windows command 'runas' which _may_ let you do what you want; I haven't
tried what you need to do, but is has worked for other tasks for us. Try 'runas /?' for the switches.
You will have to build your LV program into an executable, then use runas to launch it. Is there
a reason you can't just login to Windows as the required user?
If you can get your db admin to allow dbuser/password authentication that would be a much better
way to go.
Matt -
Best approch for Database connectivity
Hi All,
I am developing web application.
Can any one tell me that what is the best approch to use database connectivity for my web application?
how can i mentain my connection object throught out application?
Please help me about my improving code logic for web application.
Thanks
PandevConsider connection pooling.
-
SQL Query for Database Connections
What would be the proper syntax or DBA table to query and find out how many database connections there are currently? Thanks for all of your help!!
Marlanselect * from v$session;Some entries in this view are dynamic processes (type = 'BACKGROUND') and you may want to exclude those depending on your requirements.
-
Report in production prompts for database connection info
Hi,
I'm using SAP Crystal Reports version for VS 2010 SP1. I'm trying to implement the most basic need--to create reports in a development environment and move them to production by just copying the .rpt files. I want to rely on the database connection string from web.config, but don't see how that is done. I've tried using ADO.NET DataSets from Project Data and can get the report to run while developing, but when I move to another server I'm always prompted with the "The report you requested requires further information" dialog.
I tried this solution, which keeps the db server name in a web.config variable:
ReportDocument boReportDocument = new ReportDocument();
boReportDocument.Load(Server.MapPath(rmCR.SelectedItem.Value.ToString()));
ConnectionInfo boConnectionInfo = new ConnectionInfo();
boConnectionInfo.ServerName = ConfigurationManager.AppSettings["dbServerName"];
boConnectionInfo.DatabaseName = "dbCMRP_Employees";
boConnectionInfo.IntegratedSecurity = true;
ModifyConnectionInfo(boReportDocument.Database, boConnectionInfo);
// Modify the ConnectionInfo for all tables in all subreports
foreach (ReportDocument boSubreport in boReportDocument.Subreports)
ModifyConnectionInfo(boSubreport.Database, boConnectionInfo);
Session.Add("Report", boReportDocument);
Response.Redirect("CrystalReportsViewer.aspx");
and this works fine in development, but when moved to a different server I get the "The report you requested requires further information" dialog. I've made sure that the db has the correct security settings, but can't find anything missing.
I'm sure I'm missing something basic, but can't seem to find any solution after searching for days. Any solution that allows me to create the report in VS 2010 and copy to a production server will be appreciated.
Thanks,
DanThanks for your replies.
I think I've done what's outlined in the Troubleshooting Guide link that Ludek gave me. I did install Process Monitor and found the "Access Denied" entry, but I'm not sure which folder needs permission given to IIS APPPOOL\ASP.NET v4.0.
Here's the entry from Process Monitor:
Description: IIS Worker Process
Company: Microsoft Corporation
Name: w3wp.exe
Version: 7.5.7601.17514
Path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Command Line: C:\Windows\SysWOW64\inetsrv\w3wp.exe -ap "ASP.NET v4.0" -v "v4.0" -l "webengine4.dll" -a
.\pipe\iisipm461f344a-3d68-4e7c-b42e-ca18eac4553c -h "C:\inetpub\temp\apppools\ASP.NET v4.0\ASP.NET v4.0.config" -w "" -m 0 -t 20
PID: 7512
Parent PID: 3892
Session ID: 0
User: IIS APPPOOL\ASP.NET v4.0
Auth ID: 00000000:00465886
Architecture: 32-bit
Virtualized: False
Integrity: High
Started: 8/29/2011 1:03:58 PM
Ended: (Running)
Modules:
w3wp.exe 0x120000 0x8000 C:\Windows\SysWOW64\inetsrv\w3wp.exe Microsoft Corporation 7.5.7601.17514
Microsoft.Web.Administration.dll 0x28ae0000 0x24000 C:\Windows\assembly\GAC_MSIL\Microsoft.Web.Administration\7.0.0.0__31bf3856ad364e35\Microsoft.Web.Administration.dll Microsoft Corporation 6.1.7601.17514
App_Web_822ce1a1f503e532a2e860f7ce344f6d0d0f2eba.ascx.3417f053.eb4fk61t.dll 0x28b10000 0x8000 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\intranet\58a686e6\86baa618\App_Web_822ce1a1f503e532a2e860f7ce344f6d0d0f2eba.ascx.3417f053.eb4fk61t.dll n/a 0.0.0.0
App_Web_aed28e8a45aa161f6c9fc3f563283cb89b317bdc.ascx.3417f053.rodqolhn.dll 0x28c90000 0x8000 C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\intranet\58a686e6\86baa618\App_Web_aed28e8a45aa161f6c9fc3f563283cb89b317bdc.ascx.3417f053.rodqolhn.dll n/a 0.0.0.0
pvlocale-1-0.dll 0x2fc80000 0x76000 C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\pvlocale-1-0.dll SAP BusinessObjects 14.0.0.760
System.Data.Entity.ni.dll 0x2fd50000 0xcb8000 C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data.Entity\978e8514751373383f79c3fdd667aa2b\System.Data.Entity.ni.dll Microsoft Corporation 4.0.30319.1 -
DRM-21003 error for database connection
Hi,
I installed DRM 11.1.2 for win32 on my laptop and when I tried to set up database connection (to 11g XE), I am getting error message:
Connection Failed: DRM-21003: The Oracle.DataAccess client is not the expected version.
I installed Oracle XE 11.2.0.2 on my laptop. I also tried to connect to 10g server(10.2.0.4), but still has the same error.
Thanks.
-RongHi,
Apparently,this is a bug in version 11.2.1.0.I had the same issue.I believe this is an bug identified internally.BUG # 9911822.I uninstalled 11.2.1.0 and installed 11.2.1.102 version of the DRM software and this error no longer appears.
-Sireesha. -
Brand newbie question on database connection
I'm brand new to Oracle databasing and am having trouble figuring out how to set up a connection to an existing database. Specifically, I'm not clear at all about the use of the tnsname.ora file. What I'm trying to do is set up a connection using an .asp page to connect to this database. I'm using :
objConnect.Open ("Provider=MSDASQL;DRIVER={Microsoft ODBC for Oracle};Server=F12_PROD_MARS.WORLD;UID=FLGI;PWD=FLGI")
[/CODE]
Which gives me the "ORA-12154: TNS:could not resolve service name" error. I know the information that I need in my tnsname.ora file is:F12_PROD_MARS =
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)
(Host=172.31.xx.xx)
(Port=1521)
(ADDRESS=
(PROTOCOL=TCP)
(Host=172.31.xx.xx)
(Port=1526)
(CONNECT_DATA=
(SID=MARS)
I don't know where the tnsname.ora file is supposed to be located or how to reference it from .asp or anything like that though. The only database connection experience I have is with my own access databases, but none trying to connect to someone elses oracle db. Any help at all or a link to some kind of starters guide would be much appreciated. Also, I downloaded pl/sql developer, but I cannot log on to that either. I don't know if its the same connection issue here, but I know my user/pass for the server is correct, what do I enter for database, so that the application knows where to go? Thanks again... -STobjConnect.Open ("Provider=MSDASQL;DRIVER={Microsoft
t ODBC for
Oracle};Server=F12_PROD_MARS.WORLD;UID=FLGI;PWD=FLGI")I take it you have the Oracle Client installed on the web app server i.e. where the MS ODBC driver lives
ODBC now looks for tns name "f12_prod_mars.world" ...
Which gives me the "ORA-12154: TNS:could not resolve service name" error.
I know the information that I need in my tnsname.ora file is:
F12_PROD_MARS =
... because it looks for that name, including .world, and cant find it. Name "f12_prod_mars" is not the same name, obviously. (like test.com and test.se are different)
I don't know where the tnsname.ora file is supposed
to be located or how to reference it from .asp orWhere is it located now? If you search the harddrives for tnsnames.ora, what do you get?
connection issue here, but I know my user/pass for
the server is correct, what do I enter for database,
so that the application knows where to go? ThanksIf an app, like sql*plus, is asking for "Database:" it often means you give the tns name (=the alias for the tns connect descriptor, which is the thing with lots of ('s and )'s) :)
Message was edited by:
orafad -
Design Question for table - related columns
Hi,
I have some design question about table I am working on.
Here are the sample fields in the table,
process_begin_date
process_approved_by
process_signed_by
process_monitor
process_communication
the same way I have around 10 groups, for ex
other_begin_date
other_approved_by
other_signed_by
other_email
other_something
Question: Is good have all 50 fields in the same table? or any better idea?Hi,
Number of columns should not be any issue, but, proper normalization may be better for your design and scalability. If you can explain what you are storing in this table, you might get help if you need to have more than 2 tables in this particular scenario.
If all these fields are related to a single entity, probably this single table is already normalized and needs not to be replaced by two tables.
Salman -
Any way to disable encryption of password for database connection pool?
Dear all,
Does anybody know how to disable the password encryption for jdbc connection pool under weblogic 8.1? I need to put clear text password in the config.xml but it seems there's no way to disable the password encryption. Any help is appreciated. Thx in advance.
Paulpaul wee wrote:
Dear all,
Does anybody know how to disable the password encryption for jdbc connection pool under weblogic 8.1? I need to put clear text password in the config.xml but it seems there's no way to disable the password encryption. Any help is appreciated. Thx in advance.
PaulWhen you create the pool, don't give it any password at all, but when you add the
driver properties, add
password=mypassword
as one of the properties.
Joe -
Dynamic Parameter Prompting for Database Connection Password When schedulin
I'm having problems with Dynamic Parameters when I try to schedule a report in InfoView.
I create the report in Crystal Reports XI and publish it to the Crystal Server. I go into CMC and under Process:Database set the correct data source and enter the server, database, user and password.
When the report is run I can choose a dynamic parameter and the reports runs fine - it's when I try to schedule the report and choose the parameter that I am asked to enter the user and password for the database.
If the parameter is static it's fine and I don't get prompted. Because I want the end-users to schedule their own reports I need to have the user and password embedded in the report.
From what I've read in the forums, there seems to be a lot of issues with dynamic parameters and database logons, and no real solutions. But this is just weird that it's only failing when I try to schedule the report!I am having the same issue.
Issue started on 9/25/2008
Existing BO 11r2 installation including service pack 2
Windows Server 2003 Service pack 2
Existing scheduled reports do not exhibit this behaviour and run correctly.
Add new or update existing report. Log into the CMC as administrator and set process for database and parameters.
Exit CMC
log into Infoview. Click on report and run (as administrator OR as existing user with permissions) NO PROBLEM.
Log into Infoview as Administrator or existing users with permissions) as attempt to schedule report. All reports Any dynamic parameter and request for user name and password opens. Once the correct info is entered the report can be scheduled.
This is a new issue on our installation, we have been running without problems for over a year.
Any help appreciated. -
TP4 [ER] / icons in application resources for database connection
It would be nice to show active connections by differencing the icon in the application resources database connections. Contextual menu to disconnect the session is enabled/disabled but you have to expand each connections to see it.
I think this is a no-go, since you cannot retrieve a cleartext password from the OID if I'm correct.
Maybe you are looking for
-
Photoshop CS4 "Program Error" when using Text tool
Hello. I was having problems with Photoshop displaying a "Program Error" every so often, so I deleted the preference file and all seemed good. But after deleting the preference file for my Photoshop CS4 and re-launching Photoshop, the text tool cause
-
File Receiver Adapter is not writing the file?
Hi All, I am having a file to file scenario using NFS as both the source and destination are on server. File is getting picked up from server but not reaching the destination. In RWB for Receiver channel it only shows <b>Channel active and started co
-
I never set up a PIN but my Phone is locked and requiring one. Do I have to loose everything and do a factory reset?
-
Problems with transaction RSRT running a query, appears this message
Hi guys, i did a query, but when i run it in the transaction RSRT appears this message, what can i do? BW SERVER ERROR: No roll storage space of lenght 3920 available for OCCURS are.area. Thanks !
-
Photoshop Elements 5.0を使っているのですが 13にアップグレートできますか.
Photoshop Elements 5.0を使っているのですが 13にアップグレートできますか. パソコンの買い換えに伴いアップグレードを考えております. パッケージ版とUP版とどちらを購入するべきか?悩んでいます. どちらを選択したらいいでしょうか?