MySQL database connection from Custom JSP
I am trying to connect MySQL database from my custom JSP. I am getting following error which says that the connector JAR (mysql-connector-java-5.1.7) is not in CLASS PATH.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Where should I need to add to get by custom JSP during run time of BPM Studio or Workspace?
I have tried in adding to External resources. But didn't work that way. even I tried adding to "lib" folder in resource view.
My Custom JSP code:_
<%@ page language="java" import="java.sql.*" %>
<html>
<head></head>
<body>
<%
System.out.println("MySQL Connect Example.");
Connection conn = null;
String url = "jdbc:mysql://localhost:3306/";
String dbName = "aboo";
String driver = "com.mysql.jdbc.Driver";
String userName = "monty";
String password = "some_pass";
try {
Class.forName(driver).newInstance();
conn = DriverManager.getConnection(url+dbName,userName,password);
System.out.println("Connected to the database");
String query = "Select * FROM employeee";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
System.out.println(rs.getInt(1));
System.out.println(rs.getString(2));
conn.close();
System.out.println("Disconnected from database");
} catch (Exception ee) {
ee.printStackTrace();
%>
</body>
</html>
Edited by: sideeque on Jul 7, 2009 9:38 AM
Edited by: sideeque on Jul 7, 2009 9:39 AM
I got it working by just adding JAR to C:\OraBPMStudioHome\webapps\workspace\lib
Similar Messages
-
How to establish a MYSQL Database connection in JSP page.
Hi People,
Tell me how to establish mysql database connection in JSP page.
Needed details on:
1) what are all the mysql drivers need to be included.
2) what is the syntax for establish a database connectionhi,
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlsee down for mysql config with tomcat -
Error in Mysql database connectivity
hello,
there is problem in Mysql database connectivity.
when i connect JSP program to Mysql database it gives error :
Server configuration denied access to data source
please help me asap
kuldip jain
[email protected]i m also working on Mysql Java but on Window 2000 platform
here is the Java code which successfully runing on my machine
import java.sql.*;
public class TestMySql
public static void main(String[] Args)
try
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection C = DriverManager.getConnection(
"jdbc:mysql://server2:3306/Db?user=root");
Statement Stmt = C.createStatement();
ResultSet RS = Stmt.executeQuery("SELECT * from T1");
while (RS.next()) {
System.out.println(RS.getString(1));
catch (Exception E)
System.out.println("SQLException: " + E.getMessage()); -
MySQL Database Connection (two databases at the same time)
I have never had to open more than one MySQL database from within the same website before, but I do now. The website I have is designed where all the content comes from within the main database. I am building an Inventory system that I want within it's own database, in the event I would ever need to move the application to another server or something, I don't want this data residing in the main database.
Currently, I open the database connection from within a file called "common.php" that resides in a directory called "lib" that can be accessed from the root directory. Below is the proposed code that would be placed within the "common.php" file:
// Define Database Variables
$dbserver = "127.0.0.1";
$dbuser = array('clevelan_user1', 'clevelan_user2');
$dbpass = array('P@ssw0rd', 'P@ssw0rd2');
$dbname = array('clevelan_database1', 'clevelan_database2');
// Start Session
session_start();
// Connect to Databases
connectdb($dbserver, $dbuser[0], $dbpass[0], $dbname[0]);
connectdb2($dbserver, $dbuser[1], $dbpass[1], $dbname[1]);
// Database 1 Connection
function connectdb($dbserver, $dbuser, $dbpass, $dbname) {
// connects to db
global $connection;
$connection = @mysql_connect($dbserver, $dbuser, $dbpass) or die ("could not connect to server");
$db = @mysql_select_db($dbname, $connection) or die ("could not select databsase");
return $connection;
// Database 2 Connection
function connectdb2($dbserver, $dbuser, $dbpass, $dbname) {
// connects to db
global $connection2;
$connection2 = @mysql_connect($dbserver, $dbuser, $dbpass) or die ("could not connect to server");
$db2 = @mysql_select_db($dbname, $connection2) or die ("could not select databsase");
return $connection2;
//End of Code Within the "common.php"
From within any page of the website, I want to access both connections by placing an include at the top of each page:
include_once("lib/common.php");
Currently, when I run the code above, any page within the website (the home page) provides error messages with regards to database connectivity (the pages are looking for there content from within the second database. It's as if the second database is the only database seen by the website.
I need help figuring out how I can have two MySQL databases open at the same time (the second database will only be open for short periods of time and then closed). But the main database is always open.Create one project using one copy of the exact tables.
create 2 different sessions.xml files each pointing to the same project. Set the login information in the sessions.xml files.
That should work fine.
Peter -
Steps to change universe database connection from SQL server to Oracle 10
Hi,
we are moving from sql server to Oracle 10.Please let me know the steps and various parameters I should consider while changing universe database connection from SQL server to Oracle 10.
Following are the steps which I assumed :
1. create a new Oracle database connection or edit the existing connection to point to Oracle server
2. Need to check sql for each object, having integrity check for universe will solve the purpose of parsing each object
3. Exporting the universe after integrity check
4. Report data testing
Let me know if I miss on any steps.Also what all factors I need to consider while moving to Oracle for eg: what @ custom sql,what @ table names,what @ LOV etc.
Kindly replyThanks Abhijeet and Shreyash,
I will follow the steps you have suggested.
Actually I was searching for this on net and got to know that with Oracle database connection,theres lot of stuff needs to take care of in terms of custom sql and LOV and in our case,we have lot of custom sql for each object in the universe so just wanted to confirm.
I will do the changes and let you guys know in case theres any isuue specifically to Oracle. -
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. -
Error While creating new database connection from HFM workspace
Hi,
We have recently installed HFM and was trying to create database connection from database connection manager in HFM workspace.
I am getting below error:
"Error connecting to database connection : no HssJNIDriver950 in java.library.path" initially and later
"Error connecting to database connection : com/hyperion/ap/adm/HssConn".
Any information in this direction would helpful.
Thanks,
Bhargav
Edited by: bhargavr on Jan 24, 2011 6:55 PMHi bhargavr,
We came accross the same issue. Try the following solution below for this 'KNOWN ISSUE' and let me know how you get on. Drop me a note if you have any questions regarding this post.
Error: *"Error connecting to database connection: com/hyperion/ap/adm/HssConn" While Creating a Financial Management Database Connection* [ID 1102697.1]
Modified 04-JAN-2011 Type PROBLEM Status PUBLISHED
Applies to:
Hyperion BI+ - Version: 11.1.2.0.00 and later [Release: 11.1 and later ]
Microsoft Windows x64 (64-bit)
Symptoms:
You are running the Financial Reporting Web Server on a 64-bit server.
When you try to create a new Financial Management (HFM) database connection using the Database Connection Manager in Workspace you receive the following message:
“Error connecting to database connection <connection_name>: com/hyperion/ap/adm/HssConn”
You can create a database connection in Financial Reporting Studio. When you refresh a report with a Financial Management database connection, you receive one of the following messages:
“1001: Error connecting to database connection <DATABASE_CONNECTION_NAME>: com/hyperion/ap/adm/HssConn”
or
“1001: Error connecting to database connection <DATABASE_CONNECTION_NAME>: no HssJNIDriver950 in java.library.path”
Cause:
The issue is documented in unpublished bug 9537050, and in Known Issues in the 11.1.2 Reporting and Analysis Readme. Cross-reference unpublished bug 9707353.
Solution:
In the Windows registry, take the following steps:
Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\HyperionSolutions\FinancialReporting0\HyS9FRReports.
For each of the following entries, prefix the contents with text in the blue box: Env2, JVMOption13, and JVMOption17 (note that the JVMOption numbers might be slightly different in your environment).
C:\Oracle\Middleware\EPMSystem11R1\common\ADM\11.1.2.0\bin-64
If your EPM_ORACLE_HOME is not located at C:\Oracle\Middleware\EPMSystem11R1, replace that location with your location.
Restart the server.
G'Luck,
-David -
Opening a seeded OAF page from custom JSP page.
Hi All,
We have requirement to open a seeded OAF page from custom JSP page.
When we try to open URL of an OAF page after passing URL input parameters, we are always getting following error:
'You have insufficient privileges for the current operation. Please contact your System Administrator.'
On directly accessing the seeded OAF page, its encoding all the input parameters passed in URL. Also some more encoded parameters are getting added to the URL dynamically.
Is there any standard way exists to invoke seeded OAF pages without passing encrypted parameters to it? Also where can we get more details about
encrypting OAF URL parameters.
Any pointers would be appreciated.
Thanks in advance!
SaurabhHave you duplicated entire Customer Service module's menu in your responsibility?
or Also ping me the menu name..
--Prasanna -
Jsp JST MySQL - database connection
Hello
I am facing a database connection problem. I want to connect to mysql database fro a jsp page that uses JSTL taglibs.
I am using Tomcat 5.x, JSTL 1.1. MySQL 5x
I have copied jstl.jar, standard.jar and mysql driver in the \WEB-INF\lib dir of my application.
If I connect to the database using scriptlet it works. But If I connect using the sql taglib, it gives me the error
2008-01-22 14:20:12 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
my jsp file is as follows
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="firstName">request.getParameter("name")</c:set>;
<%= request.getParameter("name") %>
<sql:setDataSource
var="myDS"
scope="request"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/contact_db"
user="root"
password=""
/>
<sql:query var="phone_book" dataSource="$(myDS)">
Select last_name, home, cell, office from phone_book where first_name = ?
<sql:param value="firstName"/>
</sql:query>
<HTML>hi thanks
please let me know whats the better approach for getting an database connection if this is not recommended.
after some modifications i am not getting the no suitable driver error. I also updated the code as per your comments. ...yet am not seeing any results.
I have modified the file as follows.
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
String firstName = request.getParameter("name");
%>
<%= firstName %>
<sql:setDataSource
var = "firstDS"
scope="request"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/contact_db"
user="root"
password=""
/>
<sql:query var="phone_book" dataSource="${firstDS}">
Select * from phone_book where first_name = ?
<sql:param value="${firstName}"/>
</sql:query>
<c:forEach var="phone_book" items="${user.rows}">
<tr>
<td><c:out value="${row.no}"/></td>
<td><c:out value="${row.first_name}"/></td>
<td><c:out value="${row.last_title}"/></td>
<td><c:out value="${row.home}"/></td>
<td><c:out value="${row.cell}"/></td>
<td><c:out value="${row.office}"/></td>
</tr>
</c:forEach>
<HTML>
<BODY>
Hello
</BODY>
</HTML> -
Database connection error with JSP
I'm having problems connecting to a mysql database via a helper object in my jsp pages. I've researched this for the last two days and nothing I have tried is yet to make a difference.
My java code is essentially the following (minus try/catch for readability):
Connection con = null;
String dsn = "jdbc:odbc:mwtech";
String user = "root";
String password = "";
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(dsn, user, password);When I run this via JBuilder, it connects to my database without a problem. But when I try to use this same object via a jsp I keep getting the error:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified .
I'm running Tomcat 4.1 as my web-server, my database is named mwtech and has a User DSN registered in the ODBC panel.
I've made the following alterations to my server.xml and web.xml files:
server.xml
<Context path="" reloadable="true" docBase="ROOT" debug="0" >
<ResourceParams name="jdbc/mwtech">
<parameter>
<name>driverClassName</name>
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:odbc:mwtech</value>
</parameter>
<parameter>
<name>user</name>
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
</ResourceParams>
</Context>
WEB-INF\web.xml<resource-ref>
<res-ref-name>jdbc/odbc</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
I have also tried configuring this to work with the mysql connector/J driver, but that didn't work either (in fact, it made things worse so it won't even run via JBuilder).
Any help would be greatly appreciated.
--Slowly going insane...It's not working because you're failing to provide access to the drivers from the application.
ODBC works in your IDE because your IDE is pathed for both J2EE and J2SE.
ODBC does not work in the Servlet container because it is not core there.
Connector/J doesn't work in either because Connector/J is not part of either core J2SE or J2EE. So....
Once again download the Conenctor/J driver (this is the better way to go, trust me on this). Put the mysql-connector-java-xxxx.jar file in the <%WEB_ROOT%>/WEB-INF/lib directory of your application. (replace <%WEB_ROOT%> with your root context). This should now work, both in your IDE and your web-app. -
MySql database Connection failure
Hi,
I have following code. I am using MySql database. and Tomcat server and MySql jdbc driver. I am able to get the Datasource but when I call getConnection on ds, I get Connection object as null. Any help here?
ctx = new InitialContext();
if( ctx == null ) throw new Exception("ERROR - No Context");
// ESTABLISH THE DataSource //
ds = (DataSource)ctx.lookup("java:comp/env/jdbc/xmediaDB");
if( ds == null ) throw new Exception("ERROR - DataSource is null");
// ESTABLISH THE Connection //
con = ds.getConnection();
if( con == null ) throw new Exception("ERROR - Failed to get connection");Yes database is running...
Here are my server.xml and web.xml anything wrong here?
Hi sherbir,
Pl let me know if anything wrong.
Here is my server.xml :
<!-- Example Server Configuration File -->
<!-- Note that component elements are nested corresponding to their
parent-child relationships with each other -->
<!-- A "Server" is a singleton element that represents the entire JVM,
which may contain one or more "Service" instances. The Server
listens for a shutdown command on the indicated port.
Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<Server port="8005" shutdown="SHUTDOWN" debug="0">
<!-- Uncomment these entries to enable JMX MBeans support -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
debug="0"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
debug="0"/>
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" (and therefore the web applications visible
within that Container). Normally, that Container is an "Engine",
but this is not required.
Note: A "Service" is not itself a "Container", so you may not
define subcomponents such as "Valves" or "Loggers" at this level.
-->
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Tomcat-Standalone">
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Each Connector passes requests on to the
associated "Container" (normally an Engine) for processing.
By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
You can also enable an SSL HTTP/1.1 Connector on port 8443 by
following the instructions below and uncommenting the second Connector
entry. SSL support requires the following steps (see the SSL Config
HOWTO in the Tomcat 4.0 documentation bundle for more detailed
instructions):
* Download and install JSSE 1.0.2 or later, and put the JAR files
into "$JAVA_HOME/jre/lib/ext".
* Execute:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
$JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA (Unix)
with a password value of "changeit" for both the certificate and
the keystore itself.
By default, DNS lookups are enabled when a web application calls
request.getRemoteHost(). This can have an adverse impact on
performance, so you can disable it by setting the
"enableLookups" attribute to "false". When DNS lookups are disabled,
request.getRemoteHost() will return the String version of the
IP address of the remote client.
-->
<!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8081 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8080"
minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
<!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
<!--
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8443" minProcessors="5" maxProcessors="75"
enableLookups="true"
acceptCount="100" debug="0" scheme="https" secure="true"
useURIValidationHack="false" disableUploadTimeout="true">
<Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
clientAuth="false" protocol="TLS" />
</Connector>
-->
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8009" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" connectionTimeout="20000"
useURIValidationHack="false"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
<!-- Define an AJP 1.3 Connector on port 8009 -->
<!--
<Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
port="8009" minProcessors="5" maxProcessors="75"
acceptCount="10" debug="0"/>
-->
<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
port="8082" minProcessors="5" maxProcessors="75"
enableLookups="true" disableUploadTimeout="true"
acceptCount="100" debug="0" connectionTimeout="20000"
proxyPort="80" useURIValidationHack="false" />
-->
<!-- Define a non-SSL legacy HTTP/1.1 Test Connector on port 8083 -->
<!--
<Connector className="org.apache.catalina.connector.http.HttpConnector"
port="8083" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" />
-->
<!-- Define a non-SSL HTTP/1.0 Test Connector on port 8084 -->
<!--
<Connector className="org.apache.catalina.connector.http10.HttpConnector"
port="8084" minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="10" debug="0" />
-->
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host). -->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Standalone" defaultHost="localhost" debug="0">
<!-- The request dumper valve dumps useful debugging information about
the request headers and cookies that were received, and the response
headers and cookies that were sent, for all requests received by
this instance of Tomcat. If you care only about requests to a
particular virtual host, or a particular application, nest this
element inside the corresponding <Host> or <Context> entry instead.
For a similar mechanism that is portable to all Servlet 2.3
containers, check out the "RequestDumperFilter" Filter in the
example application (the source for this filter may be found in
"$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
Request dumping is disabled by default. Uncomment the following
element to enable it. -->
<!--
<Valve className="org.apache.catalina.valves.RequestDumperValve"/>
-->
<!-- Global logger unless overridden at lower levels -->
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt"
timestamp="true"/>
<!-- Because this Realm is here, an instance will be shared globally -->
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
debug="0" resourceName="UserDatabase"/>
<!-- Comment out the old realm but leave here for now in case we
need to go back quickly -->
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<!-- Replace the above Realm with one of the following to get a Realm
stored in a database and accessed via JDBC -->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/authority"
connectionName="test" connectionPassword="test"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
connectionName="scott" connectionPassword="tiger"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:CATALINA"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
-->
<!-- Define the default virtual host -->
<Host name="localhost" debug="0" appBase="webapps"
unpackWARs="true" autoDeploy="true">
<!-- Normally, users must authenticate themselves to each web app
individually. Uncomment the following entry if you would like
a user to be authenticated the first time they encounter a
resource protected by a security constraint, and then have that
user identity maintained across *all* web applications contained
in this virtual host. -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn"
debug="0"/>
-->
<!-- Access log processes all requests for this virtual host. By
default, log files are created in the "logs" directory relative to
$CATALINA_HOME. If you wish, you can specify a different
directory with the "directory" attribute. Specify either a relative
(to $CATALINA_HOME) or absolute path to the desired directory.
-->
<!--
<Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- Logger shared by all Contexts related to this virtual host. By
default (when using FileLogger), log files are created in the "logs"
directory relative to $CATALINA_HOME. If you wish, you can specify
a different directory with the "directory" attribute. Specify either a
relative (to $CATALINA_HOME) or absolute path to the desired
directory.-->
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt"
timestamp="true"/>
<!-- Define properties for each web application. This is only needed
if you want to set non-default properties, or have web application
document roots in places other than the virtual host's appBase
directory. -->
<!-- Tomcat Root Context -->
<!--
<Context path="" docBase="ROOT" debug="0"/>
-->
<!-- Tomcat Examples Context -->
<Context path="/examples" docBase="examples" debug="0"
reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_examples_log." suffix=".txt"
timestamp="true"/>
<Ejb name="ejb/EmplRecord" type="Entity"
home="com.wombat.empl.EmployeeRecordHome"
remote="com.wombat.empl.EmployeeRecord"/>
<!-- If you wanted the examples app to be able to edit the
user database, you would uncomment the following entry.
Of course, you would want to enable security on the
application as well, so this is not done by default!
The database object could be accessed like this:
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
UserDatabase database =
(UserDatabase) envCtx.lookup("userDatabase");
-->
<!--
<ResourceLink name="userDatabase" global="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
-->
<!-- PersistentManager: Uncomment the section below to test Persistent
Sessions.
saveOnRestart: If true, all active sessions will be saved
to the Store when Catalina is shutdown, regardless of
other settings. All Sessions found in the Store will be
loaded on startup. Sessions past their expiration are
ignored in both cases.
maxActiveSessions: If 0 or greater, having too many active
sessions will result in some being swapped out. minIdleSwap
limits this. -1 means unlimited sessions are allowed.
0 means sessions will almost always be swapped out after
use - this will be noticeably slow for your users.
minIdleSwap: Sessions must be idle for at least this long
(in seconds) before they will be swapped out due to
maxActiveSessions. This avoids thrashing when the site is
highly active. -1 or 0 means there is no minimum - sessions
can be swapped out at any time.
maxIdleSwap: Sessions will be swapped out if idle for this
long (in seconds). If minIdleSwap is higher, then it will
override this. This isn't exact: it is checked periodically.
-1 means sessions won't be swapped out for this reason,
although they may be swapped out for maxActiveSessions.
If set to >= 0, guarantees that all sessions found in the
Store will be loaded on startup.
maxIdleBackup: Sessions will be backed up (saved to the Store,
but left in active memory) if idle for this long (in seconds),
and all sessions found in the Store will be loaded on startup.
If set to -1 sessions will not be backed up, 0 means they
should be backed up shortly after being used.
To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
and minIdleBackup all to -1, saveOnRestart to false, then restart
Catalina.
-->
<!--
<Manager className="org.apache.catalina.session.PersistentManager"
debug="0"
saveOnRestart="true"
maxActiveSessions="-1"
minIdleSwap="-1"
maxIdleSwap="-1"
maxIdleBackup="-1">
<Store className="org.apache.catalina.session.FileStore"/>
</Manager>
-->
<Environment name="maxExemptions" type="java.lang.Integer"
value="15"/>
<Parameter name="context.param.name" value="context.param.value"
override="false"/>
<Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/EmployeeAppDb">
<parameter><name>user</name><value>sa</value></parameter>
<parameter><name>password</name><value></value></parameter>
<parameter><name>driverClassName</name>
<value>org.hsql.jdbcDriver</value></parameter>
<parameter><name>driverName</name>
<value>jdbc:HypersonicSQL:database</value></parameter>
</ResourceParams>
<Resource name="mail/Session" auth="Container"
type="javax.mail.Session"/>
<ResourceParams name="mail/Session">
<parameter>
<name>mail.smtp.host</name>
<value>localhost</value>
</parameter>
</ResourceParams>
<ResourceLink name="linkToGlobalResource"
global="simpleValue"
type="java.lang.Integer"/>
</Context>
<!--
Review Production Web Application Context
NOTE: this set of connection params points to the development database because we're on the developement server.
-->
<Context
path="/review"
debug="0"
reloadable="true"
docBase="C:\download\eclipse\eclipse\workspace\review"
workDir="C:\download\eclipse\eclipse\workspace\review\work\org\apache\jsp" >
<Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_review_log." suffix=".txt" timestamp="true"/>
<!-- JNDI entries for xmedia db -->
<Resource name="jdbc/xmediaDB"
auth="Container"
type="javax.sql.DataSource">
</Resource>
<ResourceParams name ="jdbc/xmediaDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>50</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>80</value>
</parameter>
<parameter>
<name>username</name>
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<value>admin</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:mysql://153.32.143.96:3306/xmedia_dev?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>
</Host>
</Engine>
</Service>
<!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0
as its servlet container. Please read the README.txt file coming with
the WebApp Module distribution on how to build it.
(Or check out the "jakarta-tomcat-connectors/webapp" CVS repository)
To configure the Apache side, you must ensure that you have the
"ServerName" and "Port" directives defined in "httpd.conf". Then,
lines like these to the bottom of your "httpd.conf" file:
LoadModule webapp_module libexec/mod_webapp.so
WebAppConnection warpConnection warp localhost:8008
WebAppDeploy examples warpConnection /examples/
The next time you restart Apache (after restarting Tomcat, if needed)
the connection will be established, and all applications you make
visible via "WebAppDeploy" directives can be accessed through Apache.
-->
<!-- Define an Apache-Connector Service -->
<!--
<Service name="Tomcat-Apache">
<Connector className="org.apache.catalina.connector.warp.WarpConnector"
port="8008" minProcessors="5" maxProcessors="75"
enableLookups="true" appBase="webapps"
acceptCount="10" debug="0"/>
<Engine className="org.apache.catalina.connector.warp.WarpEngine"
name="Apache" debug="0">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="apache_log." suffix=".txt"
timestamp="true"/>
<Realm className="org.apache.catalina.realm.MemoryRealm" />
</Engine>
</Service>
-->
</Server>and Here is my web.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- BEGIN: icon section -->
<!-- END: icon section -->
<!-- BEGIN: display-name section -->
<display-name>Cross-Media Review Server</display-name>
<!-- END: display-name section -->
<!-- BEGIN: description section -->
<description>
Cross-Media Review Server
</description>
<!-- END: description section -->
<!-- BEGIN: distributable section -->
<!-- END: distributable section -->
<!-- BEGIN: context-param section -->
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.locale</param-name>
<param-value>en-US</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>messages</param-value>
</context-param>
<!-- END: context-param section -->
<!-- BEGIN: listener section -->
<!-- END: listener section -->
<!-- BEGIN: error-page section -->
<!-- END: error-page section -->
<!-- BEGIN: filter section -->
<filter>
<filter-name>ReviewAuthenFilter</filter-name>
<filter-class>com.adobe.xmtech.review.BeamAuthenticationFilter</filter-class>
</filter>
<!-- END: filter section -->
<!-- BEGIN: filter-mapping section -->
<filter-mapping>
<filter-name>ReviewAuthenFilter</filter-name>
<servlet-name>ReviewHandler</servlet-name>
</filter-mapping>
<!-- END: filter-mapping section -->
<!-- BEGIN: servlet section -->
<servlet>
<servlet-name>ReviewHandler</servlet-name>
<servlet-class>com.adobe.review.ReviewHandler</servlet-class>
<init-param>
<param-name>AcrobatFeedback</param-name>
<param-value>none</param-value> <!-- console, alert, none -->
</init-param>
<init-param>
<param-name>FDFLogging</param-name>
<param-value>file</param-value> <!-- file, none -->
</init-param>
</servlet>
<servlet>
<servlet-name>Image</servlet-name>
<servlet-class>com.adobe.review.util.ImageServer</servlet-class>
</servlet>
<servlet>
<servlet-name>Precompile</servlet-name>
<servlet-class>com.adobe.review.util.Precompile</servlet-class>
</servlet>
<servlet>
<servlet-name>Login</servlet-name>
<servlet-class>com.adobe.xmtech.review.Login</servlet-class>
</servlet>
<servlet>
<servlet-name>Logout</servlet-name>
<servlet-class>com.adobe.xmtech.review.Logout</servlet-class>
</servlet>
<servlet>
<servlet-name>FetchPDF</servlet-name>
<servlet-class>com.adobe.review.beam.misc.FetchPDF</servlet-class>
</servlet>
<!-- END: servlet section -->
<!-- BEGIN: servlet-mapping section -->
<servlet-mapping>
<servlet-name>Image</servlet-name>
<url-pattern>/acrobat/img/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Precompile</servlet-name>
<url-pattern>/acrobat/jsp/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Login</servlet-name>
<url-pattern>/acrobat/misc/Login</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Logout</servlet-name>
<url-pattern>/acrobat/misc/Logout</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FetchPDF</servlet-name>
<url-pattern>/acrobat/misc/FetchPDF/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ReviewHandler</servlet-name>
<url-pattern>/acrobat/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ReviewHandler</servlet-name>
<url-pattern>*.fdf</url-pattern>
</servlet-mapping>
<!-- END: servlet-mapping section -->
<!-- BEGIN: session-config section -->
<session-config>
<session-timeout>86400</session-timeout>
</session-config>
<!-- END: session-config section -->
<!-- BEGIN: mime-mapping section -->
<mime-mapping>
<extension>pdf</extension>
<mime-type>application/pdf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>fdf</extension>
<mime-type>application/fdf</mime-type>
</mime-mapping>
<!-- END: mime-mapping section -->
<!-- BEGIN: welcome-file-list section -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
</welcome-file-list>
<!-- END: welcome-file-list section -->
<!-- BEGIN: error-page section -->
<!-- END: error-page section -->
<!-- BEGIN: taglib section -->
<!-- END: taglib section -->
<!-- BEGIN: resource-ref section -->
<!-- krs added for JNDI db connection -->
<resource-ref>
<description>DB Connection</description>
<!-- For JBoss, use java:/jdbc/xmediaDB as the res-ref-name -->
<!-- For Tomcat, use jdbc/xmediaDB as the res-ref-name -->
<res-ref-name>java:comp/env/jdbc/xmediaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- END: resource-ref section -->
<!-- BEGIN: security-constriaint section -->
<!-- END: security-constriaint section -->
<!-- BEGIN: login-config section -->
<!-- END: login-config section -->
<!-- BEGIN: security-role section -->
<!-- END: security-role section -->
<!-- BEGIN: env-entry section -->
<!-- END: env-entry section -->
<!-- BEGIN: ejb-ref section -->
<!-- END: ejb-ref section -->
</web-app> -
Conecting to mysql database Connection reset by peer
hi guys,
I have to connec to sever where , from this place i need to contact a remote database , the databse is behind a firewall , they database in their intranet ,they have give me a valid ip , they have a conection between the valid ip and the intranet system , they give me access to the port in the fire wall , i asked for the port 3306 (mysql default ) port , and tried connecting it but i get exception, should i need to get the 80 port for connection??? please help
java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Connection reset by peer: Connection reset by peer ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Connection reset by peer: Connection reset by peer STACKTRACE: java.net.SocketException: Connection reset by peer: Connection reset by peer at java.net.SocketInputStream.socketRead(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:86) at java.io.BufferedInputStream.fill(BufferedInputStream.java:186) at java.io.BufferedInputStream.read1(BufferedInputStream.java:225) at java.io.BufferedInputStream.read(BufferedInputStream.java:280) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1391) at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1413) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1782) at com.mysql.jdbc.Connection.(Connection.java:450) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:199) at org.apache.jsp.store$jsp._jspService(store$jsp.java:107) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java: 201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551) at java.lang.Thread.run(Thread.java:484) ** END NESTED EXCEPTION **yeahman i feel the same, but i need to prove them they need to do some work , for that i should show thm its not my problem , can u tell me how the jdbc connector works,or any other way telling them , the port not opened still , how will the server pass the request to the database , some one please help me
-
Cannot establish mysql database connection with j2ee application
Hello All,
I started studying J2EE technology about a month back. I have this simple application involving a couple of servlets and jsps. The code is from a reliable source , so I know that there is nothing wrong with the prog code. Now the code uses a simple database, where I am stuck! I just can't connect to the database Mysql.
I downloaded Mysql database from the mysql site.
I downloaded JDBC driver for mysql from the same site.
Can somebody please tell me which files(from the driver that I downloaded) have to be unzipped to jar files to be set in the class location?
Any help is highly appreciated.
Thanks
Starting WithJ2EEHello All,
I started studying J2EE technology about a month back. I have this simple application involving a couple of servlets and jsps. The code is from a reliable source , so I know that there is nothing wrong with the prog code. Now the code uses a simple database, where I am stuck! I just can't connect to the database Mysql.
I downloaded Mysql database from the mysql site.
I downloaded JDBC driver for mysql from the same site.
Can somebody please tell me which files(from the driver that I downloaded) have to be unzipped to jar files to be set in the class location?
Any help is highly appreciated.
Thanks
Starting WithJ2EE -
MySQL database connections supported?
Hi,
I am trying to connect to mysql database using the 'write to database' and 'query database' activities of utilities.
I have used it successfully for MS SQL but am not able to work with MySQL. I have created the ODBC connection to MySQL database and am able to successfully test connection to mysql database from the 'odbc datasource administrator' window of administrative
tools.Also able to retrieve the databse names in this window.
However when I run the write to DB activity to use this ODBC connection, i get the below error (tkt is the name of the 'table').
Database error has occurred. [MySQL][ODBC 5.3(a) Driver][mysqld-5.6.21]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''tkt'' at line 1
Code = 80040e14
Code meaning = IDispatch error #3092
Source = Microsoft OLE DB Provider for ODBC Drivers
Description = [MySQL][ODBC 5.3(a) Driver][mysqld-5.6.21]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''tkt'' at line 1
Any compatibility issues or anything else?Hello,
I can reproduce the issue with exactly the same error code. Query database ran without problem except write to database. I also tried to use SQL server instead, and it succeeded.
I saw the same error with SQL server at first because I used the wrong database. So I’m not sure if we need additional implement with MySQL.
As suggested, run the same task with script should be a good workaround.
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] -
Keeping Database-Connection over several JSPs
Hi all,
when creating a database-connection (Oracle 8.x) with JDBC 2, Tomcat Engine, I encountered the problem, that the connection has been lost after forwarding to another JSP.
What I read from some other forums, there seem to be 2 major ways of how to keep the connection:
- session vars
- connection pool
I feel for our project session will be a approbiate solution, so can you tell me more about it (technical implementation)???
Thanks & Rgds.,
Raineryou have to declare a bean variable with session scope, like this:
jsp:useBean id="object-name"
scope="session"
type="type-of-object"
class="fully-qualified-classname"
beanName="fully-qualified-beanName"
/>
for more infos see (for example) http://www.stardeveloper.com/articles/display.html?article=2001072001&page=1
Maybe you are looking for
-
Beats Per Minute?! How do I get it less than 60 BPM?
Hello everyone, I have a G3 iBook that can create GB tunes at 40 BPM. However, having just installed GB on my newly aquired G4 Tower, it can't go lower than 60 BPM. How do I get this down lower? Thanks, Dave
-
Hi, I just have a scenario in my universe designer , when I Join the table as per my requirement I'm getting the below scenario, well my Question about the same is when we join like this we'll get " converging Join path issue", IN the image shown
-
I have a Catalyst 6509 with supervisor 720-3B and IOS 12.2(17d)SXB10. I have installed a X6704 4 port 10Gb card in slot 1 and powered up the system. The X6704 is recognised but is powered off with a message stating that it is not supported. Using sho
-
How I can to resize grouped object using absolute dimensions? I tried that but I'm newbie into Applescript tell active document tell group items "<gruppo>" of layer 1 of page 1 set absolute horizontal scale to 55 as real end tell end tell
-
Mdimportserver crashed - can anyone help please?
Hello folks, I noticed that my mdimportserver crashed recently and I was wondering if there is anything I can do to fix it. Here are two examples showing that it happened under OS 10.4.8 and OS 10.4.11: Host Name: users-computer-2 Date/Time: 2008-12-