Jndi data source references at deployment time
hi,
i have been thinking and trying for days now, so any hint is greatly appreciated.
we have an enterprise java application with adf faces, bc4j and jpa all in one ear which runs on weblogic 10.3. we want several instances of the same application running on the same weblogic server, with different context-root's and database connections. what I don't know how to do is how I could create an application-wide jndi link to a jdbc data source at deployment time - because the data source jndi name is listed in bc4j application modules and persistence.xml - so one global jndi link for the application would be great.
e.g.
jndi names of data sources installed in the weblogic server:
jdbc/customer1
jdbc/customer2
deployment1:
context-path: /app-customer1
local data source name: java:comp/env/jdbc/customer
deployment 2:
context-path: /app-customer2
local data source name: java:comp/env/jdbc/customer
so the goal is, at deployment time, to create a link to jdbc/customer1 for the first deployment and jdbc/customer2 for the second deployment using .. ?
thank you very much,
matt
hi Anand,
thank you for your answer. It is indeed a part of the solution I would need to apply - resource references in web.xml to have the bc4j application modules reference a jndi data source under java:comp/env. The other part to it is that we have an ejb jar in our jee application, built with hibernate and a persistence.xml file (yes we are crazy enough to use both bc4j and jpa in one ear). The jndi name of the data source specified in persistence.xml would not pick up a resource reference specified in web.xml would it - actually i should just try this out. So that's the 2nd part of the solution.
cheers,
Matt
Similar Messages
-
Referencing JNDI data source: Tomcat 6 vs WebSphere 6.1
Hi,
I've noticed a problem whereby there is a difference in the way I have to specify my JNDI data source depending on the application server I deploy it on.
In Tomcat my code specifies "java:comp/env/DB_NAME" and this works fine.
This doesn't work though in WebSphere and I have to remove the "java:comp/env" prefix to get it to work.
Is there a common solution for this whereby my code/properties can specify the same JNDI value?
Thanksjwenting wrote:
mycoffee wrote:
ted_hankey wrote:
Hi,
I've noticed a problem whereby there is a difference in the way I have to specify my JNDI data source depending on the application server I deploy it on.
In Tomcat my code specifies "java:comp/env/DB_NAME" and this works fine.
This doesn't work though in WebSphere and I have to remove the "java:comp/env" prefix to get it to work.
Is there a common solution for this whereby my code/properties can specify the same JNDI value?
ThanksShould not be different
wrong. There's nothing in any specification stating that jndi resource names should be identical between platforms.
On weblogic for example it would be jdbc/DB_NAME :)No
Tomcat, websphere or weblogic are not different in that term
The differences are about configuration of the servers. If the servers are configured the same, it should be the same. (Check all the config xml files)
This post is more clear
http://www.theserverside.com/discussions/thread.tss?thread_id=42158
I wrote my code like this
Context intC = new InitialContext();
Context c = (Context )intC.lookup("java:comp/env");
DataSource ds = (DataSource)c.lookup("myDataBase");
con = ds.getConnection();and it works for Tomcat + Websphere (did not try on Weblogic yet but believe it should be OK) -
I'm trying to use a JNDI data source in CF 10. We used to do it in CF 8 in the JRun admin, and was able to use data sources across coldFusion and java code. Any ideas on how to make it work in CF 10? I've tried several online resources, setting up a resource in Context.xml:
<Resource name="mydatasource" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="myuser" password="mypass" driverClassName="macromedia.jdbc.MacromediaDriver"
url="jdbc:macromedia:sqlserver://127.0.0.1:1433;databaseName=mydb;SendStringParametersAsU nicode=false;SendStringAsUnicode=false"/>
then a resource-ref in web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>mydatasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
but I'm getting errors
java.lang.IllegalArgumentException: Cannot convert value of type [jav
a.lang.String] to required type [javax.sql.DataSource] for property 'dataSource'
: no matching editors or conversion strategy foundIf you want to turn your application into a provider, refer to the Developer's Guide at http://docs.sun.com/source/816-6362-10/index.html
-
How to create JNDI data source name in Tomcat 6.0.18 server?
Hai,
How to create JNDI data source name in Tomcat 6.0.18 server?
Regards,
MariMuthu.A[http://google.com/search?q=jndi+site:tomcat.apache.org+6.0]
-
Weblogic & JNDI Data Source with proxy user.
We're trying to use Oracle proxy user authentication on a data source configured in WebLogic 10.3.6, however, we want to approach it in a programatic way. So we want to obtain the DataSource, and set the proxy related properties inside the application.
We came up with the following snippet:
Hashtable<String, Object> env = new Hashtable<String, Object>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://10.1.1.10:7003");
env.put(Context.SECURITY_PRINCIPAL, "weblogic");
env.put(Context.SECURITY_CREDENTIALS, "weblogic");
Context context = new InitialContext(env);
javax.sql.DataSource ds = (javax.sql.DataSource) context.lookup("ds_puser");
OracleConnection oconn = (OracleConnection) ds.getConnection();
The problem comes up when we try to cast the connection to OracleConnection, the thing is that the returned type is actually a 1036_WLStub.
How can we avoid that type or cast to it to something useful? I found this reference on Oracle forums and he's being able to cast it directly:
Re: My problem in using weblogic Datasource and proxy user
Can someone help us out?
Thanks a lot in advance!
Edited by: 990800 on 27-feb-2013 13:26A DataSource is an Interface. What the code gets from the jndi tree is some concrete object that
the code doesn't need to know the name of, or anything specific about it, as long as it implements
the DataSource Interface, which it successfully casts to, to allow calling the methods defined in the
DataSource Interface. If you call for a plumber, you don't need to know his name as long as you
can get a plumber, and can call the "Fix this leak" method, defined in the Plumber Interface. -
Problem of javafx2 remote call ejb3 and jndi data source
netbean7.2 javafx2 glassfish3.1.2.2
My javafx2 project through jndi remote access the ejb and data source,
I select to run as an independent in netbeans ,without problems!
However, When I select it to run as the web start. Or in the browser inside always error!
Want a lot of ways it is not solved, especially to help!
Caused by: java.lang.ClassNotFoundException: com.sun.enterprise.naming.SerialInitContextFactory
at sun.plugin2.applet.Plugin2ClassLoader $ 2.run (Unknown Source)
at java.security.AccessController.doPrivileged (Native Method)
at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper (Unknown Source)
at sun.plugin2.applet.JNLP2ClassLoader.findClass (Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0 (Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass (Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass (Unknown Source)
at java.lang.ClassLoader.loadClass (ClassLoader.java: 356)
at java.lang.Class.forName0 (Native Method)
at java.lang.Class.forName (Class.java: 264)
at com.sun.naming.internal.VersionHelper12.loadClass (VersionHelper12.java: 63)
at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java: 671)
... 47 moreThe program has been signed (unlimited access). This is jvm tracking information, What can I do?
java.io.FileNotFoundException: \D:\eejj\JavaFXApplication18\dist\modules\jsr173_1.0_api.jar
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getJarFile(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.access$1000(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.ensureOpen(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.<init>(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getLoader(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.access$000(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$1.next(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$1.hasMoreElements(Unknown Source)
at java.net.URLClassLoader$3$1.run(Unknown Source)
at java.net.URLClassLoader$3$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader$3.next(Unknown Source)
at java.net.URLClassLoader$3.hasMoreElements(Unknown Source)
at sun.misc.CompoundEnumeration.next(Unknown Source)
at sun.misc.CompoundEnumeration.hasMoreElements(Unknown Source)
at com.sun.naming.internal.VersionHelper12$InputStreamEnumeration$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.naming.internal.VersionHelper12$InputStreamEnumeration.getNextElement(Unknown Source)
at com.sun.naming.internal.VersionHelper12$InputStreamEnumeration.hasMore(Unknown Source)
at com.sun.naming.internal.ResourceManager.getApplicationResources(Unknown Source)
at com.sun.naming.internal.ResourceManager.getInitialEnvironment(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
java.io.FileNotFoundException: \D:\eejj\JavaFXApplication18\dist\lib\grizzly-websockets.jar
java.io.FileNotFoundException: \D:\eejj\JavaFXApplication18\dist\lib\grizzly-http-ajp.jar
eg.....(<font color=red > a lot of *.jar find nothing </font> )
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:251)
at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
at com.sun.glass.ui.View.notifyMouse(View.java:922)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:67)
at java.lang.Thread.run(Unknown Source)
<font color=red >
Caused by: java.lang.ExceptionInInitializerError
</font>
at com.sun.enterprise.module.single.SingleModulesRegistry.<init>(SingleModulesRegistry.java:79)
at com.sun.enterprise.module.single.SingleModulesRegistry.<init>(SingleModulesRegistry.java:67)
at com.sun.enterprise.module.single.StaticModulesRegistry.<init>(StaticModulesRegistry.java:66)
at org.glassfish.internal.api.Globals.getStaticHabitat(Globals.java:84)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.<init>(SerialInitContextFactory.java:236)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at javafxapplication18.NewClass.v(NewClass.java:51)
at javafxapplication18.JavaFXApplication18$1.handle(JavaFXApplication18.java:50)
at javafxapplication18.JavaFXApplication18$1.handle(JavaFXApplication18.java:42)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Node.fireEvent(Node.java:6863)
at javafx.scene.control.Button.fire(Button.java:179)
at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3324)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
... 6 more
<font color=red>
Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.class.path" "read")
</font>
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at com.sun.enterprise.module.single.ProxyModuleDefinition.<clinit>(ProxyModuleDefinition.java:185)
... 59 more
帖子经 user7993481编辑过
帖子经 user7993481编辑过
帖子经 user7993481编辑过
帖子经 user7993481编辑过 -
Crystal ActiveX Runtime Lib: Change text data source path at run time.
We have some PCs running Crystal Reports 10 and some running CR 9 and 8.5. For each PC, we set up a System DSN ODBC data source (in Control Panel - Administrative Tools) for pulling data from text files to
generate reports.
Recently we wrote some routines (see the Visual Basic example at the
end of this message) to change the path of the data files at runtime.
According to the Crystal Reports Technical Reference Guide, we may use
the method LogOnServer() of an Application object or an DatabaseTable
object. However, we find that this does not work: the PrintOut()
method only pulls data from the default path as configured for the
System DSN, not from the path passed as the third parameter of
LogOnServer(). It does not return any error message.
We have also tried to use SetTableLocation() method, and it still does
not work.
Would any experts examine our code below and advise what we are missing? Thanks.
For the following VB example, we have:
System DSN Name: AP_WORKSHEET
Driver: Microsoft Text Driver
Database Directory: D:\0ood2 (i.e. the default path)
Crystal Report Document: D:\3g\run\Vision\apcyto\Reports\crBlockWS.rpt
(Which specifies that the data source text file name is BlockWS.txt)
Purpose : We would like to read the data source text file from
D:\0ood1 instead of the default path.
Following is the code of the VB macro:
Sub test()
Rem In this version of the subroutine, we call
Rem DatabaseTable.LogOnServer() and "Rem"ed out
Rem Application.LogOnServer() and SetTableLocation().
Rem We have un"Rem"ed each of them and "Rem"ed others and try to run.
Rem In all runs, data are pulled from the default file
Rem D:\0ood2\BlockWS.txt instead of D:\0ood1\BlockWE.txt.
Dim crxapp As CRAXDRT.Application
Dim crxRep As CRAXDRT.Report
Dim crxDB As CRAXDRT.Database
Dim crxTab As CRAXDRT.DatabaseTable
Dim crxConnPs As CRAXDRT.ConnectionProperties
Dim crxConnP As CRAXDRT.ConnectionProperty
Dim apropSubLoc As String
Dim apropConnBufStr As String
Set crxapp = CreateObject("CrystalRuntime.Application")
Rem
crxapp.LogOnServer "p2sodbc.dll", "AP_WORKSHEET", "<CRWDC>DBQ=D:\0ood1",
Set crxRep = crxapp.OpenReport
("D:\3g\run\Vision\apcyto\Reports\crBlockWS.rpt")
Set crxDB = crxRep.Database
Set crxTab = crxRep.Database.Tables(1)
apropConnBufStr = crxTab.ConnectBufferString
apropSubLoc = crxTab.SubLocation
crxDB.LogOnServer "p2sodbc.dll", "AP_WORKSHEET", "<CRWDC>DBQ=D:\0ood1",
Rem crxTab.SetTableLocation "D:\0ood1\BlockWS.txt", apropSubLoc, "DSN="
Rem Set crxConnPs = crxTab.ConnectionProperties
Rem Set crxConnP = crxConnPs.Item("DSN")
Rem crxConnP.Value = "AP_WORKSHEET"
Rem Set crxConnP = crxConnPs.Item("Database")
Rem crxConnP.Value = "D:\0ood1\BlockWS.txt"
Rem crxTab.Location = "BlockWS.txt"
crxRep.DiscardSavedData
crxRep.PrinterSetup (0)
crxRep.PrintOut
End Sub
For VB macros, the problem exists in all of CR 8.5, 9 and 10. However,
for another platform we are using, Unify Vision 4GL, it works for CR
8.5 while not working for CR 9 and 10.
Following is the source code in Unify Vision 4GL. This language may
not be popular, but I thin you are about to see how it calls the
Runtime Library methods LogOnServer(), OpenReport(), PrinterSetup() and
PrintOut().
%gfPrintCrystalReport
BOOL FUNCTION gfPrintCrystalReport($reportName)
BEGIN
if NOTMKNOWN(GF:$oSeagateId) then
create service of activex
class 'CrystalRuntime.Application'
object_ref into GF:$oSeagateId;
if MKNOWN(GF:$oSeagateId) then
begin
/* TD23013: Database directories are dynamic to
accommodate multiple user requirement of Citrix */
send message LogOnServer to GF:$oSeagateId
using
( 'PDSODBC.DLL', 'AP_WORKSHEET', '<CRWDC>DBQ='+GF:$WinTempDir,'','')
identified by $msgHandle;
if $msgHandle:MSG_STATE 'RESPONSE_PROCESSED'
then
begin
display 'Crystal Reports cannot connect
to the datasource ' for fyi_message wait;
return (FALSE)
end
send message OpenReport to GF:$oSeagateId using
($reportName, 1)
identified by $msgHandle returning
$oCrystalReport
if MKNOWN($oCrystalReport) then
begin
if (NOTMKNOWN(GF:$printerName)) then
set GF:$printerName to
$oCrystalReport->PrinterName;
if GF:$printerName $oCrystalReport-
PrinterName then
send message SelectPrinter to
$oCrystalReport
using
(GF:$driverName,GF:$printerName,GF:$portName)
identified by $msgHandle;
set $oCrystalReport-
DisplayProgressDialog to FALSE;
while TRUE
begin
DISPLAY NOTICE 'Print to : ' +
GF:$printerName
LABELS 'Ok'
DEFAULT, 'Cancel', 'Printer Setup'
RESULT INTO $userOption
switch ($userOption)
begin
case 0 :
send
message PrintOut to $oCrystalReport
using
(PROMPT_USER, NUMBER_OF_COPIES, COLLATED, START_PAGE, STOP_PAGE)
identified by $msgHandle;
set
$oCrystalReport to UNDEFINED
return
(TRUE);
case 1:
set
$oCrystalReport to UNDEFINED
return
(FALSE);
case 2:
send
message PrinterSetup to $oCrystalReport
using
(0)
identified by $msgHandle;
if
GF:$printerName $oCrystalReport->PrinterName then
begin
set GF:$printerName to $oCrystalReport->PrinterName;
set GF:$driverName to $oCrystalReport->DriverName;
set GF:$portName to $oCrystalReport->PortName;
end
break;
end
end
end
end
return
(FALSE);
ENDHi Sydney,
If you search the Developers help file you'll find info on using the method:
How to change the data source
This example demonstrates how to change the data source from native Access to an OLEDB (ADO) data source by using the ConnectionProperty Object, as well as how to change the table name by using the Location property of the DatabaseTable Object. CrystalReport1 is connected to the xtreme.mdb database found in the \Program Files\Crystal Decisions\Crystal Reports 10\Samples\En\Databases folder. The report is using the Customer table. A copy of the Customer table is added to the pubs database on Microsoft SQL Server.
' Create a new instance of the report.
Dim Report As New CrystalReport1
Private Sub Form_Load()
' Declare a ConnectionProperties collection.
Dim CPProperties As CRAXDRT.ConnectionProperties
' Declare a DatabaseTable object.
Dim DBTable As CRAXDRT.DatabaseTable
' Get the first table in the report.
Set DBTable = Report.Database.Tables(1)
' Get the collection of connection properties.
Set CPProperties = DBTable.ConnectionProperties
' Change the database DLL used by the report from
' native Access (crdb_dao.dll) to ADO/OLEDB (crdb_ado.dll).
DBTable.DllName = "crdb_ado.dll"
' The connection property bags contain the name and value
' pairs for the native Access DLL (crdb_dao.dll). So we need
' to clear them, and then add the name and value pairs that
' are required to connect to the OLEDB data source.
' Clear all the ConnectioProperty objects from the collection.
CPProperties.DeleteAll
' Add the name value pair for the provider.
CPProperties.Add "Provider", "SQLOLEDB"
' Add the name value pair for the data source (server).
CPProperties.Add "Data Source", "ServerA"
' Add the name value pair for the database.
CPProperties.Add "Initial Catalog", "pubs"
' Add the name value pair for the user name.
CPProperties.Add "User ID", "UserName"
' Add the name value pair for the password.
CPProperties.Add "Password", "password"
' Set the table name. ' for SQL types it would be "database.dbo.table"
DBTable.Location = "Customer"
Screen.MousePointer = vbHourglass
' Set the report source of the viewer and view the report.
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub -
JNDI, Data Source and Tomcat
Hi,
I am using Tomcat 4.1
I am using JDBC to connect to to SQL 2000.
In the past I use JDBC 2.0 standsrd package to connect to it and it was fine.
Now, for some reason, I need to use DataSource via JNDI.
Here is my server.xml
<Resource name="jdbc/SQLNorthwind" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/SQLNorthwind">
<parameter>
<name>validationQuery</name>
<value>select * from Products</value>
</parameter>
<parameter>
<name>url</name> <value>jdbc:microsoft:sqlserver://W2KSERVER1:1433;DatabaseName=Northwind</value>
</parameter>
<parameter>
<name>password</name>
<value>george</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</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>george</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
It was generated by the Tomcat admin tools via the web browser.
It is my web.xml
<servlet>
<servlet-name>JNDIDatabase</servlet-name>
<display-name>JNDIDatabase</display-name>
<description>JNDIDatabase</description>
<servlet-class>com.testing.servlet.jdbc.jndi.JNDIDatabase</servlet-class>
</servlet>
Now here is my servlet source code for connection testing
private Connection conn;
private Statement stmt;
private ResultSet rs;
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/SQLNorthwind");
conn = ds.getConnection("george", "george");
} catch(NamingException e) {
this.log("Naming exception in JNDIDatabase init", e);
e.printStackTrace();
} catch(SQLException e) {
this.log("SQL exception in JNDIDatabase init", e);
e.printStackTrace();
The problem is no connection is obtained in init(). So what's wrong with my setting/code? Please help me to fix my setting/code.
Thank you in advance.Follow what you said, no more NamingException. Thanks, Dave.
now I receive another error.....
2002-10-18 00:34:12 JNDIDatabase: SQL exception in JNDIDatabase init
java.sql.SQLException: Cannot load JDBC driver class 'com.microsoft.jdbcx.sqlserver.SQLServerDataSource'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:529)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329)
at hk.com.scope.servlet.jdbc.jndi.JNDIDatabase.init(JNDIDatabase.java:37)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:924)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2388)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
at java.lang.Thread.run(Thread.java:536)
I am sure msutil.jar, mssqlserver.jar and msbase.jar are stored in /WEB-INF/lib directory and using them in standard JDBC is OK!
This is an extraction from MS JDBC help file.....
The data source class for the SQL Server driver is:
com.microsoft.jdbcx.sqlserver.SQLServerDataSource
For information on SQL Server 2000 Driver for JDBC data sources, see "Connecting Through Data Sources".
The driver class for the SQL Server driver is:
com.microsoft.jdbc.sqlserver.SQLServerDriver
com.microsoft.jdbc.sqlserver.SQLServerDriver is working properly, I am sure. -
WAS 6.1 JNDI data source connection CRXI R2 Developer
Hi all,
I've been tasked to get a JNDI connection from a WAS 6.1 server to a Oracle DB to use in developing a report.
The CR developer I'm using is CR Developer;Product Type: Full Product Version: 11.0.0.1282
I have created a simple Java 'main' class to test the JNDI connection using the following jars:
com.ibm.ws.admin.client_6.1.0.jar
com.ibm.ws.runtime_6.1.0.jar
com.ibm.ws.webservices.thinclient_6.1.0.jar
ibmorb.jar
ojdbc-14.jar
rsadbutils.jar
rsahelpers.jar
I have been able to retrieve data from the Oracle DB through the 'main' class and display it on the console.
However, after I set the CRConfig.xml file's classpath to use these jars, along with a jar I created that contains a jndi.properties file that contains the org.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB property because the JVM that the CR developer is pointing at is a Sun 1.6 HotSpot JVM.
When I try getting the connection, Database -> Database Expert -> Create New Connection -> JDBC (JNDI), select the JNDI Connection option and enter the relevant information, the developer finds the JNDI names that I'm looking for. Then I 'Click' the Finish button and receive the following error pop-up:
Logon Failed.
Details: SQL Exception: SQL State: null ERROR Message: Invalid argument(s) in callDSRA0010E: SQL State= null, Error Code = 17,068 Database Vendor Code: 17068
I have noticed that I can replicate this error message, through the 'main' class I used to test the connection, if I remove the username/password arguments from the method I use to get the DB connection.
Is there anything that I'm missing to successfully use this WAS data source?
I have tested a WebLogic 10.3 connection and the CR Developer had no problem finding/using the connection?
Any help that can be provided would be greatly appreciated.
Below is the JDBC tag from the CRConfig.xml file that I'm using:
<JDBC>
<CacheRowSetSize>100</CacheRowSetSize>
<JDBCURL></JDBCURL>
<JDBCClassName></JDBCClassName>
<JDBCUserName></JDBCUserName>
<JNDIURL>iiop://server:bootstrap_address-port</JNDIURL>
<JNDIConnectionFactory>com.ibm.websphere.naming.WsnInitialContextFactory</JNDIConnectionFactory>
<JNDIInitContext>cell/clusters/clusterName/jdbc</JNDIInitContext>
<JNDIUserName>schema-username</JNDIUserName>
<GenericJDBCDriver>
<Option>No</Option>
<DatabaseStructure>catalogs,tables</DatabaseStructure>
<StoredProcType>Standard</StoredProcType>
<LogonStyle>Oracle</LogonStyle>
</GenericJDBCDriver>
</JDBC>
Thanks in Advance
Edited by: java_geek on Jul 28, 2010 3:31 AMHi all,
I've been tasked to get a JNDI connection from a WAS 6.1 server to a Oracle DB to use in developing a report.
The CR developer I'm using is CR Developer;Product Type: Full Product Version: 11.0.0.1282
I have created a simple Java 'main' class to test the JNDI connection using the following jars:
com.ibm.ws.admin.client_6.1.0.jar
com.ibm.ws.runtime_6.1.0.jar
com.ibm.ws.webservices.thinclient_6.1.0.jar
ibmorb.jar
ojdbc-14.jar
rsadbutils.jar
rsahelpers.jar
I have been able to retrieve data from the Oracle DB through the 'main' class and display it on the console.
However, after I set the CRConfig.xml file's classpath to use these jars, along with a jar I created that contains a jndi.properties file that contains the org.omg.CORBA.ORBClass=com.ibm.CORBA.iiop.ORB property because the JVM that the CR developer is pointing at is a Sun 1.6 HotSpot JVM.
When I try getting the connection, Database -> Database Expert -> Create New Connection -> JDBC (JNDI), select the JNDI Connection option and enter the relevant information, the developer finds the JNDI names that I'm looking for. Then I 'Click' the Finish button and receive the following error pop-up:
Logon Failed.
Details: SQL Exception: SQL State: null ERROR Message: Invalid argument(s) in callDSRA0010E: SQL State= null, Error Code = 17,068 Database Vendor Code: 17068
I have noticed that I can replicate this error message, through the 'main' class I used to test the connection, if I remove the username/password arguments from the method I use to get the DB connection.
Is there anything that I'm missing to successfully use this WAS data source?
I have tested a WebLogic 10.3 connection and the CR Developer had no problem finding/using the connection?
Any help that can be provided would be greatly appreciated.
Below is the JDBC tag from the CRConfig.xml file that I'm using:
<JDBC>
<CacheRowSetSize>100</CacheRowSetSize>
<JDBCURL></JDBCURL>
<JDBCClassName></JDBCClassName>
<JDBCUserName></JDBCUserName>
<JNDIURL>iiop://server:bootstrap_address-port</JNDIURL>
<JNDIConnectionFactory>com.ibm.websphere.naming.WsnInitialContextFactory</JNDIConnectionFactory>
<JNDIInitContext>cell/clusters/clusterName/jdbc</JNDIInitContext>
<JNDIUserName>schema-username</JNDIUserName>
<GenericJDBCDriver>
<Option>No</Option>
<DatabaseStructure>catalogs,tables</DatabaseStructure>
<StoredProcType>Standard</StoredProcType>
<LogonStyle>Oracle</LogonStyle>
</GenericJDBCDriver>
</JDBC>
Thanks in Advance
Edited by: java_geek on Jul 28, 2010 3:31 AM -
Generic Data Source is calling multiple times in RSA3
[color:red}<Moderator Message: This topic has alread been discussed a lot of times. Additionally there are weblogs related to it. Please search the forums and/or the blogs for this issue>
Hi experts,
I have the requirement to get data from Generic Data Sources with function Module,
after finishing the FM I have checked in extact checker(RSA)
in the internal table I_T_DATA is displays 281 records,
but in RSA3 it shows 112560 records, I found that the FM is calling multiple time by executing one time in RSA3.
1.what would be the problem
2.where is the porblem is it in FM coding or any other places to check.
<removed by moderator>
Regards
Vijay
Edited by: Siegfried Szameitat on Feb 3, 2009 11:45 AMHi Savita,
I don't understand clearly from your reply regarding flow you transported and what all you transported.
You need to first transport objects in R/3 and import them.
Then transport Infoprovider, Datasource in BI assuming depenedent Infoare Infoobject, application component already transported.
Then transport your Infosource, Update rule, Transfer rules, Infopackage.
Hope you understood.
Ravi -
Data Source in RDS Dataview times out in FlashBuilder 4
When I expand the Table icon in my oracle data source in RDS Dataview, after a few seconds, it dispays 'Read Timed out' error. However I am able to retrieve data using the RDS Query Viewer.
Here is the entry in myapp.xml located in C:\lcds\tomcat\conf\Catalina\localhost.
<Resource name="jdbc/myoracle" auth="Container"
type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@vahpdv02.server.com:1631:SOXDEV"
username="sox_owner" password="sox123" maxActive="20" maxIdle="30"
maxWait="-1"/>
Any ideas?Hi Pradeep,
Can you please try the following:
1. Check if the server settings are pointing to the web application which has RDS configured
2. Make sure you restart the server once you uncomment the RDSDispatchServlet in web.xml
3. Make sure the BlazeDS version you are using BlazeDS 4.0 and above. If not, see if this article helps http://sujitreddyg.wordpress.com/2009/06/01/using-flash-builder-4-for-earlier-blazeds-buil ds/
4. Try sending a request to http://<server-name>:<port>/<WebApplicationContext>/CFIDE/main/ide.cfm from your browser. You should get an error saying "GET" method is not supported. If not, probably the RDSDispatchServlet is not properly configured.
Hope this helps. -
JNDI Data Source Authentication
Why doesn't the following work?
public void getConnection(String dbuser, String dbpass) throws SQLException, NamingException {
Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup(DATA_SOURCE_NAME);
return ds.getConnection(dbuser,dbpass);
It seems like this authenticates against the WebLogic security realm, and not the database (which is what the Java API specifies). Is this supposed to be the case? How can I work around this so that SQL calls are made in the dbuser's name and not the credentials I supplied for the Data Source?
Message was edited by:
bernerbitsDerek Berner wrote:
Why doesn't the following work?
public void getConnection(String dbuser, String dbpass) throws SQLException, NamingException {
Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup(DATA_SOURCE_NAME);
return ds.getConnection(dbuser,dbpass);
It seems like this authenticates against the WebLogic security realm, and not the database
(which is what the Java API specifies). Is this supposed to be the case? How can I work
around this so that SQL calls are made in the dbuser's name and not the credentials I supplied for the Data Source?
Message was edited by:
bernerbitsHi. This is running as designed. The DataSource to a WebLogic JDBC connection
pool will be delivering one of the identically-made already existing connections
in the pool. As such the typical call is the no-argument getConnection() call.
We do implement weblogic security with the user/password form.
If you want a JDBC connection with a named user/password, you should
either have a pool with such ( and use the no-argument call) or you must
make a non-pooled direct connection. Note that you can have as many pools
as you want, each perhaps with only one connection, and you can dynamically
create pools.
For an upcoming release of WLS we will offer heterogenous (multiple DBMS
user) pools.
Joe -
I am starting up using Jdeveloper with the integrated WebLogic server. I immediately ran into the problem described in this thread:
http://forums.oracle.com/forums/message.jspa?messageID=3348590#3348590
I followed the instructions for the workaround, but i can't make it work. I have a couple of questions:
1. Step one of the workaround, <name>-jdbc.xml, is the <scope>Application tag the key change here? If yes, my file already had it.
2. As far as i can see, the weblogic-application.xml file is created automatically when i deploy. How do i edit the file?
3. Adding <property name="eclipselink.target-server" value="WebLogic_10"/> to persistence.xml, as suggested in the thread, causes deployment to fail with no specific error message.
4. What's the deal with the ".../jdbc/jdbc..." vs ".../jdbc..." part of the setup? I assume it should be ".../jdbc/jdbc...", but why the mix-up in the documentation?
5. Is there a fix available if i upgrade my Jdeveloper? Am i wasting my time on a workaround for an error that's been solved?
Can someone please help me out here?I ended up using a workaround instead.
-
FI_GL_10 Data source- ECC5.0 - Delta -Time stamp
Hi Guys,
I need detail information on FI_GL_10 datasource and how delta is enabled for this also the time stamp details.
Thanks in Advance
RameshDelta Update
After Images Marked for Deletion via Extractor (FI-GL/AP/AR)
In the delta process, the DataSource transfers the record data with the new status in each case. For this reason, the data cannot be updated directly to the InfoCube. The update is only possible using the ODS object (update with MOVE).
For safety, the delta process uses a lower interval setting of one hour (this is the default setting). In this way, the system always transfers all postings made between one hour before the last delta upload and the current time. The overlap of the first hour of a delta upload causes any records that are extracted twice to be overwritten by the after image process in the ODS object with the MOVE update. This ensures 100% data consistency in BW. -
How to birng the data in data sources for the first time
Dear Gurus,
For the Personnel Development (0PAPD) i installed the datasoures 0HR_PA_PD_1, 0HR_PA_PD_2 from ECC and checked in RSA3 I found 0 records.
My question is any configuration should be done to bring the data into datasources. But in ECC there module is implemented and gone live long back ago, they are telling data is there in tables also.
Regards,
KiranHi Kiran,
Please check with your HR functional consultant, whether the HR records are created with BW relevant infotype selected. For records to available in BW they have to maintain some infotype.
Regards,
Kams
Maybe you are looking for
-
How do I change the way that my company name appears when googled?
How do I change the way that my company name appears when it is googled? Currently it only shows up as part of my company name followed by the website listed below and then the start of a description. I would like to make it so my entire company na
-
Oracle 8.1.6 on Mandrake 7.2?
Has anyone been able to get the Universal Installer to work on Mandrake 7.2? It starts on my box, but then none of the buttons in the lower bar (Exit, Help, Installed products, Previous, and Next) work. It's weird, because if I click on "About Oracle
-
hi, <uix:option selected="" textBinding="uix.current['.']" valueBinding="uix.current['.']" />In the code above I would set a value selected after the values are returned to the form. If i write selected ="uix.current['.'] eq something"
-
Dyanamic Selection of Fields and prepare internal table dyanamically
Hi, How can we select fields dyanamically and create a dyanamic internal table for the fields created dyanamically. like from table KNC1 if user wants data from period 1 to 3 then for the following fields (UM01S,UM01H,UM01U,UM02S,UM02H,UM02U,UM03S,UM
-
3 way Color correction FCPX - eye dropper - whites/mid/black color picker -
- In every shot with my AF100, after a WHITE BALANCE - I shoot a white/grey/black card http://tinyurl.com/greycards - In FCP 7, in 3 way color correction, I use the eye dropper to pick each of these, this works very well, as opposed to guessing