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.
Similar Messages
-
How to create new JNDI Data source in Tomcat 5.0 server
hi ...
I have created new datasource but its giving an error like
ERROR: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: null
Nested Exception: java.lang.NullPointerException
please can anybody help me out to solve this bug ?
regards
djshivuThis problem is due to your files server.xml and web.xml. Have you modified them???
I ve the same problem, can you compare these files to mine (you can find my files here: http://forum.java.sun.com/thread.jspa?threadID=635640&tstart=0) -
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) -
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]
-
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
-
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,
matthi 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 -
Create two or more data sources and mapping to DSO
Hi,
I´m using SAP Netweaver BI 7.0.
If there are two or three data sources which have to be mapped to DSO which field from Data Sources has to be mapped to which field in DSO?
Is it possible to have only one DSO or should it be three DSOs because of the three Data Sources?
The thing is I have created one view out of three tables. For the view I have created one DSO. Everything worked fine. But now the requirements have changed because of currencies.
The view I have created is now mixing currencies because in the view is only one currency field, which is filled from the three tables. Two tables have different currencies and one table has one currency.
The one currency of the one table is important and should stay like it is.
I´m thinking about something like three different currency key fields in DSO which are mapped from data source. Also for every field of data source mapping with corresponding field in DSO.
Some hints? I have found articles in SDN about creating data sources and so on but they don´t help me in this matter.
Thank you in advance!Thank you guys for explaining! I´m new to SAP BW and trying to better understand.
I`ll try it also with the view. It sounds "easier".
But if I´m doing it with the 3 data sources, that means that for each currency field of the data source I will need an corresponding currency field in the DSO for mapping.
Is it possible to have 3 times the 0Currency field in the DSO and each data source currency field will be mapped to the DSO?
If that would work the 0Currency has to be contained in the key figures.
But if the 0Currency is contained in each key figure will the assignment of currency work correct?
+For example:+
Data Source1:
Turnover in Euro.
(All currency is in Euro)
Data Source2:
Profit in Dollar.
Profit in Euro.
Profit in Yen.
Profit in different currencies available.
Data Source3:
Sales in Dollar.
Sales in Euro.
Sales in Yen.
Sales in different currencies available.
For mapping from DataSources to DSO if it is possible to have 3 times 0Currency in DSO:
Data Source1 currency fiield ---> DSO 0Currency
Data Source2 currency fiield ---> DSO 0Currency
Data Source3 currency fiield ---> DSO 0Currency
Does it make sense? -
Create a ReportingServices data source and upload to a data connection library
I have installed reporting services 2012 in SharePoint 2013 integrated mode. I need to create a report data source and upload it to a data connection library using
C#.
As I know it uses the ReportingServices2010 class but I cannot explore a reporting server url.
There is a ReportingServices2010.asmx file in the 15 hive though.
Also it works fine when I manually set the data source.Hi,
The following materials would be helpful:
Inserting Data Connections into a SharePoint Library
https://social.technet.microsoft.com/Forums/en-US/df79dce5-fd92-4506-af4e-11127cb0d655/inserting-data-connections-into-a-sharepoint-library?forum=sharepointdevelopment
Programmatically exporting reports from SQL 2012 Reporting Services
http://stackoverflow.com/questions/12199995/programmatically-exporting-reports-from-sql-2012-reporting-services
Report Server Web Service Endpoints
http://msdn.microsoft.com/en-us/library/ms155398(v=sql.110).aspx
Best Regards
Dennis Guo
TechNet Community Support -
Help to read a table with data source and convert time stamp
Hi Gurus,
I have a req and need to write a ABAP prog. As soon as i excute ABAP program it should ask me enter a data source name, then my ABAP prog has excute teh code, in ABAP code i have to read a table with this data source as key, sort time stamp from table and should display the data source and time stamp as output.
As follows:
Enter Data Source Name:
Then user enters : 2lis_11_vahdr
Then out put should be "Data source :" 10-15-2008.
The time stamp format in table is 20,050,126,031,520 (YYYYMMDDhhmmss). I have to display as 05-26-2005. Any help would be apprciated.
Thanks,
RamHi Jayanthi Babu Peruri,
I tried to extract YEAR, MONTH, DAY separately and using
EDIT MASK written it.
Definitely there will be some STANDARD CONVERSION ROUTINE will be there. But no idea about it.
DATA : V_TS TYPE TIMESTAMP,
V_TS_T TYPE CHAR16,
V_YYYY TYPE CHAR04,
V_MM TYPE CHAR02,
V_DD TYPE CHAR02.
START-OF-SELECTION.
GET TIME STAMP FIELD V_TS.
V_TS_T = V_TS.
CONDENSE V_TS_T.
V_YYYY = V_TS_T.
V_MM = V_TS_T+4(2).
V_DD = V_TS_T+6(2).
V_TS_T(2) = V_MM.
V_TS_T+2(2) = V_DD.
V_TS_T+4(4) = V_YYYY.
SKIP 10.
WRITE : /10 V_TS," USING EDIT MASK '____-__-________'.
/10 V_YYYY,
/10 V_MM,
/10 V_DD,
/10 V_TS_T USING EDIT MASK '__-__-__________'.
If you want DATE alone, just declare the length of V_TS_T as 10.
Regards,
R.Nagarajan.
We can - -
I added 0AMOUNT in generic data source and in rsa3 i am seeing the data ..b
i added 0AMOUNT in generic data source and in rsa3 i am seeing the data ..but i am not seeing any data in target table..
what would be the causeHi,
I guess you mean the target table in BW, correct?
First replicate your DSource in BW
Open your TRules. In tab Transfer structure/Datasource locate your field in the right pane (should be greyed, not blue); move it from to the left (to the transfer structure); reactivate and reload.
You should now see the field in your PSA table.
hope this helps...
Olivier. -
The error below makes absolutely no sense! I'm using Enterprise Core...yet I'm being told I can't use remote data sources:
w3wp!library!8!03/05/2015-19:08:48:: i INFO: Catalog SQL Server Edition = EnterpriseCore
w3wp!library!8!03/05/2015-19:08:48:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: , Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: "The edition of Reporting
Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database." is not supported in this edition of Reporting Services.;
Really? This totally contradicts the documentation found here:
https://msdn.microsoft.com/en-us/library/ms157285(v=sql.110).aspx
That article says remote connections are completely supported.
ARGH! Why does this have to be so difficult to setup?!?Hi jeffoliver1000,
According to your description, you are using Enterprise Core edition and you are prompted that you can’t use remote data sources.
In your scenario, we neither ignore your point nor be doubt with what you say. But actually we have met the case before that even though the SQL Server engine is Enterprise but the reporting services is still standard. So I would recommend you to find the
actual edition of reporting services you are using. You can find Reporting Services starting SKU in the Reporting Service logs ( default location: C:\Program Files\Microsoft SQL Server\<instance name>\Reporting Services\LogFiles). For more information,
please refer to the similar thread below:
https://social.technet.microsoft.com/Forums/en-US/f98c2f3e-1a30-4993-ab41-acbc5014f92e/data-driven-subscription-button-not-displayed?forum=sqlreportingservices
By the way, have you installed the other SQL Server edition before?
Best regards,
Qiuyun Yu
Qiuyun Yu
TechNet Community Support -
Create a data source and database tables using WSAD
Hi, guys:
the following is from a tutorial:
http://www-106.ibm.com/developerworks/websphere/techjournal/0306_wosnick/wosnick.html
"To create the data source and Cloudscape database tables automatically, right click on the HelloWorldServer in the Servers view, and select the Create tables and data sources menu item. A dialog will then display showing that the data source and database tables were created successfully (Figure 5)."
I am using WSAD 5.0 trial version. I cannot find Create tables and data sources menu item if I right click on the HelloWorldServer in the Servers view. I am wondering if this is because trial version does not have this feature?
regardsThis question is a little off topic but you may get a reply. Please note this forum is about Sun's J2EE SDK and its related technologies. You may have better luck posting your question to an IBM specific resource.
-
Non transactional data source and ejb transaction
Inside an ejb method with trans-attribute = Required,
Do a bunch of things using a transactional data source and a bunch of things using
a non trasnactional data source.
Looks like the time spent doing the non-transactional data source related work
does not count for the transaction timeout defined for the ejb.
So, what happens here, the ejb transaction is suspended ( when I start using the
non transactional ds ) ?Hi,
"siddiqut" <[email protected]> wrote in message news:3fa7c79d$[email protected]..
Inside an ejb method with trans-attribute = Required,
Do a bunch of things using a transactional data source and a bunch of things using
a non trasnactional data source.
Looks like the time spent doing the non-transactional data source related work
does not count for the transaction timeout defined for the ejb.
So, what happens here, the ejb transaction is suspended ( when I start using the
non transactional ds ) ?The transaction is not suspended when you call something
which is not non-transactional.
Regards,
Slava Imeshev -
Maintaining attributes, data source and attribute list in web UI
Hi
Can we maintain attributes, data source and attribute list in web UI level. We can do it in SAP GUI level but do we have the option of doing it on web UI level??
Regards
AakshiHI
data sources and Attribute lists need to be maintained in GUI but these can further be used for Segmentation in Web UI using the Graphical Modeler.
hey main thing is that when we design all the things our out put is reflected in both interface & most important thing is that 90% of our customization done in gui.only web_ui related customization done in web_ui.
for more details revert me back
debi prasad -
Maintaining attributes, data source and attribute list in web UI level.
Hi
Can we maintain attributes, data source and attribute list in web UI level. We can do it in SAP GUI level but do we have the option of doing it on web UI level??
Regards
AakshiHi Aakshi,
As far as I know,data sources and Attribute lists need to be maintained in GUI but these can further be used for Segmentation in Web UI using the Graphical Modeler.
If you need more assistance please do revert.
Regards
Varun Taneja
Maybe you are looking for
-
Need Avg sales for 90 fiscal days - thru customer exit or Offset ? ? ? ?
Hi Frns! My current report generates daily sales for fiscal period using a customer exit variable A. My requirement now is to have one more column having Average sales for 90 prior fiscal days when i enter a fiscal period thru the same variable A. As
-
Inconsistency with maintenance cycle and task list phases in ChaRM
Hi Experts, I'm deploying ChaRM with SolMan 4.0 SP09. I was testing a scenario where there are more than one maintenance project open for same landscape (different logical components but values are the same). I have been using maintenance cycle docum
-
Can I run Mac OS 8.1 on Mac OS 10.8?
How do I? I'm trying, but I just can't. Any help would be much appreciated. Thank you!
-
I have downloaded missing artwork, using Google images, into i-tunes. I expected this to be automatically transferred to my i-phone when I connected it but nothing happened, How can I transfer the artwork into my i-phone?
-
Creative Zen Stone Plus Returns First Track On Player After Recharge
? Hi Everybody... I didn't see this topic posted on another thread, but I wasn't going to read thousands of posts to get this answer either. My problem is I own two players, one is a Creative Zen Stone and the other is the Zen Stone Plus. My Zen Ston