Sql connection best practices
Can someone discuss the pros and cons of setting your db connection in the web.xml and then using the following in a jsp;
<sql:query var="myQuery">
SELECT * FROM mytable
</sql:query>I find that it is quick and easy, but would I want to give this kind of code to my supervisor? From 20,000 ft up. :)
Edited by: Reme on Aug 2, 2008 5:12 AM
[http://java.sun.com/javaee/5/docs/tutorial/doc/bnald.html]
The JSTL SQL tags for accessing databases listed in Table 7-7 are designed for quick prototyping and simple applications. For production applications, database operations are normally encapsulated in JavaBeans components.I wouldn't use it. Layer your application properly. Make use of a DAO class.
Similar Messages
-
SQL server Best Practice Analyzer output in .CSV
Hi Team, I ran SQL server Best practice analyzer on our SQL 2008 R2 server. I was trying to export scan result in .csv format but it is only giving me option to save it in .xml format. I have been looking for ways to export output in such a way
that it can be readable and I can send it to our clients but no luck.
How can I export SQL BPA output in .csv or any other user friendly format?
Thanks in Advance.Hi MSRS27,
You can run Best Practices Analyzer (BPA) scans either from Server Manager, by using the BPA GUI, or by using cmdlets in Windows PowerShell. We can view or save BPA results from Windows PowerShell session in different format.
If you want to export BPA results to a comma-separated values (CSV) text file, run the following cmdlet, where Path represents the path and text file name to which you want to save the CSV results.
CSV results can be imported into Microsoft® Excel, or other programs that display data in spreadsheets or grids.
Get-BPAResultModel ID| Export-CSVPath
For more information, see: Run Best Practices Analyzer Scans and Manage Scan Results
http://technet.microsoft.com/en-us/library/hh831400.aspx
Regards,
Sofiya Li
Sofiya Li
TechNet Community Support -
SAP Business One 2007 - SQL Security best practice
I have a client with a large user base running SAP Business One 2007.
We are concerned over the use of the sql sa user and the ability to change the password of this ID from the logon of SAP Business One.
We therefore want to move to use Windows Authentication (ie Trusted Connection) from the SAP BO logon. It appears however that this can only work by granting the window IDs (of the SAP users) sysadmin access in SQL.
Does anyone have a better method of securing SAP Business One or is there a recommended best practice. Any help would be appreciated.
DamianSee Administrators Guide for best practise.
U can use SQL Authentication mode Don't tick Remember password.
Also check this thread
SQL Authentication Mode
Edited by: Jeyakanthan A on Aug 28, 2009 3:57 PM -
How to establish the connection - Best Practice
Following is my code for database connection
import java.sql.Connection;
import java.sql.DriverManager;
import oracle.jdbc.driver.OracleDriver;
public class DBConnect
private static Connection connection = null;
static
try
DriverManager.registerDriver( new OracleDriver() );
String url = "jdbc:oracle:thin:@dbserver:1521:ORCL";
connection = DriverManager.getConnection( url, "user", "password" );
catch ( Exception e )
private DBConnect()
public static synchronized Connection getConnection()
return connection;
}Tell me the Best Practice to establish the connection.
Edited by: shashiwagh on Feb 1, 2010 11:25 AM
Edited by: shashiwagh on Feb 1, 2010 11:26 AMFirst, handle your exceptions properly.
Second, you should not normally create static database connections.
Third, hardcoding connection data like that is not a good idea. -
External connectivity best practice
Hi,
I would like to know what are the best practices to have external users using Excel to connect to SSAS cube. I understand the general concept that a cube user must be in a domain AD andthat same user is a member of a SSAS cube.
How can I ensure the excel connection is secure and each external user is only able to view their own data? I know the workbook can be password protected but can the connection be also password protected ?
BTW, I am not sure if this is the right forum for this question
RegardsMost modern external drives will typically go into a standby mode shortly after they're unmounted or disconnected which will spin down the drive. They'll still use some power, but your drive won't be doing anything so you don't need to worry about wearing it out. I'm a bit anal about stuff. I usually go so far as to unplug my external drives when I'm not using them as the power supply still consumes some juice... but, in your case, as it seems like you probably go back and forth quite a bit... just powering it down would be the best thing. It really doesn't take any extra effort when connecting your MacBook Pro to just switch it back on again.
-
Sql backup best practice on vms that are backed up as a complete vm
hi,
apologies as i am sure this has been asked many times before but i cant really find an answer to my question. so my situation is this. I have two types of backups; agent based and snap based backups.
For the vm's that are being backed up by snapshots the process is: vmware does the snap, then the san takes a snap of the storage and then the backup is taken from the san. we then have full vm backups.
For the agent based backups, these are only backing up file level stuff. so we use this for our sql cluster and some other servers. these are not snaps/full vm backups, but simply backups of databases and files etc.
this works well, but there are a couple of servers that need to be in the full vm snap category and therefore cant have the backup agent installed on that vm as it is already being backed up by the snap technology. so what would be the best practice on these
snapped vms that have sql installed as well? should i configure a reoccurring backup in sql management studio (if this is possible??) which is done before the vm snap backup? or is there another way i should be backing up the dbs?
any suggestions would be very welcome.
thanks
aaronHello Aaron,
If I understand correctly, you perform a snapshot backup of the complete VM.
In that case you also need to create a SQL Server backup schedule to perform Full and Transaction Log backups.
(if you do a filelevel backup of the .mdf and .ldf files with an agent you also need to do this)
I would run a database backup before the VM snapshot (to a SAN location if possible), then perform the Snapshot backup.
You should set up the transaction log backups depending on business recovery needs.
For instance: if your company accepts a maximum of 30 minutes data loss make sure to perform a transaction log backup every 30 minutes.
In case of emergency you could revert to the VM Snapshot, restore the full database backup and restore transaction log backups till the point in time you need. -
Access Connections best practice
I like the idea of having Lenovo Access Connection change the appropriate settings depending on you network location. Like turning off wifi when you are cabled.
Althoguh I often find it to be creating more problems than gains.
Any generel best practice using this tool?
Regards, Lars.Hi!
Use non overlapping channel 1-6-11 on 3
consecutive AP's.
eg.
AP1-Channel 1
AP2-Channel 6
AP3-Channel 11
AP4-Channel 1
AP5-Channel 6
plzz take a look:
http://www.cisco.com/en/US/products/hw/wirele
ss/ps441/products_tech_note09186a00800a86d7.shtml#nonover
HTH
-Jai -
JSF DB Connection Best Practices
During the life of a JavaServer Faces request, what are some best practices for storing a db connection?
For the duration of the transaction, a single connection should be created before db updates, made available to (possibly) multiple model objects, and closed at the conclusion of the request. The connection would only live during the request.
Right now each model object gets and releases it's own dbCon but that doesn't satisfy the (logical unit of work) requirements of a transaction when multiple objects are required for updating the database.
What is a good technique to get a dbCon and release it, and, where should it be stored?
TIA,
Al MalinHi,
I'd like to ask a follow-up question.
How do I close the connection after the session timed out or the user leaves the application by closing the browser?
Thanks,
Achim -
SQL Server Best Practices Architecture UCS and FAS3270
Hey thereWe are moving from EMC SAN and physical servers to NetApp fas3270 and virtual environment on Cisco UCS B200 M3.Traditionally - Best Practices for SQL Server Datbases are to separate the following files on spearate LUN's and/or VolumesDatabase Data filesTransaction Log filesTempDB Data filesAlso I have seen additional separations for...
System Data files (Master, Model, MSDB, Distribution, Resource DB etc...)IndexesDepending on the size of the database and I/O requirements you can add multiple files for databases. The goal is provide optimal performance. The method of choice is to separate Reads & Writes, (Random and Sequential activities)If you have 30 Disks, is it better to separate them? Or is better to leave the files in one continous pool? 12 Drives RAID 10 (Data files)10 Drives RAID 10 (Log files)8 Drives RAID 10 (TempDB)Please don't get too caught up on the numbers used in the example, but place focus on whether or not (using FAS3270) it is better practice to spearate or consolidate drives/volumes for SQL Server DatabasesThanks!Hi Michael,It's a completely different world with NetApp! As a rule of thumb, you don't need separate spindles for different workloads (like SQL databases & logs) - you just put them into separate flexible volumes, which can share the same aggregate (i.e. a grouping of physical disks).For more detailed info about SQL on NetApp have a look at this doc:http://www.netapp.com/us/system/pdf-reader.aspx?pdfuri=tcm:10-61005-16&m=tr-4003.pdfRegards,Radek
-
PL/SQL Design: Best Practice
Hello everybody,
I'm trying to improve myself acquiring compentence in PL/SQL design. At now I am (or I wish to be) a good practitioner but I have to complain myself for lackings in designing architecture.
I mean, for example, how to organize procedure and functions in a package, how to use pattern architecture, logging and testing practices...
Do you know where I can find resources for these arguments? Which books do you suggest to start with?
Thank you very much.
NicolaThe best practices are the very same fundamentals that apply to all other languages and have existed for since the dawn of programming.
The single biggest fundamental principle is to modularise your design and code. A well designed program consists of building blocks. Different languages have different names for these - procedures, functions, units, packages, methods, routines, etc.
A program lives or dies by how well it is modularised.
If you only get that right, you can claim to be a Programmer and not a mere two bit developer. -
Coldfusion, MS SQL, Hash Best Practices,...
Hello,
I am trying trying to store hashed data (user password) in an
ms sql database; the datatype in the database is set to varbinary.
I get a datatype conflict when trying to insert the hashed data. It
works when the datatype in the database is set to varchar.
I understand that you can set your hash function with
arguments that will convert the data before sending to the
database, but I am not clear on how this is done. Now, along with
any assistance with the conversion, what exactly is the best
practice for storing the hash data? Should I store as varcahar or
varbinary? Of course, if varchar I won't have the problem, but I am
interested in best practices as well.
Thnxbrwright,
I suggest parameterizing your queries to add protecting from
injection.
http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-b20.htm
hashing is best suited for passwords because the encryption
is one way, once encrypted using hash() it can't be decrypted.
Other fields that you might want to encrypt and still have the
ability to decrypt, you can use the encrypt() and decrypt()
functions.
http://livedocs.adobe.com/coldfusion/6.1/htmldocs/functi75.htm
I think there are also new encryption functions available in
coldfusion 8... -
Physical Connection Best Practices
Hi;
I hope someone can help us.
We already have 4 SG300 52 ports Switches: (L2 mode)
We need to know the best way to connect the Switches and the router due to:
- Do not get excesive latency in the internal network.
- Do not get SPF problems.
- Do not get duplicated pings
- Get the maximum bandwith in the internal network.
- Get the best router link.
My thougts are:
Option 1:
Connect one uplink port to another uplink port at the next SW
Connect the other uplink port (of all Switches) to the internal SW port on the router/Firewall. (4 integrated ports 10/100)
Option 2
Connect two uplink ports to the two uplink ports at the next SW
Connect the number 1 port (of all Switches) to the internal SW port on the router/Firewall. (4 integrated ports 10/100)
Option 3
Connect two uplink ports to the number 1 and 2 port at the next SW
Connect the uplink port (of all Switches) to the internal SW port on the router/Firewall. (4 integrated ports 10/100)
Any suggestions?
Thanks.
Regards.If you have a multi-threaded server then before long you will have two "simultaneous" requests for a database connection. These requests will want to use different connections, since as you can see if they both use it at the same time, bad things will happen. You could synchronize so they wait in line to use the single connection but I think you can see that doesn't scale well to higher load.
So you need to have access to more than one connection. What's commonly done in multi-threaded servers is to use a connection pool. You can get open-source connection pools, so don't spend any time writing your own. (They aren't easy to get right.) -
Managing connections best practices
Hi,
I have a web application that uses JDBC to retrieve information and display it. My question is: What is the best way to manage your connection objects? I know using a connection pool is probably best, but I'm curious to hear good alternatives? If I need a connection in several places in my web-app, then storing one Connection object in the session seems like a good idea. This way I don't have to create and close my connections each time and slow down performance. But what happens to the connection when the user is no longer in the session. Does the database close the connection implicitly and is there any cons to doing it this way?
ThanksHi,
I have a web application that uses JDBC to retrieve
information and display it. My question is: What is
the best way to manage your connection objects? I know
using a connection pool is probably best, but I'm
curious to hear good alternatives? If I need a
connection in several places in my web-app, then
storing one Connection object in the session seems
like a good idea. The term "session" usually refers to a 'space' that exists both on a client and a server.
Connections never exist on more than one machine or even more than one application.
This way I don't have to create and
close my connections each time and slow down
performance. But what happens to the connection when
the user is no longer in the session. Does the
database close the connection implicitly and is there
any cons to doing it this way?
Well one con is that in general you have no control over when the "session" is closed. Thus you must rely on finalize in a java class to close your connections via the GC. And unless you have a really unusual database, or you only use a couple of "sessions" an hour, you are going to run out of connections. This is because GC is optimized for memory handling and not any other resource (a connection is a resource.) -
We have tried using both a Windows 7 and a Windows 8 machine and still cannot see any items available in the pulldown (ie. no sql 2012 or anything) Is this a known issue and BPA does not work for SQL 2012? Any suggestions? I've seen several
posts with the same issue but, no resolution.
LauraHi Laura,
I installed Microsoft Baseline Configuration Analyzer 2.0 successfully. I can select a product: SQL Server 2012 BPA. Do you mean this?
Thanks.
If you have any feedback on our support, please click
here.
Maggie Luo
TechNet Community Support -
Closing DB Connection-Best Practice
Currently I am opening and closing my connection to the database on each event that warrants a database connection. Is this the way I should handle it, or should I open the connection at the beginning and close it at the end, leaving it open in between?
I have a certain panel that has numerous, separate inputs to a database that are isolated from each other, and if I happen to use all of these inputs, I open and close the connection 3 or 4 times.
ThanksHi,
As far as an application is concerned we usually wont advice opening and closing connection as and when necessary. But if the connection is open for a long time there are some possible problems. One is that if the server goes down the user wont be aware of that till he executes the next query and also the error wont will be a valid one.Next is the amount of time ther server holds the connection and this has its significance if max. number of connections is specified.
So again, its upto you to decide what all conditions are applicable to you. Its actually a trade-off between reliability and performance. :-)..
regards Stallon
Maybe you are looking for
-
Download Palm Tungsten E2 on new computer with Windows 7
I am a Volunteer here, not employed by HP. You too can become an HP Expert! Details HERE! If my post has helped you, click the Kudos Thumbs up! If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you
-
Like it says in the title basically. I want to use a time capsule to store my files and backups and access it from my phone and MacBook Air. However I do not want the others in my house who are currently connected to the same wifi/ethernet router to
-
Email attachments not exporting from outlook 2013 with Acrobat XI standard
I can't get my email attachments in Outlook 2013 to export along with the message. I've got the option checked in the settings to include attachments, and I don't get an error message when the PDF is created. But it includes the message only, rega
-
Problem with iPhoto 1.1.1
Just imported my vacation pictures, but they showed up in the Photo Library not in the Last Import File. In addition, I am unable to drag and drop pictures from the Photo Library to to new or old albums and once I exit and re enter iPhoto the picture
-
IPhoto unexpectedly quits when importing from camera
iPhoto is working fine but when I try to import photos from my camera, iPhoto quits and a box appears asking if I want to close or retry. I've retried, put new batteries in the camera, tried reading the card through my HP PSC 2355, and did a restart