Flow of DataSource, Context, ctx.lookup
Im having problem understanding how my web app worked.
Im using this example
http://localhost:8080/tomcat-docs/jndi-datasource-examples-howto.htm
i started to change the names in the server.xml, web.xml and DBTest.java for my own web application.
My question is are the following correct places to look at/change to make the connection work? Is there anything i missed?
server.xml
<Context path=................
<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" />
<ResourceParams name="jdbc/TestDB">
web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
DBTest.java
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
Changing TestDB to something else.
yes. this is the correct sequence. got it working finally.
Similar Messages
-
JDBC2 use of ctx.lookup
Hi,
Is it possible to connect to an Oracle 8.1.6 database through the Datasource class? E.g. something like this:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("jdbc/EmployeeDB");
Connection con = ds.getConnection("myPassword", "myUserName");
Cheers
Lars Fastrup
nullhi,
Look up should be like this as given below:
Context ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/cnv/jdbc/EmployeeDB");
Connection con = ds.getConnection();
In the "jdbc/EmployeeDB", we have to mention the user id and password.
ok
null -
JNDI NameNotFoundException on ctx.lookup in WLS 6.1
Hi dear all
When deploying several entity beans in WLS 6.1 we always get a
NameNotFoundException on the ctx.lookup for each bean. The JNDI name is
defined (for every bean) in the IDE and also available in the WLS console
(i.e. also in the deployment descriptor).
Calling the ctx.lookup on the JNDI name for a DataSource defined in WLS does
not raise an NameNotFoundException but a ClassCastException on the following
"narrow" method (a DataSource object is not a bean --> so the WLS/VM runtime
environment works right).
Obviously, the JNDI names for the beans can not be determined/found
correctly because of a deployment/version problem?!
We're using JBuilder 5.0 and WLS 6.1SP1 on NT 4.0 (might be a/the problem?).
Thx in advance
MarkusThe java:comp/env namespace is specific to each individual component (i.e.,
every component can potentially see a different set of objects with different
names and/or the same objects with different names). For an EJB reference
lookup, I believe that we automatically bind it under java:comp/env/ejb so if
you specify the name of the ejb-ref as MyBeanHome in the ejb-jar.xml file, then
the EJB whose deployment descriptor contains this ejb-ref entry can look up that
referenced bean's home at java:comp/env/ejb/MyBeanHome. When you specify the
JNDI name under which a bean will be deployed, we do not automatically make that
bean home available to other beans in their respective java:comp/env/ejb
namespaces (though they are accessible via the global JNDI name used to register
the bean). To get this, you must create the ejb-ref entries and their
corresponding ejb-reference-description entries in the deployment descriptors.
Hope this helps,
Robert
Programit wrote:
Ditto. I'm experiencing the same problem.
I've spent a great deal of time working with this stuff. I believe Weblogic
is lacking in their support here. It's obvious that something isn't working
correctly, because everything was working fine before I installed WLS6.1
with SP1. In fact, I have two systems running right now: The code and
deployment descriptors are exactly the same. The System works fine in
WLS6.1. The System does NOT work in WLS6.1 SP1 becuase of these damn Naming
issues.
We've deployed with the BEA RDBMS Security Realm -- without modification.
Other than that, everything else is pretty standard. The JNDI tree on the
Weblogic console doesn't work either. It says it can resolve "comp"!!!!
"kefah Seyed" <[email protected]> wrote in message
news:[email protected]...> Hi Markus
I send this message because I have the same
problem with JNDI. My envirronment is the
same : I'm under nt 4.0 with weblogic 6.1
but I use Together 5.5 and I tried to deploy manually the EJB.
But it's always the same error.
I tried under WebSphere and with a name
like "java:comp/env/ejb-name" it work.
So I tried all I could if you have a solution now please send me amessage. -
Ctx.lookup to access Portal System in EP
I have defined a new JDBC System in System Administration --> System Configuration on EP
I want to be able to access it in a JSPDyn page.
I know I can access a jdbc database via the JDBC Connector However I would like to take advantage of the UserMapping in the Portal System configuration.
Can anyone help with this issue?
I thought something like this would work but it is not
ctx = new InitialContext();
ds = (DataSource) ctx.lookup("jdbc/PLM_DB");
conn = ds.getConnection();
conn.setAutoCommit(false);
PLM_DB is defined in the Portal not in the J2EE Visual Administrator.
Thanks in advance for you help.
Rick LairdHi Rick,
You have to use JCA to connect to database system you have defined in your portal. Do a search on JCA and database and you should find plenty of example.
regards,
prakash -
Why ctx.lookup(name) differenct bw sessionbean and entityBean for DBconnec
i want to get dbconnection other than entity bean, in entity bean,
the connection is got from the datasource, which built under the clause as
String dbName = "java:comp/env/jdbc/CustomerDB";
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName);
however, the "dbName" is different completely from session bean processing,
it has to be
String dbName = "jdbc/Cloudscape";
my question is :
why the same context object, has to use different key to get the same DataSource
object?
thanks for tips
best regards,
Frederick Van TaGeroYou can access env. in two ways
1.
// Obtain the enterprise bean�s environment naming context.
Context initCtx = new InitialContext();
Context ic= (Context)initCtx.lookup("java:comp/env");
DataSource ds = (DataSource) ic.lookup("jdbc/Cloudscape");
or full as
String dbName = "java:comp/env/jdbc/CustomerDB";
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup(dbName); -
Very strange issue when using initial context to lookup for beans...
hi, friends,
I am currently try to call a bean from a remote ejbclient.
I set the initialcontext like this with the url suppose to be:
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
p.put(Context.PROVIDER_URL, url);
ctx = new InitialContext(p);
and look up home like this with the Name suppose to be:
Object h = null;
h = ctx.lookup(Name);
but the strange thing is, the programme just stops when it is doing ctx.lookup(Name); However I try to log it, but it is just stopping there, without throwing any exceptions and errors.
But, when I gave it a wrong name to like at, it could go through ctx.lookup(Name), and throw some exceptions like "unnable to look up beans.." which I put in the catch part...
I try to echo the "ctx", and it is not null. and I try to echo "h", but it just stop before the "h" getting anything...
the ejbclient is compile with jdk 1.4, because it is on a server with jdk 1.4, and deployed on weblogic 8.1. and the bean.java is compiled with jdk 1.5, and deployed on weblogic 10.
Does anyone knows what is really going on here, when doing the lookup, what happened?
How could I know whether there are the ejbs I need to call are existing in the pool?
Thanks..
Looking forward helps. such an problem has bothered me for a couple of days, and my boss is pushing me on this. but I haven't get any idea on it...:(And now the stranger things here... I didn't do much change to both the remote bean side and the client side, what I did is most like change it to something, and tried with failure, and change back.
But today 's morning, when I just change everything back to suppose to be, and it can find the homebean:
[2008-11-14 11:21:18,436] [ INFO] [Thread-85] - {} getRemoteBean(Unknown Source) Looking up RepairEJB with JNDIName: RepairGatewayEJB_slsb
[2008-11-14 11:21:18,531] [ INFO] [Thread-85] - {} getRemoteBean(Unknown Source) h is not null!!
[2008-11-14 11:21:18,532] [ INFO] [Thread-85] - {} getRemoteBean(Unknown Source) got h: weblogic.rmi.internal.BasicRemoteRef@121 - hostID: '-891706141070674357S:113.128.134.59:[40010,40010,-1,-1,-1,-1,-1]:VPFSCTech:AdminServer', oid: '289'
[2008-11-14 11:21:18,533] [ INFO] [Thread-85] - {} getRemoteBean(Unknown Source) After ctx.lookup();
[2008-11-14 11:21:18,535] [ INFO] [Thread-85] - {} getRemoteBean(Unknown Source) homeBean is weblogic.rmi.internal.BasicRemoteRef@121 - hostID: '-891706141070674357S:113.128.134.59:[40010,40010,-1,-1,-1,-1,-1]:VPFSCTech:AdminServer', oid: '289'
[2008-11-14 11:21:18,537] [ INFO] [Thread-85] - {} getRemoteBean(Unknown Source) After home bean;
[2008-11-14 11:21:18,589] [ INFO] [Thread-85] - Waiting for a request ...
but unfortunately again it just stopped at
remoteBean = homeBean.create();
with no errors and exceptions...
Does any experienced friends ever have this problem before? -
Getting NULL for ctx.lookup
Hi,
I was creating a HTTP destination but getting below exception.
OUTPUT:
Start line
ctx : javax.naming.InitialContext@f32b694
Completed Step 1
tc~sec~destinations~service
Completed Step 2
Inside if of dstService
com.sap.engine.services.jndi.persistent.exceptions.NamingException: <--Localization failed: ResourceBundle='com.sap.engine.services.jndi.persistent.JNDIResourceBundle', ID='Destination Service not available', Arguments: []--> : Can't find resource for bundle java.util.PropertyResourceBundle, key Destination Service not available
at Client.main(Client.java:46)
below is the code. I think the code is not getting destination service object from server. What is the step to add "destinationservice" in SAP NW 731 portal?
import java.rmi.RemoteException;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import com.sap.engine.services.jndi.persistent.exceptions.NamingException;
import com.sap.security.core.server.destinations.api.DestinationException;
import com.sap.security.core.server.destinations.api.DestinationService;
import com.sap.security.core.server.destinations.api.HTTPDestination;
public class Client {
* @param args
public static void main(String[] args) {
// TODO Auto-generated method stub
Hashtable<String, String> env = new Hashtable<String, String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
env.put(Context.PROVIDER_URL, "<HostName>:<P4_port>");
env.put(Context.SECURITY_PRINCIPAL, "<user>");
env.put(Context.SECURITY_CREDENTIALS, "<password>");
try{
System.out.println("Start line");
Context ctx = new InitialContext(env);
System.out.println("ctx : " +ctx.toString());
System.out.println("Completed Step 1");
System.out.println(DestinationService.JNDI_KEY);
DestinationService dstService = (DestinationService)ctx.lookup(DestinationService.JNDI_KEY); //getting null at this line
System.out.println("Completed Step 2");
if (dstService == null){
System.out.println("Inside if of dstService");
ctx.close();
throw new NamingException("Destination Service not available");
//Note: this only created the destination
//it needs to be stored using dstService.storeDestination
System.out.println("Completed Step 4");
HTTPDestination destination = (HTTPDestination)
dstService.createDestination("HTTP");
destination.setUrl("http://<host>:<HTTP_port>");
destination.setName("UMEConnection");
destination.setUsernamePassword("<userName>", "<password>");
dstService.storeDestination("HTTP", destination);
}catch(DestinationException | RemoteException | javax.naming.NamingException e){
e.printStackTrace();
The ctx is coming as null.Hi Hamendra,
Even after hard coding DestinationService.JNDI_KEY to tc~sec~destinations~service in the code, I am getting dstService = null.
Is there anything else I need to change in SAP portal NWA?
Is there any way to check the destination services that are available in SAP Portal?
Thanks
Alingan Patra -
Intial Context and lookup tunning ?
Doing a inital context and lookup for an EJB for every user in my webapp takes a lot
of time, is there any tunning that can be done,can i get the Home Handle and put
it in Application scope and have subsequent users reuse it ?
Any examples or ideas will be appreciated.
Thanks
JoeThe caveat is you still need to get the initial context per user per request
(but you can cache the home handle.) The reason is that the WLS security
context is allocated on a per-thread basis, and since each request can
be served from different threads, this context needs to be refreshed on
each request.
regards,
-Ade
"Matt" <[email protected]> wrote in message
news:3d29a25c$[email protected]..
>
Look at the ServiceLocator pattern (Sun J2EE pattern catalog on thewebsite). That
should give you everything you need for this.
Matt
"Joe" <[email protected]> wrote:
Doing a inital context and lookup for an EJB for every user in my webapp
takes a lot
of time, is there any tunning that can be done,can i get the Home Handle
and put
it in Application scope and have subsequent users reuse it ?
Any examples or ideas will be appreciated.
Thanks
Joe -
Filter the secondary datasource based on lookup column
Hello All,
I am customizing a List form. I have a secondary data connection which is
a datasource for my drop down list. I have to filter the datasource based on Lookup column value.
I know how to filter on the datasource by going to entries and filtering but it does not work with Lookup column.
Can anyone let me know step by step procedure.
Regards,
smith
smithHi,
According to your post, my understanding is that you wanted to filter the secondary datasource based on lookup column.
I recommend to create a cascading drop-down list box in InfoPath.
You can follow the steps in the article to achieve what you want:
Create Cascading Dropdown in Browser enabled InfoPath form using InfoPath 2010
More information:
Cascading Drop Down List In SharePoint 2010
Cascading Drop-Down List in SharePoint 2010 using InfoPath 2010
Dan's SharePoint Blog: InfoPath Tutorial Cascading Dropdown (Does not have the 20 item limit)
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Error in datasource context lookup using OC4J
Hi friends
When I try to get de DataSource,
ictx = new InitialContext();
dat = (DataSource)ictx.lookup("jdbc/GirsaOracleDS");
conn = dat.getConnection();
I get te following error:
javax.naming.NameNotFoundException: jdbc/GirsaOracleDS not found
My data-sources.xml:
<data-source
class="com.evermind.sql.DriverManagerDataSource"
name="GirsaOracleDS"
location="jdbc/GirsaOracleCoreDS"
xa-location="jdbc/xa/GirsaOracleDS"
ejb-location="jdbc/GirsaOracleDS"
connection-driver="oracle.jdbc.driver.OracleDriver"
username="girsa"
password="girsa"
url="jdbc:oracle:thin:@server-ora:1521:orcl"
inactivity-timeout="30"
/>
Can anybody help me?
thanks!On Note 557738.1 - Export/Import, Section 5 Step 4, I executed "perl dpost_imp.pl dpost_imp.drv" on the source server and created the required driver. Moved to the target and when applying with adpatch, it failed with:
AutoPatch error:
adprdf(): At line 62 in file dpost_imp.drv:
Error extension recordpatch line missing from patch driver file.
You should check the file
I opened an SR yesterday and after many hours, I was told to:
a) backup current file dpostimpl.drv
b) edit driver file dpostimpl.drv and made the following change
# dpost_imp.drv generated by dpost_imp.pl
begin aru fix_postimp
compatible release 12.0.0
begin bug au fix_postimp
begin actions
TO
# dpost_imp.drv generated by dpost_imp.pl
begin aru fix_postimp
compatible release 12.0.0
extension recordpatch 6924477 US
begin bug au fix_postimp
begin actions
c) Save and re-try apply driv dpostimpl.drv via autopatch.
I did the changes, ran adpatch and the error is still there:
adpatch logfile=dpost_imp.drv2.log patchtop=/EBS_12i_downloads/patches driver=dpost_imp.drv workers=8
AutoPatch error:
adprdf(): At line 68 in file dpost_imp.drv:
'end bug au fix_ctxsys' encountered while 'bug au fix_postimp' is open
Line 68 is:
end bug au fix_ctxsys
Has someone got knowledge of what is needed here?You are applying an 11i patch (as you are following [ID 557738.1]) so the "compatible release 12.0.0" line is not correct and it should be "compatible release 11.5.0" instead. Are you sure you are referring the steps in (Export/import notes on Applications 11i Database 11g [ID 557738.1]) not the steps in (Export/import process for R12 using 11gR1 or 11gR2 [ID 741818.1]) or (Export/Import Process for Oracle E-Business Suite Release 12 using 10gR2 [ID 454616.1])?
Have you already updated the SR with the outcome of their change?
Thanks,
Hussein -
Dear all,
sorry for my bad english.
I'm using SUN ONE web server SP4 to run my web app. But I'm getting a shit thing with this: I did follows jdbc simple example to write my own simple demo, everything is ok if the code of accessing to DB is put in function doGet of servlet. But I got problem if I bring this code into init function (it's fail at DataSource ds = (javax.sql.DataSource) initContext.lookup(dsName) statement and the exception "Cannot create resource instance" is thrown out)
Bellow is the snippet code to access to DB
try
datasourceName = config.getServletContext().getInitParameter("databaseDatasource"); //this is retrived from tag Context Param in web.xml
InitialContext initContext = null;
Hashtable env = new java.util.Hashtable(1);
try {
initContext = new javax.naming.InitialContext(); //this is successful
DataSource ds = (javax.sql.DataSource) initContext.lookup(datasourceName ); //this statement is fail
catch(Exception e)
System.out.println("- Could not interact with the database");
e.printStackTrace();
I dont know why. is there different if I put this code into doGet and init functions? It sounds to me that during the init function of servlet is executing there are some libraries needed for JNDI still have not been loaded. that's just my thought
That would be the most appreciated if Anyone plz explain this to me?
Thanx in advance -
JNDI datasource context LifeCycleException
Any help with this would be greatly appreciated. I'm trying to set up connection pooling in Tomcat 4.1.27 on Linux using MySQL. I followed the directions from Jakarta here http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-examples-howto.html
And I put the mysql connector .jar file in Tomcat's common/lib directory.
However, when I start up Tomcat, my webapp doesn't load. There is no error message in the logs or on the console at startup. It just silently fails. Then when I shutdown Tomcat this error appears:
2003-10-17 11:31:12 StandardHost[localhost]: Removing web application at context path /budgetchallenge
2003-10-17 11:31:12 StandardHost[localhost]: ContainerBase.removeChild: stop:
LifecycleException: Container StandardContext[/budgetchallenge] has not been started
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:3644)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1036)
at org.apache.catalina.core.StandardHostDeployer.remove(StandardHostDeployer.java:470)
etc...Here is the node in my web.xml per the directions...
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/budgetchallenge</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>Here is the setup in the server.xml...
<Context path="/budgetchallenge" docBase="budgetchallenge"
debug="5" reloadable="true" crossContext="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_budgetchallenge_log." suffix=".txt"
timestamp="true"/>
<Resource name="jdbc/budgetchallenge"
auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/budgetchallenge">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<!-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
-->
<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>
<!-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
-->
<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>
<!-- Maximum time to wait for a dB connection to become available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded. Set to -1 to wait indefinitely.
-->
<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>
<!-- MySQL dB username and password for dB connections -->
<parameter>
<name>username</name>
<value>...</value>
</parameter>
<parameter>
<name>password</name>
<value>...</value>
</parameter>
<!-- Class name for mm.mysql JDBC driver -->
<parameter>
<name>driverClassName</name>
<value>com.mysql.jdbc.Driver</value>
</parameter>
<!-- The JDBC connection url for connecting to your MySQL dB.
The autoReconnect=true argument to the url makes sure that the
mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
connection. mysqld by default closes idle connections after 8 hours.
-->
<parameter>
<name>url</name>
<value>jdbc:mysql://10.1.1.45:3306/budgetsurvey_02</value>
</parameter>
</ResourceParams>
</Context>Yeah, I've got those all set up.
However, now the application is working, connecting to the DB and everything. The problem was that the deployed .war file was not expanding. The JNDI context specifies and directory with the app name, but there was none because the .war file was not expanded as it usually is automatically in Tomcat.
So I manually expanded it and now the app works. However, I'd like to know why the .war archive was not being automatically expanded.
Ethan -
i'm getting the data source context as nulll.....
what may be the reason and how to get rid of this?
I'm previously working with this datasource.
thanks in advanceThank-you all very much for replying!
To gypsy617, we're both using Tyrex. At least I noticed we both had Tyrex jar files and not the other sort. I assume this means that they don't have an LE version of Tomcat?
To patreck, I did set the datasource in the context section of the server.xml file, but I'm pretty sure that's what you're supposed to do and works on my machine. Or are you talking about the driver location. I've put this in the $CATALINA_HOME/common/lib directory, which also works on my machine.
To duffymo, why is this so different to the JNDI Resources HOW-TO?? Very strange. I've found it really hard to get access to the main server (annoying!!) but will this afternoon - I'll let you know how it goes. Also strange that I'm using Tyrex on my machine without everything they mention in this document and it works fine! But I'll give it a go anyway!
Thanks very much to all of you!!!!!!!!!!!!!
Louise. -
JNDI lookup() for sql server jdbc datasource returns null
Hi,
I am trying to use a jdbc datasource in tomcat 5 to access a sql server 2000 database. I had many common problems and did found an answer to them in the forums but I'm having one last (I hope) problem. My program is also using a mySQL datasource and it works fine.
The problem is that my lookup returns null. No exception, just null. It seems that many people had this problem but I didn't found any answer to it.
This is the lookup code:
Context ctx = new InitialContext();
Context envCtx = (Context)ctx.lookup("java:comp/env");
axaptaDS = (DataSource) envCtx.lookup("jdbc/axapta"); //returns null :(This my context.xml config:
<ResourceParams name="jdbc/axapta">
<parameter>
<name>factory</name>
<value>com.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://hostname:1433</value>
</parameter>
<parameter>
<name>password</name>
<value>password</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</value>
</parameter>
<parameter>
<name>username</name>
<value>username</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>And I also put these lines in my web.xml file:
<resource-ref id="ResourceRef_1092254277306">
<res-ref-name>jdbc/axapta</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>Thanks for helping!I finally found a remedy to this problem:
specify this driver instead and remove the entry about the factory in the context's .xml file:
com.microsoft.jdbc.sqlserver.SQLServerDriver -
Lookup DataSource: NameNotFoundException
I am having a terrible time looking up a data source. I always get a NameNotFoundException.
Here is what I've got:
WEB.XML
<resource-ref>
<res-ref-name>impresaDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
WEBLOGIC.XML
<reference-descriptor>
<resource-description>
<res-ref-name>impresaDataSource</res-ref-name>
<jndi-name>jdbc/impresaDataSource</jndi-name>
</resource-description>
</reference-descriptor>
CONFIG.XML
<JDBCConnectionPool CapacityIncrement="5"
DriverName="oracle.jdbc.driver.OracleDriver"
InitialCapacity="5"
MaxCapacity="50" Name="impresaPool"
Password="{3DES}vWu5VQp5y9k=" Properties="user=world"
Targets="impresa-server"
URL="jdbc:oracle:thin:@orion:1521:devl7"/>
<JDBCDataSource JNDIName="jdbc/impresaDataSource"
Name="impresaDataSource" PoolName="impresaPool"
RowPrefetchEnabled="false" Targets="impresa-server"/>
THE CODE:
Properties props = new Properties();
IntialContext ctx = new InitialContext(props);
DataSource ds = ctx.lookup("impresaDataSource");
I've tried everything I can think of, but nothing seems to work. Another thread
from about a year ago suggested adding the following properties to the connection
pool:
dll=ocijdbc8;protocol=thin
But that did not work either.
Any ideas?TRY:
WEB.XML
<resource-ref>
<res-ref-name>jdbc/impresaDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
WEBLOGIC.XML
<reference-descriptor>
<resource-description>
<res-ref-name>jdbc/impresaDataSource</res-ref-name>
<jndi-name>impresaDataSource</jndi-name>
</resource-description>
</reference-descriptor>
CONFIG.XML
<JDBCConnectionPool CapacityIncrement="5"
DriverName="oracle.jdbc.driver.OracleDriver"
InitialCapacity="5"
MaxCapacity="50" Name="impresaPool"
Password="{3DES}vWu5VQp5y9k=" Properties="user=world"
Targets="impresa-server"
URL="jdbc:oracle:thin:@orion:1521:devl7"/>
<JDBCDataSource JNDIName="jdbc/impresaDataSource"
Name="impresaDataSource" PoolName="impresaPool"
RowPrefetchEnabled="false" Targets="impresa-server"/>"kai" <[email protected]> wrote:
>
I would say it must be: java:comp/env/jdbc/impresaDataSource
Regards,
Kai
Rajesh Mirchandani <[email protected]> wrote:
Try
DataSource ds = ctx.lookup("java:comp/env/impresaDataSource");
Aidan Monroe wrote:
I should have mentioned that I am running on WLS 7.0
I am having a terrible time looking up a data source. I always geta NameNotFoundException.
Here is what I've got:
WEB.XML
<resource-ref>
<res-ref-name>impresaDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
WEBLOGIC.XML
<reference-descriptor>
<resource-description>
<res-ref-name>impresaDataSource</res-ref-name>
<jndi-name>jdbc/impresaDataSource</jndi-name>
</resource-description>
</reference-descriptor>
CONFIG.XML
<JDBCConnectionPool CapacityIncrement="5"
DriverName="oracle.jdbc.driver.OracleDriver"
InitialCapacity="5"
MaxCapacity="50" Name="impresaPool"
Password="{3DES}vWu5VQp5y9k=" Properties="user=world"
Targets="impresa-server"
URL="jdbc:oracle:thin:@orion:1521:devl7"/>
<JDBCDataSource JNDIName="jdbc/impresaDataSource"
Name="impresaDataSource" PoolName="impresaPool"
RowPrefetchEnabled="false" Targets="impresa-server"/>
THE CODE:
Properties props = new Properties();
IntialContext ctx = new InitialContext(props);
DataSource ds = ctx.lookup("impresaDataSource");
I've tried everything I can think of, but nothing seems to work. Anotherthread
from about a year ago suggested adding the following properties tothe connection
pool:
dll=ocijdbc8;protocol=thin
But that did not work either.
Any ideas?--
Rajesh Mirchandani
Developer Relations Engineer
BEA Support
Maybe you are looking for
-
Problem began after a Firefox 6 update (i do not remember which one) and has continued through current use of Firefox 7.0.1. Almost all '''web pages load only through repeated refreshing'''. If I do not refresh the web page it will just continue to t
-
How can I remove recent contacts from my Mac's 'Share Menu'?
I have a MacBook Pro and I noticed that when I want to share something it only shows me the recent messages of one person to share with. I don't talk to said person as often as any other so I'd like to know how to remove it from my share menu. Thanks
-
Shared Disks on AEBS - Secure Passwords - Multiple Users
I posted this on the Digital Life forum. No joy. Not sure if this is an AEBS issue or a Leopard issue. I need to have different access rights to disks or folders on disks connected to the AEBS. One disk (or folder) is the Everyone shares disk (or fol
-
Problem to transform Flat file to Data Type Structurated and map to IDOC
Hi all, I have a file to idoc scenario. The information is like this: 1#!445#!AI12#!1#!20070214#!DVXXXXR#!201#!31GINHG876#!#! 2#!#!ETC 3#!000000000030008888#!#!3000#!#!10#!#!20070215 4#!dades45#!b#!c#!d#!e#!f#!g 5#!pos5 where 1, 2, ... = key segments
-
10.9.4 Possible Bugs
I recently updated to 10.9.4 and I've encountered a couple of bugs for Messages and FaceTime. I'm quite a heavy user of both across multiple devices and not having them working properly on my Mac complicates things for me. I keep getting this: "Your