JDBC Realm help
Hi,
I have been trying to get the JDBC Realm to work, but with no success,
I get the following error:
Catalina.start: LifecycleException: Exception opening database connection: java.sql.SQLException
LifecycleException: Exception opening database connection: java.sql.SQLException
(see bottom of page for more detail)
I have successfully connected to the database and retrieved data using the following code
// Define the JDBP Driver and the database connection URL
public static final String driver = "org.gjt.mm.mysql.Driver";
public static final String url = "jdbc:mysql://localhost/db?user=un&password=pw";
public static void main(String args[])
Connection conn;
try
Class.forName(driver); // load the driver dynamically
conn = DriverManager.getConnection(url); // connect to the database
// perform a query. first create a Statement object from the connection
Statement select = conn.createStatement();
// next execute a query (SQL string) and return the results in a ResultSet object
ResultSet result = select.executeQuery("select * from users");
// print out the results
while(result.next())
String user = result.getString("user_name"); // note these match the columns in the
String password = result.getString("user_pass"); // SELECT statement
System.out.println(user + " " + password);
select.close(); //Close the query
conn.close(); //Close the database connection
however I have no luck in connecting using the JDBC Realm, I am using j2re1.4.1_01, jwsdp-1_0_01 & mysql-connector-java-3.1.0-alpha and the com & org directories are in $JWSDP_HOME/common/lib/ I have also put a copy of the mysql-connector-java-3.1.0-alpha.jar in $JWSDP_HOME/server/lib/ in an effort to get this to work!!
my $JWSDP_HOME/conf/server.xml contains
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driver="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost/db?user=un;password=pw"
userTable="users" usserNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
I hope someone can shed some light on this as I have been reading a lot of threads about this however they all seem to have the driver name included in the Exception error and I don't get that in the error message, so I am assuming that the driver is working and there is another error.....
Cheers in advance
Contentents of $JWSDP_HOME/logs/catalina.outStarting service Internal Services
Java Web Services Developer Pack/1.0_01-fcs
Catalina.start: LifecycleException: Exception opening database connection: java.sql.SQLException
LifecycleException: Exception opening database connection: java.sql.SQLException
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:683)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1175)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at org.apache.catalina.core.StandardService.start(StandardService.java:499)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.launcher.Launcher.main(Launcher.java:208)
----- Root Cause -----
java.sql.SQLException
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:606)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:681)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1175)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:347)
at org.apache.catalina.core.StandardService.start(StandardService.java:499)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:2187)
at org.apache.catalina.startup.Catalina.start(Catalina.java:504)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.launcher.Launcher.main(Launcher.java:208)
Stopping service Internal Services
Catalina.stop: LifecycleException: Coyote connector has not been started
LifecycleException: Coyote connector has not been started
at org.apache.coyote.tomcat4.CoyoteConnector.stop(CoyoteConnector.java:1043)
at org.apache.catalina.core.StandardService.stop(StandardService.java:549)
at org.apache.catalina.core.StandardServer.stop(StandardServer.java:2223)
at org.apache.catalina.startup.Catalina.start(Catalina.java:535)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:399)
logs/catalina.out
okayyyy.... now i got ur point. I think its not much
difficult. Lets take it step-by-step.
That's what I thought and it's still not working .....
As a first step, you have to create 3 tables in your
mySql database for authentication purposes. Lets name
those tables: (1) user, (2) roles (3) user_roles.
'user' will contain fields regarding user name and
password, 'roles' will contain only 1 field specific
to role names and finally 'user_roles' is a mapping
table which contain user names and their
corresponding role names (obviously from 'roles'
table). This completes the database in mySQL that
will help you to authenticate your users.
I have added the roles table, not that they are referenced in the JDBC Realm connector ????
>
Now, its time to configure your web container, i.e.
Tomcat to use this database (in terms of JDBCRealm).
Make sure that tomcat services are stopped and then
open server.xml file in any ANSII compliant editor.
Search for any real tag (<Realm ... ) already placed
in your xml file. If there would be any, then you
should find under the <Engine> tag. Now place your own
<Realm> tag under the <Engine> tag.
It should be something like:
<Realm className="org.apache.catalina.realm.JDBCRealm"
debug="99"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost:3306/tomcatusers"
connectionName="root"
connectionPassword=""
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name"/>
Yup already done... now slightly modified
>
Plz double check "connectionName" and
"connectionPassword" attributes to match your own
user-name and passwords for your mySql db. This will
complete the whole process, just start your Tomcat
services again and see if that work. I hope it will
help you, plz must tell me about progress -:)
Raheel.
mysql -u tomcat -p
mysql> select a.user_name, b.role_name from users a, user_roles b
-> where a.user_name=b.user_name;
----------------------+
| user_name | role_name |
----------------------+
| daren | employee |
| tomcat | admin |
| tomcat | manager |
| tomcat | provider |
----------------------+
can you guess what happened????
IT DONT WORK :(
Similar Messages
-
Tomcat JDBC Realm Database Connection Error
Hello all,
I am trying to edit the server.xml file on Tomcat so I can use the JDBC Realm instead of the MemoryRealm. Hence, I will be able to read users, passwords and roles from a relational database instead of from the tomcat-users.xml.
I have tried following all the guides on the net I can find, my server.xml looks as follows (after making changes to allow it to use JDBC realm). The only problem is, when I try to run the application the server outputs the following: (after all of these errors have been kicked up a pop-up box then appears titled "Tomcat Manager Application", it asks for a User Name and Password. I have tried the standard user name of "ide" and the password next to it in tomcat-users.xml but it won't accept it. (I am using the netbeans IDE)).
Please could someone suggest any ideas of how I can get the server.xml to work with JDBC realm?
Using CATALINA_BASE: C:\Documents and Settings\Administrator\.netbeans\5.0beta\jakarta-tomcat-5.5.7_base
Using CATALINA_HOME: C:\Program Files\netbeans-5.0beta\enterprise2\jakarta-tomcat-5.5.7
Using CATALINA_TMPDIR: C:\Documents and Settings\Administrator\.netbeans\5.0beta\jakarta-tomcat-5.5.7_base\temp
Using JAVA_HOME: C:\j2sdk1.4.2_08
Created MBeanServer with ID: 1f934ad:107444b1d2b:-8000:ravinder-rdnzoa:1
31-Oct-2005 01:29:33 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
31-Oct-2005 01:29:34 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
31-Oct-2005 01:29:34 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2174 ms
31-Oct-2005 01:29:34 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
31-Oct-2005 01:29:34 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.7
31-Oct-2005 01:29:34 org.apache.catalina.realm.JDBCRealm start
SEVERE: Exception opening database connection
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:646)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:720)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1003)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:440)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
31-Oct-2005 01:29:34 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
31-Oct-2005 01:29:36 org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name IBM used in an <auth-constraint> without being defined in a <security-role>
31-Oct-2005 01:29:36 org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name Auditor used in an <auth-constraint> without being defined in a <security-role>
31-Oct-2005 01:29:37 org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
31-Oct-2005 01:29:37 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
31-Oct-2005 01:29:37 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
31-Oct-2005 01:29:38 org.apache.catalina.startup.ContextConfig validateSecurityRoles
INFO: WARNING: Security role name IBM used in an <auth-constraint> without being defined in a <security-role>
31-Oct-2005 01:29:38 org.apache.struts.tiles.TilesPlugin initDefinitionsFactory
INFO: Tiles definition factory loaded for module ''.
31-Oct-2005 01:29:38 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validator-rules.xml'
31-Oct-2005 01:29:38 org.apache.struts.validator.ValidatorPlugIn initResources
INFO: Loading validation rules file from '/WEB-INF/validation.xml'
31-Oct-2005 01:29:39 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8084
31-Oct-2005 01:29:39 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
31-Oct-2005 01:29:40 org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
31-Oct-2005 01:29:40 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/60 config=null
31-Oct-2005 01:29:40 org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
31-Oct-2005 01:29:40 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5738 ms
31-Oct-2005 01:29:40 org.apache.catalina.realm.JDBCRealm authenticate
SEVERE: Exception performing authentication
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:646)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:344)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
31-Oct-2005 01:29:40 org.apache.catalina.realm.JDBCRealm authenticate
SEVERE: Exception performing authentication
java.sql.SQLException: org.gjt.mm.mysql.Driver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:646)
at org.apache.catalina.realm.JDBCRealm.authenticate(JDBCRealm.java:344)
at org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:181)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:446)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)The server.xml looks as follows:
<?xml version="1.0" encoding="UTF-8"?>
<!-- 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="8025" shutdown="SHUTDOWN">
<!-- Comment these entries out to disable JMX MBeans support used for the
administration web application -->
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<!-- 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 -->
<!-- RAV
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
-->
</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="Catalina">
<!-- 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 5 documentation bundle for more detailed
instructions):
* If your JDK version 1.3 or prior, 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 HTTP/1.1 Connector on port 8080 -->
<Connector port="8084" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" URIEncoding="utf-8"/>
<!-- Note : To disable connection timeouts, set connectionTimeout value
to 0 -->
<!-- Note : To use gzip compression you could set the following properties :
compression="on"
compressionMinSize="2048"
noCompressionUserAgents="gozilla, traviata"
compressableMimeType="text/html,text/xml"
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
<Connector port="8443"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" enableLookups="false" redirectPort="8443" protocol="AJP/1.3"/>
<!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
<!-- See proxy documentation for more information about using this. -->
<!--
<Connector port="8082"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" acceptCount="100" connectionTimeout="20000"
proxyPort="80" disableUploadTimeout="true" />
-->
<!-- 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). -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">
-->
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">
<!-- 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.4
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"/>
-->
<!-- 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. -->
<!-- RAV
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" 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"
driverName="org.gjt.mm.mysql.Driver"
connectionURL="jdbc:mysql://localhost:3306/tomcatusers"
connectionName="root" connectionPassword="sikhism1"
userTable="users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="user_roles" roleNameCol="role_name" />
<!--
<Realm className="org.apache.catalina.realm.JDBCRealm"
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"
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
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" xmlValidation="false" xmlNamespaceAware="false">
<!-- Defines a cluster for this node,
By defining this element, means that every manager will be changed.
So when running a cluster, only make sure that you have webapps in there
that need to be clustered and remove the other ones.
A cluster has the following parameters:
className = the fully qualified name of the cluster class
name = a descriptive name for your cluster, can be anything
mcastAddr = the multicast address, has to be the same for all the nodes
mcastPort = the multicast port, has to be the same for all the nodes
mcastBindAddr = bind the multicast socket to a specific address
mcastTTL = the multicast TTL if you want to limit your broadcast
mcastSoTimeout = the multicast readtimeout
mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat
mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received
tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes
tcpListenAddress = the listen address (bind address) for TCP cluster request on this host,
in case of multiple ethernet cards.
auto means that address becomes
InetAddress.getLocalHost().getHostAddress()
tcpListenPort = the tcp listen port
tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS
has a wakup bug in java.nio. Set to 0 for no timeout
printToScreen = true means that managers will also print to std.out
expireSessionsOnShutdown = true means that
useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.
false means to replicate the session after each request.
false means that replication would work for the following piece of code: (only for SimpleTcpReplicationManager)
<%
HashMap map = (HashMap)session.getAttribute("map");
map.put("key","value");
%>
replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.
* Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.
* Synchronous means that the thread that executes the request, is also the
thread the replicates the data to the other nodes, and will not return until all
nodes have received the information.
* Asynchronous means that there is a specific 'sender' thread for each cluster node,
so the request thread will queue the replication request into a "smart" queue,
and then return to the client.
The "smart" queue is a queue where when a session is added to the queue, and the same session
already exists in the queue from a previous request, that session will be replaced
in the queue instead of replicating two requests. This almost never happens, unless there is a
large network delay.
-->
<!--
When configuring for clustering, you also add in a valve to catch all the requests
coming in, at the end of the request, the session may or may not be replicated.
A session is replicated if and only if all the conditions are met:
1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND
2. a session exists (has been created)
3. the request is not trapped by the "filter" attribute
The filter attribute is to filter out requests that could not modify the session,
hence we don't replicate the session after the end of this request.
The filter is negative, ie, anything you put in the filter, you mean to filter out,
ie, no replication will be done on requests that match one of the filters.
The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.
filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI
ending with .gif and .js are intercepted.
The deployer element can be used to deploy apps cluster wide.
Currently the deployment only deploys/undeploys to working members in the cluster
so no WARs are copied upons startup of a broken node.
The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"
When a new war file is added the war gets deployed to the local instance,
and then deployed to the other instances in the cluster.
When a war file is deleted from the watchDir the war is undeployed locally
and cluster wide
-->
<!--
<Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
managerClassName="org.apache.catalina.cluster.session.DeltaManager"
expireSessionsOnShutdown="false"
useDirtyFlag="true"
notifyListenersOnReplication="true">
<Membership
className="org.apache.catalina.cluster.mcast.McastService"
mcastAddr="228.0.0.4"
mcastPort="45564"
mcastFrequency="500"
mcastDropTime="3000"/>
<Receiver
className="org.apache.catalina.cluster.tcp.ReplicationListener"
tcpListenAddress="auto"
tcpListenPort="4001"
tcpSelectorTimeout="100"
tcpThreadCount="6"/>
<Sender
className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"
replicationMode="pooled"
ackTimeout="15000"/>
<Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
<Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
</Cluster>
-->
<!-- 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" />
-->
<!-- 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"/>
-->
<!-- 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.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
-->
<!--
<Valve className="org.apache.catalina.valves.FastCommonAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
<!-- 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.
This access log implementation is optimized for maximum performance,
but is hardcoded to support only the "common" and "combined" patterns.
This valve use NIO direct Byte Buffer to asynchornously store the
log.
-->
<!--
<Valve className="org.apache.catalina.valves.ByteBufferAccessLogValve"
directory="logs" prefix="localhost_access_log." suffix=".txt"
pattern="common" resolveHosts="false"/>
-->
</Host>
</Engine>
</Service>
</Server>Many thanks, and apologies for "dumping" all of the code here.So looking through the java api docs, I found that the tcUtilJDBCOperations has a connect string for the database. Below is the info it outlines. The questions I have it this. How do you specify the psdriver and URL along with do I need to do this as a persistent instance then add my selectstatement as a part of this or can I just specify this and the select statement will use this connection? Any help you can give would be appreciated.
tcUtilJDBCOperations
public tcUtilJDBCOperations(java.lang.String psDriver,
java.lang.String psUrl,
java.lang.String psUsername,
java.lang.String psPassword)Contructor that sets the parameters for connecting to a database
Parameters:
psDriver - The class name of the jdbc driver
psUrl - The URL of the database
psUsername - The username required to access the database
psPassword - The password for the above username
Nick -
JDBC realm of FORM authentication in Web AS 640
Hi, All,
We try to port a web application from Apache Tomcat to WebAS 6.40. In the application we use FORM authentication based on Tomcat JDBC Realm. The configuration in Tomcat server.xml is like:
<Context...>
<Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource" username="..." password="..." driverClassName="..." url="..."/>
<Realm className="org.apache.catalina.realm.DataSourceRealm" dataSourceName="jdbc/mydb" digest="MD5" userTable="users" userNameCol="userName" userCredCol="passwd" userRoleTable="roles" roleNameCol="roleType"/>
</Context>
In database there are 2 tables for authentication purpose: users and roles. There are column userName, passwd in table users and userName, roleType in table roles (correlated with column userName). Then in web.xml we define FORM authentication:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>...</realm-name>
<form-login-config>
<form-login-page>...</form-login-page>
<form-error-page>...</form-error-page>
</form-login-config>
</login-config>
Has anyone tried to port Tomcat JDBC realm mechanism of FORM authentication to WebAS 640? How do we need to configure J2EE server in Visual Administrator or deploy an application with DeployTool to implement the same features? And does WebAS support declarative MD5 digest algorithm in FORM Authentication?
Any help is highly appreciated.
Thanks in advance
Johnevnafets wrote:
The way it works is that you declare which pages in your application have got security around them in your web.xml. Whenever a user tries to navigate to one of those pages, they are presented with the login screen. If they login successfully, then they are taken to the page they originally requested.
You should never actually have a link to your login page - the container will serve it when required.Ok, but how do i stop them entering the URL of the login page?
i get this error after logging in correctly if i directly access the login page:
"HTTP Status 400 - Invalid direct reference to form login page"
i tried adding this constraint but it still happens:
<security-constraint>
<web-resource-collection>
<web-resource-name>login</web-resource-name>
<url-pattern>/staffLogin/login.jsp</url-pattern>
</web-resource-collection>
<auth-constraint/>
</security-constraint>
>
One possible way around this would be to create a database view which is a union of the two tables, thus giving you one "table" to query for the username/password/role combinations. That should satisfy the realm requirement.
Cheers,
evnafetsThats a good idea, il give that a shot. Thanks. -
hi,Good evening ,this is my First post in sun.com.......
I am trying to provide Form authentication and authorization in my we application (facelets,glashfish).For this I create one sample database with tables user and grouptable and finally created JDBC realm in glassfish server Successfully.
so this authentication and auth with JSP pages I am success fully providing .But i want with .jsf(.xhtml).I am getting struggle in how to call j_security_check from .xhtml page.But this same method I am successfully calling from .jsp(action="j_security_check").so can u please help me how to call j_security_check from .xhtml. page And what is the configuration for displaying success.xhtml and fail.xhtml after click on submit button in login.xhtml
web.xml
<web-app>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.validateXml</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.verifyObjects</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>DEFAULT</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<error-page>
<error-code>403</error-code>
<location>/accesdenaid.jsp</location>
</error-page>
<filter>
<display-name>RichFaces Filter</display-name>
<filter-name>richfaces</filter-name>
<filter-class>org.ajax4jsf.Filter</filter-class>
</filter>
<filter-mapping>
<filter-name>richfaces</filter-name>
<servlet-name>Faces Servlet</servlet-name>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
<welcome-file-list>
<welcome-file>/forward.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/pages/cpdownloader/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>admin</role-name>
</auth-constraint>
<!-- <user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint> -->
</security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Protected Area</web-resource-name>
<url-pattern>/pages/cprequester/*</url-pattern>
<http-method>POST</http-method>
<http-method>GET</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
<!-- <user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint> -->
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<!--<realm-name>default</realm-name>-->
<realm-name>enrollmentsrealm</realm-name>
</login-config>
<security-role>
<role-name>admin</role-name>
</security-role>
<security-role>
<role-name>user</role-name>
</security-role>
</web-app>and login.xhtml
<ui:composition template="/templates/login_layout.xhtml">
<ui:define name="body">
<h:form id="loginForm1">
<table align="center" cellspacing="0" cellpadding="0">
<tr>
<td height="30px"></td>
</tr>
<tr align="center" >
<td align="center" colspan="2" class="pagetitle">Requester Login</td>
</tr>
<tr>
<td height="10px" ></td>
</tr>
<tr>
<td class="labelname">User Name *</td>
<td class="label"><h:inputText id="j_username" value="#{LoginBean.userName}"/>
</td>
</tr>
<tr>
<td class="labelname">Password </td>
<td class="label"><h:inputSecret id="j_password" value="#{LoginBean.password}"/></td>
</tr><br/>
<tr>
<td colspan="2" height="5px" ></td>
</tr>
<tr>
<td> </td>
<td class="buttonsalign">
<h:commandButton id="login1" value="Login" styleClass="buttonstyle" action="#{LoginBean.submit}"/>
</td>
</tr>
<tr>
<td colspan="2" height="25px" ></td>
</tr>
</table>
</h:form>
</ui:define>
</ui:composition>can u please help me where i did mistake
thanks in advanceI am also having problems trying to get an appclient authenticated.
Could someone post a working example app or provide a link to an example ? -
Configuring JDBC Realms and session mangement
Hello All,
I want to provide authentication to my application.
Eg.
There are users in "User" table in my Java DB.
There is home page having login form and other features.
When the user enter his credentials in the login form, his credentials will be checked against the "User" table. iIf the credentials are right then, the next page containing his account information and shopping cart will be displayed and his session ID will be maintained. This session id will be used for other operations performed by this user.
I have achieved the above task easliy with my normal JDBC and JSP,Servlet.
I am learning Securities, and i want to accomplish this task using JDBC Realm with Netbeans IDE. Means Credentials will be checked, Session will be maintined, session id will be tracked and user page(account information and shoping cart) will be displyed.
How to achieve this?
Please help me out with the codes or example.
Please provide me the link if any article is mentioned for the same.
Thans & Regards,
Gaurav Digheok thanks....
but thats what i exacltly need. How to configure Servlet Container and Glassfish server to achieve the task. Second thing is that by doing so i want to achieve the session management. To be precise i want to configure by glassfish server and application for JDBC Realm and then achieve Session management/tracking.
I there any way to achieve this. I am new to Security.
Please help..
Edited by: user8687589 on Jan 27, 2011 11:33 AM -
I have a problem with JDBC Realm in Tomcat/Oracle/Win XP
I have a problem with JDBC Realm in Tomcat.
I have attached my server.xml file located in the
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\server.xml
The Problem is that when I login I get the user name and password prompt but it does not resolve.
When I enter in the tomcat-users.xml password with memory realm uncommented it works fine.
C:\Program Files\Apache Software Foundation\Tomcat 5.5\conf\tomcat-users.xml
Is there a cache or something I need to reset for the JDBC Realm to work?
I have attached my tables and contents as well...
Did I miss something????
Thanks
Phil
server.xml
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
<!-- Global JNDI resources -->
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
</GlobalNamingResources>
<!-- Define the Tomcat Stand-Alone Service -->
<Service name="Catalina">
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector
port="8080" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
<!-- Define the top level container in our container hierarchy -->
<Engine name="Catalina" defaultHost="localhost">
<!--
<Realm className="org.apache.catalina.realm.MemoryRealm" />
-->
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="oracle.jdbc.driver.OracleDriver"
connectionURL="jdbc:oracle:thin:@localhost:1521:orcl"
connectionName="testName" connectionPassword="testPass"
userTable="users"
userNameCol="user_name"
userCredCol="user_pass"
userRoleTable="user_roles"
roleNameCol="role_name" />
<!-- Define the default virtual host
Note: XML Schema validation will not work with Xerces 2.2.
-->
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>
Tables
create table users
user_name varchar(15) not null primary key,
user_pass varchar(15) not null
create table roles
role_name varchar(15) not null primary key
create table user_roles
user_name varchar(15) not null,
role_name varchar(15) not null,
primary key( user_name, role_name )
select * from users;
----------------------+
| user_name | user_pass |
----------------------+
| tomcat | tomcat |
| user1 | tomcat |
| user2 | tomcat |
| user3 | tomcat |
----------------------+
select * from roles;
| role_name |
| tomcat |
| role1 |
select * from user_roles;
-----------------------+
| role_name | user_name |
-----------------------+
| tomcat | user1 |
| role1 | user2 |
| tomcat | tomcat |
| role1 | tomcat |
-----------------------+Jan 2, 2008 11:49:35 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jan 2, 2008 11:49:35 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 734 ms
Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
Jan 2, 2008 11:49:35 AM org.apache.catalina.realm.JDBCRealm start
SEVERE: Exception opening database connection
java.sql.SQLException: oracle.jdbc.driver.OracleDriver
at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:684)
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:758)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1004)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Jan 2, 2008 11:49:35 AM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jan 2, 2008 11:49:36 AM org.apache.catalina.core.StandardContext resourcesStart -
JDBC Realm issue on Tomcat 4.0.1
Hi folks,
Tried this one the Sun forum and haven't had luck yet getting a thorough reply.
Trying to establish the JDBC realm config in Tomcat and am getting the following error:
Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
Catalina.start: LifecycleException: Exception opening database connection: jav
a.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too long
LifecycleException: Exception opening database connection: java.sql.SQLExcepti
on: [Microsoft][ODBC Driver Manager] Data source name too long
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)
my configuration in the web.xml file is as follows;
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:DSNname@host_string:1521:ORCL?user=user_name;password=pwd_name"
userTable="chg_users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="chg_users_roles" roleNameCol="role_name" />
does the above appear incorrect? If so, specifically how?
Thanks!connectionURL="jdbc:odbc:CATALINA"
in this case, where is CATALINA supposedly pointing
to a DB connection? I don't have mine set, save for
maybe the classpath, but why would you point the
connURL through jdbc:odbc to CATALINA?
That is the name of a DNS. The ODBC shell (nothing to do with java) has DNS names. The shell uses the passed in name to look up the attributes associated with the name.
If you were using a DNS-less name then you would have to specify ODBC driver (nothing to do with java) and the associated attributes for that driver in the connection string.
I'm a little confused by this. Any explanation would
be great, as I have a driver that is jdbc:odbc,
rather than an exclusive Oracle driver.
Well, I've got the ojdbc14_g.jar file. But that's not
exclusively Oracle, correct? Just for JDBC with
Oracle?
A jdbc driver lives somewhere. The bridge driver lives in the Sun VM. The Oracle driver lives in a jar (current ones.)
The bridge driver talks to ODBC (which is outside of java.)
The oracle drivers talk to oracle databases. -
Does AS8 will support JDBC Realms?
Hi there,
In the future, will AS8 support JDBC Realms? In Windows platform, other realms are difficult to implement, specially LDAP.
Do you know where I can get (maybe lucky if) a step by step guide to realms installation?
Thank you very much,
Blessings,
Lorenzo JimenezDear bsankararao:
Thanks for you concern.
Creating a new realm is to much for my knowledge.
Maybe in the next version, Sun will include it? Just to be sort of equal or better than Tomcat!
Thanks,
Lorenzo -
Hi,
Was trying use third party(Caucho) jdbc type 4 driver for MySQL. I updated the
jdbcdrivers.xml to include the details for the new driver. However, when using
Config wizard, how (or where) do i provide a JDBC url helper class, so that the
config wizard can connect the database using the jdbc url?
Amit.Amit wrote:
Joe Weinstein <[email protected]> wrote:
Actually, all you need to do is get the driver you want into the weblogic
classpath, and then tell the pool the class name you want for the driver,
and give it the URL and properties it needs.
Joe
Hi. In order to implement a custom default, you would need to have
a URLHelper class, as the other entries refer. I don't know that we
offer a way to create Defaults, but you should be able to create a pool
from the console by specifically typing in the class name and the URL.
Is that not true?
Joe
>
>
Thanks Joe,
But i wanted to see the jdbc url changed in the config wizard screen (as pointed
in the pic). Caucho jdbc driver has url like "jdbc:mysql-caucho://hostname:port/database".
Others mysql drivers have url like "jdbc:mysql://hostname:port/database. So where
exactly could i tweek that property, since all that is editable is hostname, port,
and database? -
Does OC4J has a JDBC realm ? can some one clearify ?
Hi
Thank you for reading my post
does Oracle application server 10.1.3.1.0 (the new developer preview version) has JDBC realm ?
where i can find it?
thanksHi,
A Realm is a collection of resources that are controlled by a defnied policy. You can use JNDI to lookup OC4J realms.
I think you are referring to the DataSources in OC4J. You can get more information about DataSources at this link :-
http://download-east.oracle.com/docs/cd/B25221_04/web.1013/b14427/datasrc.htm#sthref407
Regards,
Sandeep -
Authentificaton - JDBC realm & Form Based in Jdeveloper 10.1.3 and OCJ4
Dear Partners:
Being new working with Jdeveloper 10.1.3 and embedded OC4J,
I'm migrating an application from Tomcat and trying to
setup authentication for my JSP pages: JDBC realm and Form Based.
I succeeded only adding the security constraint to
the application's server.xml file, and creating the
user and user's roles tables. Yet, I got lost
by using the Jdeveloper's menu option Tools->OC4J embedded
OC4J server preferences.
Any documentation or examples are appreciated.
Thank you.Waheed - we aren't satisfied with our device coverage for mobile devices, hence we're focusing our efforts on Telnet/PDA and working with partners for ADF support for the broader class of mobile devices. Please send me an email or give me a call with any questions ([email protected], +1-408-687-8185).
-Indu -
Setting a JDBC Realm using the Tomcat Administration tool
Is it possible to do it? I got a hosting where i cant get to the server.xml, so i would need to set my JDBC Realm using the Admin tool.
Thanks Batsupbump
-
Need help configuring JDBC Realm on Tomcat 4.0.1
I'm getting the following error:
(from DOS prompt)
Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
Catalina.start: LifecycleException: Exception opening database connection: jav
a.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name too long
LifecycleException: Exception opening database connection: java.sql.SQLExcepti
on: [Microsoft][ODBC Driver Manager] Data source name too long
at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108)Here's my attempted configuration:
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
driverName="sun.jdbc.odbc.JdbcOdbcDriver"
connectionURL="jdbc:odbc:DSNname@host_string:1521:ORCL?user=user_name;password=pwd_name"
userTable="chg_users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="chg_users_roles" roleNameCol="role_name" />Any help would be appreciated!
Thanks!connectionURL="jdbc:odbc:CATALINA"
in this case, where is CATALINA supposedly pointing
to a DB connection? I don't have mine set, save for
maybe the classpath, but why would you point the
connURL through jdbc:odbc to CATALINA?
That is the name of a DNS. The ODBC shell (nothing to do with java) has DNS names. The shell uses the passed in name to look up the attributes associated with the name.
If you were using a DNS-less name then you would have to specify ODBC driver (nothing to do with java) and the associated attributes for that driver in the connection string.
I'm a little confused by this. Any explanation would
be great, as I have a driver that is jdbc:odbc,
rather than an exclusive Oracle driver.
Well, I've got the ojdbc14_g.jar file. But that's not
exclusively Oracle, correct? Just for JDBC with
Oracle?
A jdbc driver lives somewhere. The bridge driver lives in the Sun VM. The Oracle driver lives in a jar (current ones.)
The bridge driver talks to ODBC (which is outside of java.)
The oracle drivers talk to oracle databases. -
Proxies to jdbc scenario help...!
Dear All,
I am very new to XI , can anyone guide me step by step process for
1. File to webservice scenario via xi
2. Proxies to jdbc scenario via xi
3.IDOC to JDBC scenario via xi
will be much helpful as i need to complete these processes very soon.
Thanks in Advance.HI,
Here are the documents:
Webservice scenario:
these 3 documents should explain it all,
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/befdeb90-0201-0010-059b-f222711d10c0
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5f3ee9d7-0901-0010-1096-f5b548ac1555
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/d23cbe11-0d01-0010-5287-873a22024f79
troubleshooting SOAP:
/people/varadharajan.krishnasamy/blog/2007/01/09/troubleshooting-soap-message--xi
IDOC and JDBC Scenarios:
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters --> For Idoc sender: IDOC -file
/people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
IDOC configuration :
Refer the help:
/people/swaroopa.vishwanath/blog/2007/01/22/ale-configuration-for-pushing-idocs-from-sap-to-xi - ALE settings for R3-XI
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e07dcaa0-a92b-2a10-3a96-b3d942bd1539
Idoc to File:
/people/prateek.shah/blog/2005/06/08/introduction-to-idoc-xi-file-scenario-and-complete-walk-through-for-starters
This is expalined both the scenarios:
Please follow the below process for configuration:
Pre-requisites for Inbound IDoc to R/3 from PI:
Configuration required at Xi side:
Go to IDX1: configure the port.
Go to IDX2: load the DOC metadata.
Go to SM59: Create RFC destination which points to R3 system this is require in the case where your IDOC is sent to R 3 system,
Configiration required at R3 side:
Maintain Logical System for PI (SALE transaction):
Maintain Partner Profile for XI system(WE20):
Pre-requisites for Outbound IDoc from R/3 to PI:
Configurations required in R/3:
Maintain Logical System (SALE)
Define RFC Destination (SM59) which points to PI system
Maintain Port (WE21)
Maintain partner profile. (WE20):
Maintain Distribution Model (BD64):
JDBC:
Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
Writing Stored Procedures-
/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
http://www.ics.com/support/docs/dx/1.5/tut6.html
/people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
http://www.ics.com/support/docs/dx/1.5/tut6.html
http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
http://www.sqlteam.com/article/stored-procedures-an-overview
Proxy:
Client Proxy:
/people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
Server Proxy:
/people/siva.maranani/blog/2005/04/03/abap-server-proxies
Smarter Approach for coding ABAP Proxies
/people/sravya.talanki2/blog/2006/07/28/smarter-approach-for-coding-abap-proxies
File to Inbound Proxy:
/people/prateek.shah/blog/2005/06/14/file-to-r3-via-abap-proxy
How do you activate ABAP Proxies?
/people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
Debugging Inbound Proxy:
/people/stefan.grube/blog/2006/07/28/xi-debug-your-inbound-abap-proxy-implementation
Thanks and Regards,
Chirag Gohil -
Error with SQLServer-JDBC(PLease Help)
Hello,
I use before Oracle with Java, but it's first time when I use MS SQL Server, and I made this litle programm Just I want to connect to the Data base, and I get error when I run the programm
Here you have the file :
import com.microsoft.jdbc.sqlserver.*;
import java.sql.*;
import java.io.*;
class JDBC_Connect
public static void main(String args[])
Connection connexion = null;
Statement requete = null;
ResultSet resultSet;
int i = 1;
String req1 = "SELECT Name FROM Test";
try
String strClassName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String strUrl = "jdbc:microsoft:sqlserver://localhost:1433;"
+ "user=sa; DatabaseName=VJ";
Class.forName(strClassName);
connexion = DriverManager.getConnection(strUrl);
requete = connexion.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
resultSet= requete.executeQuery(req1);
while(resultSet.next())
System.out.println( resultSet.getString(1));
i++;
catch(ClassNotFoundException e) {
System.err.println("ERREUR : Driver manquant.");
e.printStackTrace();
catch(SQLException se) {
System.out.println("ERREUR SQL : !" + se);
and here you have the Error that I get
ERREUR SQL : ! Java.sql.SQLEXception: [Microsoft][SQLServer 2000 Driver for JDBC]
[SQLServer]Invalid object name 'Test'
and Test is the name of the Table
Please If you have an idea about, response my THread, I really need your Help.
Thanks in advance for your answer.
Best regards.Hi,
1. When i write the connetion string "con1=DriverManager.getConnection("jdbc:microsoft:sqlserver://ServerName:1433;*Database*=dmo1o2d",user,password);
Then give message that Connetion is successful. But i put DatabaseName instead of Databse then give error *"java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Cannot open database requested in login 'testcq'*. Login fails.
2. if i run query like this select * from testcq.sa.test then gives *error "Msg 208, Level 16, State 1, Line 1*
Invalid object name 'testcq.sa.test'." from MS SQL server management studio
tescq is Databse name, sa is loging name in MS SQL server mangement stidio to connet to server. test is table name.
3. if i run query like this select * from testcq.dbo.test then gives all row from MS SQL mangement Studio. But when i rtyr to
run from java code gives erro "j*ava.sql.SQLException: [Microsoft][SQLServer 2000 Driver for*
* JDBC][SQLServer]Invalid object name 'testcq.dbo.test*'.
I don't understand where the problem is. It's either in database or in table...all the code, table,database are fine..
Kindly do needful .....bcoz so many days i m working with this....
Maybe you are looking for
-
How to extract data from RR cluster n B2 cluster for data warehousing.
Hi, Our company wants to make backup of RR cluster and B2 cluster data of all employees. its basically moving all the employee master data to data warehousing. Your suggestions are appreciated. Cheers, Senthil
-
The most systematic analysis of Lumia 800 battery ...
Hi, don’t mean to be arrogant, but I’ve read many threads, forums, posts etc. There are tons of info, someone tried a table, etc. but no one has attempted to summarise the relevant parameters. So here goes: 1. I have a Cyan 800, bought locked a
-
JDEV11G / Database diagram / creating a new table in an existing schema
When you drag the table object from the component palette into an existing diagram linked to a schema, jdev reload each time the list of object contained into the schema even no changes was made into that list. In takes 10-15 seconds in a duo-process
-
Yesterday, the phone was stopped so that I reset it. Unfortunately, most of built-in apps such as setting, call, mp3, itunes, calculator, safari, and etc. were disappeared. How can I solve this problem?
-
Dear all, can anybudy know how can be refresh Producation server to devploment server in database level with warm regard pritpal