File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Weblogic datasource how to config? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Weblogic datasource how to config?" Watch "Weblogic datasource how to config?" New topic
Author

Weblogic datasource how to config?

Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
I'm trying to connect to my datasource which I've configured in weblogic, but something goes wrong, any help out there? Im i doing the jndi-name/res-ref-name right??
Name: fiskDS
JNDI Name: jdbc/fisk
Type: Gridlink

Am i using them wrong?
In Oracle documentation it says:
<res-ref-name> Specifies the name of a resource reference.
<jndi-name> Specifies a JNDI name for the resource.

Should the <jndi-name> be jdbc/fisk?



Also tried this, only trying to connect to the weblogic datasource, but didn't work?


weblogic.xml


web.xml
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
Are you setting JNDI name based on application or changing the application based on jndi name. I think the later part is more easy. Which weblogic version are you on? You can check the JNDI name through Admin Console?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:Are you setting JNDI name based on application or changing the application based on jndi name. I think the later part is more easy.


Im supposed to do a resource lookup, the JNDI name is already set in weblogic? (feels confused)
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
Johan Blo wrote:
Should the <jndi-name> be jdbc/fisk?


Why not give a try?
Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:
Johan Blo wrote:
Should the <jndi-name> be jdbc/fisk?


Why not give a try?

Feels like I've tried everything but the only solution which should work...
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
Did it work?
Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:Did it work?

No, i meant I've already tried it before making this thread, but it didnt work, but maybe it is right, but the configuration of the rest of the settings are wrong... Therefor I'm asking here
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
How did you configure datasource name in weblogic?
Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:How did you configure datasource name in weblogic?


What else than Name and JNDI name are you thinking about? The datasource name is fiskDS and the JNDI-name in it is jdbc/fisk, it's a datasource connected to several databases
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
I would try two options.




Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:I would try two options.






Yeah i've tried jdbc/fisk (removed the .xml files) and java:comp/env/jdbc/fisk, didnt work.. I'll try the fiskDS but that one is just the name of the datasource, not the lookup name
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
I am not sure why are you needing those XML files after setting up the data-source. Why not you write a simple client and see if you are able to get the connection from the pool? I strongly believe you would need a weblogic.jar.
Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:I am not sure why are you needing those XML files after setting up the data-source. Why not you write a simple client and see if you are able to get the connection from the pool? I strongly believe you would need a weblogic.jar.


That was what I meant in my last post, I realised I might not need them unless i want to rename the datasource. But it still doesnt work. Haven't found any information about any weblogic.jar?

What I'm not using is the INITIAL_CONTEXT_FACTORY, there are plenty of examples not using this one?
And another thing, i get the error:
namingexception String index out of range: -1
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
You would need weblogic.jar if you have been using INITIAL_CONTEXT_FACTORY



Can you post your code?
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1531
Johan Blo wrote:Im supposed to do a resource lookup, the JNDI name is already set in weblogic? (feels confused)


Yes it is already set in weblogic at the time when you create the pool/data-source. It is after you creating the data-source you go on with a client to get a connection from the pool and further on the way.
Johan Blo
Greenhorn

Joined: Mar 14, 2013
Posts: 10
Akhilesh Trivedi wrote:You would need weblogic.jar if you have been using INITIAL_CONTEXT_FACTORY


Can you post your code?


Thanks a lot for the help so far!



I will however need to wait until tomorrow to be able to generate the wlfullclient.jar (wls 10.3.x)

But let say i would use JPA/hibernate instead, I wouldn't need to use wlfullclient.jar i guess...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Weblogic datasource how to config?