java database connection

Ads
 

java database connection

how to connect a database in struts program?

View Answers

March 3, 2008 at 2:39 PM

First Add two jar file
1> commons-dbcp-1.2.x.jar
2> mysql-connector.jar

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property
property="driverClassName"
value="com.mysql.jdbc.Driver" />
<set-property
property="url"
value="jdbc:mysql:///database_name?autoReconnect=true"; />
<set-property
property="username"
value="username" />
<set-property
property="password"
value="password" />
<set-property
property="maxActive"
value="10" />
<set-property
property="maxWait"
value="5000" />
<set-property
property="defaultAutoCommit"
value="true" />
</data-source>
</data-sources>

put this code into ur struts-config.xml

And in ActionServlet

Create ..
DataSource ds =getDataSource(request);

And then
Connection con =ds.getConnection();

Ads









Related Tutorials/Questions & Answers:
JAVA DATABASE CONNECTION WITH JTABLE
JAVA DATABASE CONNECTION WITH JTABLE  HOw To Load Database Contents From Access Database to JTable without using Vector
Java Connection to Oracle database
Java Connection to Oracle database  HI I am ubable to connnect jdbc to Oracle database.i had gone to control panel >>Administrative... type properly and the Test Connection failed.So Kindly tell me what to type in TNS
Advertisements
java database connection
java database connection  package com.tsi.constants; public class Constant { public static final String DRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String DBURL = "jdbc:oracle:thin
java database connection
java database connection  package com.tsi.constants; public class Constant { public static final String DRIVER = "oracle.jdbc.driver.OracleDriver"; public static final String DBURL = "jdbc:oracle:thin
database connection by using java bean
database connection by using java bean  i need a code for bean class to connect to mysql database. subsequently to use dis bean class whereever i need 2 connect 2 database
About connection database oracle to java
About connection database oracle to java  Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... to verify that connection is correct or not.The testing has failed .so what could
About connection database oracle to java
About connection database oracle to java  Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... to verify that connection is correct or not.The testing has failed .so what could
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle datebase to java.when i compile the program it is ok. but when i clicked on sql... that connection is correct or not. The testing has failed .so what could be TNS
About connection database oracle to java
About connection database oracle to java   I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked on sql... that connection is correct or not.The testing has failed .so what could be TNS
About connection database oracle to java
About connection database oracle to java  **Hi I culdn't connect oracle datebase to java.when i compile the program it is ok.but when i clicked... to verify that connection is correct or not.The testing has failed .so what could
DataBase Connection
DataBase Connection  How to connect java and Oracle 10g? Tell me Jdbc connection
Connection to Database
I manually make a connection to MySQL database in my web pages? How joomla... is the code how I am connecting to MySQL: I am connection to MySQL database in 2... database tables? Do I need to open one connection to each section? Thank you
database connection
database connection  how to connect the jsp page with database
database connection
database connection  i wanted to no how to connect sqlite database through netbeans? is it posible to connect it to a database that is on a remote pc? thank you
database connection
database connection  hi all ready created database table using mysql database,employee payroll,attendance,employee details used database i need how to import and export excel file into database using jsp? pls help me any one
connection with MySQL to java.
connection with MySQL to java.   how to connect MySQL database with jsp
error oracle database connection?
error oracle database connection?  hi now i am trying to connect oracle database and also insert my data into table, but it's not working.. I created...; PreparedStatement stmt=null; Connection con =null; ResultSet rs=null
Database connectivity Hibernate mysql connection.
Database connectivity Hibernate mysql connection.  How to do database connectivity in Hibernate using mysql
Regading Database connection
Regading Database connection  if we create the query table means how we retrive the query content from database
ModuleNotFoundError: No module named 'database-connection'
ModuleNotFoundError: No module named 'database-connection'  Hi, My... named 'database-connection' How to remove the ModuleNotFoundError: No module named 'database-connection' error? Thanks   Hi
ModuleNotFoundError: No module named 'database-connection'
ModuleNotFoundError: No module named 'database-connection'  Hi, My... named 'database-connection' How to remove the ModuleNotFoundError: No module named 'database-connection' error? Thanks   Hi
connection database error
connection database error  import java.awt.EventQueue; // import packages import java.awt.event.ActionEvent; import java.awt.event.ActionListener...{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection
Database connection class in a live project ..??
Database connection class in a live project ..??  In a Live mvc project where should i put the database connection class ? I want to know in the best coding practice
android connection to database oracle 10g
android connection to database oracle 10g  Hello, How i can connect my android application to my oracle 10g database
java connection leak
java connection leak  How to check the connection leak in Java
can modify this application connection with database
can modify this application connection with database   hi i'm want to say who thank java master or java professional help me convert Java applet... modify connection with database ? import javax.swing.*; import java.applet.
Draw graph using jsp without database connection
Draw graph using jsp without database connection  Draw graph using jsp code without database connection
Java-Connection Pool - JDBC
Java-Connection Pool  How can I create a connection pool. My database... is Weblogic 8. Which is the best approach to create a connection pool? ...{ public static void main(String[] args){ Connection con = null; String url
ModuleNotFoundError: No module named 'aafp-database-connection'
ModuleNotFoundError: No module named 'aafp-database-connection'  Hi...: No module named 'aafp-database-connection' How to remove the ModuleNotFoundError: No module named 'aafp-database-connection' error? Thanks  
ModuleNotFoundError: No module named 'wf-database-connection'
ModuleNotFoundError: No module named 'wf-database-connection'  Hi...: No module named 'wf-database-connection' How to remove the ModuleNotFoundError: No module named 'wf-database-connection' error? Thanks   Hi
ModuleNotFoundError: No module named 'wf-database-connection-honeycomb'
ModuleNotFoundError: No module named 'wf-database-connection-honeycomb' ...: ModuleNotFoundError: No module named 'wf-database-connection-honeycomb' How to remove the ModuleNotFoundError: No module named 'wf-database-connection-honeycomb'

Ads