Data Source auto commit
I'm using CMP and whenever I get an Oracle connection from my data source, autocommit is set to true. Hence, whenever there is an exception in my application, CMP is useless because nothing ever gets rolled back. Shouldn't OC4J set autocommit to false when it returns the connection?
W,
Pardon me if this is a silly question, but if you are using CMP, then you shouldn't need to get an Oracle connection from your data source (should you)?
Now if you were using BMP (like I do), then you would definitely need to get an Oracle connection from your data source. Now when I set autcommit to FALSE (on my Oracle connection that I get from the data source, inside my BMP entity bean), it works fine for me.
I am using OC4J (stand-alone) 9.0.4 on SUN [sparc] Solaris 9 and JDK 1.4.2 with Oracle 9.2.0.4 database (also under Solaris 9).
Good Luck,
Avi.
Similar Messages
-
Data-source.xml - BaseResourceException - two phase commit
Hi,
I am seeing the following exception. Please let me know how to fix this.
thanks
Sunita
com.sap.engine.services.connector.exceptions.BaseResourceException: The resource "xxx" does not support two-phase commit and cannot be enlisted in the current transaction, because another non supporting two-phase commit resource is already enlisted for component "webContainer/applications/JavaEE/YY-TPRO/YYr-TPRO" in application "JavaEE/YY-TPRO". Only one of the enlisted resources is allowed to be non two-phase commit compliant.
I am using JDBC 1.x datasource, and the .xml looks like this:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE data-sources SYSTEM 'data-sources.dtd'>
<data-sources>
<application-name>JavaEE/yy-TPRO</application-name>
<data-source>
<data-source-name>xxx</data-source-name>
<alias>jdbc/xxyyDB/TPRO</alias>
<driver-name>OracleThin</driver-name>
<init-connections>1</init-connections>
<max-connections>20</max-connections>
<max-time-to-wait-connection>60</max-time-to-wait-connection>
<sql-engine>vendor_sql</sql-engine>
<jdbc-1.x>
<driver-class-name>oracle.jdbc.driver.OracleDriver</driver-class-name>
<url>jdbc:oracle:thin:@sol-mercury:1521:hermes</url>
<user-name>abcd</user-name>
<password>abcd</password>
</jdbc-1.x>
</data-source>
</data-sources>HI,
Thanks for the response, I already went through these threads.
My exception seems to be related to this - Problem with connection sharing if J2EE transaction is running
and suggested solutions seems to be:
The problem is caused when there is an inappropriate attempt to open a second connection in an active JTA transaction. There is either an attempt to get a second connection from an un-shareable non-XA DataSource or an attempt to get it from another non-XA DataSource. You have to:
● Use no more than one connection from this data source while the JTA transaction is active or
● Declare the data source as shareable, depending on your application logic.
Question is, How can I make data source as shareable??
This application worked fine in JBoss, weblogic and now we are trying to port it to NetWeaver.
Is any of the above options are configurable in data-sources.xml?
Thanks for your guidance and response.
Surekha -
ADF Service Interface: two-phase commit issue for multiple data sources
In FusionApps, For a service interface we had to use two DataSource resources (in the ejb-jar.xml),
one is ApplicationServiceDBDS for SI and the other one is ApplicationDBDS(I don’t know the exact reason why this is needed, but when running the webservice, Framework was throwing an error asking for this) After adding these two, now(while running the webservice) we’re caught up with an error saying that unable to participate in two phase commit. I think this is because we added two dataSources, if we just use one dataSource everything is working fine.
Error message from app server:
"JDBC driver does not support XA, hence cannot be a participant in two-phase commit. To force this participation, set the GlobalTransactionsProtocol attribute to LoggingLastResource (recommended) or EmulateTwoPhaseCommit for the Data Source=ApplicationDB"
we have made the changes to ApplicationDB as said in the error message, but then the server is failing to start because of this.Hi,
this is what the doc says - though not about two phase commit but transaction sharing:
"At runtime, the calling client and the ADF service may or may not participate in the same transaction, depending on the protocol used to invoke the service (either SOAP or RMI). Only the RMI protocol and a Java Transaction API (JTA) managed transaction support the option to call the service in the same transaction as the calling client."
When your application accesses a remote ADF Business Components service, each remote call is stateless, and the remote service will not participate in the same transaction as the business component that uses a service-enabled application module's service interface.
In the majority of the cases, calls to remote services will be informational in nature and will not make changes to remote objects. However, if you must use a remote service to make changes, then keep these points in mind:
An exception thrown by the remote service will cause the local transaction to fail.
If you successfully call a remote service that results in modifying data, and then subsequently your local transaction fails for any reason, then it is the responsibility of your error handling code to perform a compensating transaction against the remote service to "undo" the previous change made."
http://docs.oracle.com/cd/E23943_01/web.1111/b31974/bcextservices.htm
Frank -
to the sun team,
i have been using NB+VWP to deploy an application created in JSCU2 to a Sun App Server 9.
for some reason, whenever am viewing a DB connection in the servers window and drag-drop a table on the page, the system is automatically creating a new data source, a new conneciton pool, and new jdbc resource. also, it is removing the necessary references in web.xml and sun-web.xml.
is there any way to get around this? otherwise, i am forced to modify the jdbc settings in the server as well as the config file each i drag-drop a DB table/view.
thanks so much
- PeterUnfortunately, this is a bug and should be fixed in the next release.
I'll look for the issue id.
In the meantime, this workaround may help:
http://wiki.netbeans.org/wiki/view/VWPUserFAQsavewebxml
John Baker
http://blogs.sun.com/dashboy -
Auto-Commit and Pooled JDBC Connections
Forum Members,
If I am using Oracle Pooled JDBC Connections in the OC4J container is auto-commit set to "true" by default?
If I set auto-commit to "false" and then close the logical connection, when that connection is handed out again on a later call to getConnection(), is auto-commit automatically set back to "true"?
Thanks,
RichardRichard,
Pardon me if I am stating the obvious, but you could test that in your code by invoking the getAutoCommit() method in interface java.sql.Connection.
My experience (with OC4J stand-alone versions up to -- and including -- 10.1.2) is that the behaviour depends on which data source you have configured. For example, if you have defined an "ejb-location" attribute in your "data-sources.xml" file, and you use that as your JNDI lookup for your data source, then OC4J handles transactions and you shouldn't deal with "auto-commit" at all. See the following post for more details:
Re: OC4J 10.1.3 Preview 4 - Global transaction active
But if you have defined a "location" attribute and use that, then you do need to handle transactions explicitly.
Hope this helps.
Good Luck,
Avi. -
PowerPivot report data refresh error Data source as SharePoint list Data Feed
Hi All,
I am facing a problem on auto refresh, the report data source is SharePoint list Data Feed, I saved it my PC desktop when I set up auto fresh it fails then I moved the SharePoint list data feed "atomsvc" file to A SharePoint Data feed library then connected
to report started a manual refresh it was success, after next schedules it failed.
Error massage:
Errors in the high-level relational engine. The following exception occurred while the managed IDbConnection interface was being used:
The network path was not found. ;The network path was not found. The network path was not found. .
A connection could not be made to the data source with the DataSourceID of '82f49f39-45aa-4d61-a15c-90ebbc5656d',
Name of 'DataFeed testingreport'. An error occurred while processing the 'Testing Report' table. The operation has been cancelled.
Thank you very much !
erkindunyaIf you are using Claims Auth then this is a known limitation. Auto refresh only works under Classic Auth.
I trust that answers your question...
Thanks
C
http://www.cjvandyk.com/blog |
LinkedIn | Facebook |
Twitter | Quix Utilities for SharePoint |
Codeplex -
Diff b/w infosource and data source
hai all
can any one tell me abt the difference b/w infosource and datasource in b.w?.and also abt the infopackage and how the later relates with the former?.
thanxs
sriHi Srinivas,
Data source: It provides the data of source system,created in source systenm side and then replicated in BW side.Itis one which provides the data available in the tables to the BW System.A group of fields which are coming from one or more tables is called as datasource.Data will not be resided in the datasource.It will be present in the Tables.Using Datasource we extract the data into BW.
_TYPES OF DATASOURCE: _
datasource for transction data
datasource for char attributes
datasource for texts
datasource for hierarcy (att,texts, hier are master data datasources)
InfoSource: It is the source of meaningfull data for data target...created in BW side..it is basically logical pool of data ( no physical storage) from one or different data source... It is on the BW which contains all the InfoObjects. It contains transfer structure and communication structure. Transfer structure is actually the structure similar to the R/3 Datasource structure and comm. structure contains all the InfoObjects.
in 3.5 it has two types of infosource... flexible update(transction data) and direct update (master data)
core parts: communiation structure and transfer structure...
and infosourc in 7 you logicallcy group striaght infoobjects......
*PLS Search SDN for all ur Basic BW Queries*
*pls assign points,if info is useful*
Regards
CSM reddy -
Using Excel & ODBC data source to get data
I've been using MS Excel to extract MS SQL Server data from our ERP system for years but we are now moving to Oracle 12i. What are my options in the Oracle world? Can it be configured much the same way; that is by configuring an ODBC data source and connecting directly to the database???
Thanks in advance.user11307988 wrote:
I've been using MS Excel to extract MS SQL Server data from our ERP system for years but we are now moving to Oracle 12i. What are my options in the Oracle world? Can it be configured much the same way; that is by configuring an ODBC data source and connecting directly to the database???
Thanks in advance.Adding to sb92075's brief but accurate statement, from one of my recent presentations (note - no need for an ODBC connection):
'Need to add a reference to Microsoft ActiveX Data Objects 2.8 Library before starting
'*** This section might be in the top portion of the user form, worksheet code, or module:
'Declare a connection object in the general section to hold the connection to the database
Dim dbVMFG As ADODB.Connection
'Declare a set of variables to hold the username and password for the database
Dim strUserName As String
Dim strPassword As String
Dim strDatabase As String
Dim i as Integer
Dim intResult As Integer
Dim strSQL as String
Dim lngRow as Long
On Error Resume Next
strDatabase = "MyDB"
strUserName = "MyUser"
strPassword = "MyPassword"
'Connect to the database
'Oracle connection string
Set dbVMFG = New ADODB.Connection
dbVMFG.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=" & strDatabase & ";User ID=" & strUserName & ";Password=" & strPassword & ";ChunkSize=1000;FetchSize=100;"
dbVMFG.ConnectionTimeout = 40
dbVMFG.CursorLocation = adUseClient
dbVMFG.Open
If (dbVMFG.State <> 1) Or (Err <> 0) Then
intResult = MsgBox("Could not connect to the database. Check your user name and password." & vbCrLf & Error(Err), 16, "Excel Demo")
Else
strSQL = "SELECT" & VBCrLf
strSQL = strSQL & " ID AS RESOURCE_ID," & VBCrLf
strSQL = strSQL & " DESCRIPTION" & VBCrLf
strSQL = strSQL & "FROM" & VBCrLf
strSQL = strSQL & " MY_TABLE" & VBCrLf
strSQL = strSQL & "WHERE" & VBCrLf
strSQL = strSQL & " DESCRIPTION LIKE '%10%'" & VBCrLf
strSQL = strSQL & "ORDER BY" & VBCrLf
strSQL = strSQL & " ID"
'Add a new worksheet to the new workbook, add after the last sheet
ActiveWorkbook.Sheets.Add
ActiveWorkbook.ActiveSheet.Name = "JustATest"
snpData.Open strSQL, dbVMFG
If snpData.State = 1 Then
'Slow Method------------------------------------
lngRow = 0
'Header Row
For i = 0 To snpData.Fields.Count – 1
lngRow = lngRow + 1
ActiveSheet.Cells(lngRow, i + 1).Value = snpData.Fields(i).Name
ActiveSheet.Cells(lngRow, i + 1).Font.Bold = True
Next i
'Detail Rows
Do While Not snpData.EOF
lngRow = lngRow + 1
For i = 0 To snpData.Fields.Count - 1
ActiveSheet.Cells(lngRow, i + 1).Value = snpData.Fields(i)
Next i
snpData.MoveNext
Loop
'End Slow Method------------------------------------
'Fast Method----------------------------------------
'Do not use this and the slow method!
For i = 0 To snpData.Fields.Count - 1
ActiveSheet.Cells(1, i + 1).Value = snpData.Fields(i).Name
Next i
ActiveSheet.Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(1, snpData.Fields.Count)).Font.Bold = True
ActiveSheet.Range("A2").CopyFromRecordset snpData
'Auto-fit up to 26 columns
ActiveSheet.Columns("A:" & Chr(64 + snpData.Fields.Count)).AutoFit
'End Fast Method----------------------------------------
snpData.Close
End If
End IfA couple of notes:
1. Do not repeatedly connect to the database, execute a SQL statement, and disconnect from the database - connect once and stay connected.
2. Use bind variables where possible in SQL statements for constants (literals) which might change from one execution to the next - let me know if you need s code example showing bind variable usage in Excel.
Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc. -
Trying to change the data source for a Crystal Report.
<p>The method below represents my best attempt to programatically change the data source of a Crystal Report. The goal is to have a routine that will update the data source for reports after they have been distributed to production servers. So far I have not been successful in saving the report back to the CMS. No exceptions are thrown, but when I view the Database Configuration of the report in the CMC nothing has changed.
</p>
<p>
Am I missing a step, or is there another way to accomplish this?
</p>
<p>
Thank you.
</p>
<hr />
<pre>
private void test(String reportName)
throws SDKException, ReportSDKException, java.io.IOException
IInfoObjects newInfoObjects;
IInfoObject reportObj;
ReportClientDocument clientDoc = new ReportClientDocument();
DatabaseController dc;
PropertyBag pBag;
PropertyBag logonProps;
ConnectionInfo newConInfo;
ConnectionInfo oldConInfo;
ConnectionInfos conInfos;
int connOptions = DBOptions._ignoreCurrentTableQualifiers + DBOptions._doNotVerifyDB; //0;
Fields connFields = null;
String queryStr = "Select * From CI_INFOOBJECTS " +
"Where SI_NAME='wfr.rpt' AND SI_KIND='CrystalReport' AND SI_INSTANCE=0";
newInfoObjects = getCms().executeQuery(queryStr);
if(newInfoObjects.size() > 0)
reportObj = (IInfoObject)newInfoObjects.get(0);
try
clientDoc = getCms().getReportAppFactory().openDocument(
reportObj
, OpenReportOptions._refreshRepositoryObjects
, java.util.Locale.US);
dc = clientDoc.getDatabaseController();
conInfos = dc.getConnectionInfos(null);
for(int i = 0; i < conInfos.size(); ++i)
oldConInfo = (ConnectionInfo)conInfos.getConnectionInfo(i);
newConInfo = (ConnectionInfo)oldConInfo.clone(true);
pBag = newConInfo.getAttributes();
pBag.putStringValue("QE_ServerDescription", "alio");
logonProps = new PropertyBag();
logonProps.putStringValue("Trusted_Connection", "false");
logonProps.putStringValue("Server", "alio");
pBag.put("QE_LogonProperties", logonProps);
newConInfo.setUserName("admin");
newConInfo.setPassword("password");
dc.replaceConnection(
oldConInfo
, newConInfo
, connFields
, connOptions);
catch(ReportSDKServerException Ex)
String msg = "A server error occured while processing the " + reportObj.getKind()
+ " object, " + reportObj.getTitle() + " (" + reportObj.getCUID() + "), from the CMS.";
Utility.errorOut(msg, Ex);
catch(Exception Ex)
String msg = "An error occured while processing the " + reportObj.getKind()
+ " object, " + reportObj.getTitle() + " (" + reportObj.getCUID() + "), from the CMS.";
Utility.errorOut(msg, Ex);
finally
clientDoc.save();
getCms().commitToInfoStore(newInfoObjects);
clientDoc.close();
</pre>
Edited by: Mark Young on Sep 10, 2009 2:16 PM<style type="text/css">
/<![CDATA[/
body
font-size: 1.125em;
font-family: helvetica,arial,"sans-serif";
.code{font-family: "courier new",courier,mono,monospace}
.bi{font-style: italic; font-weight: bold;}
/]]>/
</style>
<p>Justin,</p>
<p>
Thank you for the reply. Time constraints have not allowed me to post back to this tread
till now. I will try your suggestion. My assumption is that <i>Save the report back to the
info store</i> refers to <span class="code">IInfoStore.commit(IInfoObjects)</span>.
</p>
<p>
I'm afraid that I do not understand why I don't want to change the report client document,
or why <i>successfully exporting the report with the new login/password</i> is not what I
want to do. Any explanation on that statement would be appreciated.
</p>
<p>
I did find a way to accomplish my goal. It involved adding the SSOKEY property to the
logon property bag. Below you'll see my revised code which modifies the report logon and
server. I have no idea what
this does, and SAP support has not been able to tell me why it works. However, what I
discovered is that if I changed the report option, <b>Database Configuration -> When
viewing report:</b>, in the CMS to <span class="bi">Use same database logon as when report
is run</span> from <span class="bi">Prompt the user for database logon</span>, then the
SSOKEY property had been added to the logon property bag having an empty string as its
value. This allowed me to successfullyupdate and save the modified logon back to the CMS.
</p>
<p>
So I took a chance and added code to always add the SSOKEY property with an empty string
as its value, and I could then successfully modify and save the report's logon info
and server. Again, I don't know what this means, but it has worked so far. If anyone has
some insight or comments, either are welcome. Thank you in advance.
</p>
<br />
<hr />
<pre>
private void changeDataSourceOfAWFCrystalReports()
throws SDKException, ReportSDKException, java.io.IOException
IInfoObjects newInfoObjects = null;
IInfoObject reportObj = null;
IReport curReport = null;
ReportClientDocument clientDoc = new ReportClientDocument();
DatabaseController dbController;
PropertyBag pBag;
PropertyBag logonProps;
ConnectionInfo newConInfo;
ConnectionInfo oldConInfo;
ConnectionInfos conInfos;
int connOptions = DBOptions._ignoreCurrentTableQualifiers + DBOptions._doNotVerifyDB;
Fields connFields = null;
String outputStr;
int numOfReports;
int numOfQueryPages;
double progressIncrementPerPage = 30;
int progressIncrementPerReport = 0;
// Path query to reports is in a .properties file.
String queryStr = getAppSettingsFile().getWscAwfCrystalReportPathQuery();
try
// Executes IInfoStore.getPageingQuery() and generates a list of queries.
getCms().setPathQueryQueries(queryStr, 100);
numOfQueryPages = 0;
// Gets a List<String> of the IPageResult returned from IInfoStore.getPageingQuery().
if(getCms().getPathQueryQueries() != null)
numOfQueryPages = getCms().getPathQueryQueries().size();
if(numOfQueryPages > 0)
// Use 30% of progress bar for the following loop.
progressIncrementPerPage = Math.floor(30.0/(double)numOfQueryPages);
for(int queryPageIndex = 0; queryPageIndex < numOfQueryPages; ++queryPageIndex)
// Gets the IInfoObjects returned from the current page query
newInfoObjects = getCms().getPathQueryResultSetPage(queryPageIndex);
numOfReports = newInfoObjects.size();
if(newInfoObjects != null && numOfReports > 0)
progressIncrementPerReport =
Math.round((float)Math.floor(progressIncrementPerPage/(double)numOfReports));
for(int reportIndex = 0; reportIndex < numOfReports; ++reportIndex)
reportObj = (IInfoObject)newInfoObjects.get(reportIndex);
curReport = (IReport)reportObj;
clientDoc = getCms().getReportAppFactory().openDocument(
reportObj
, OpenReportOptions._refreshRepositoryObjects
, java.util.Locale.US);
dbController = clientDoc.getDatabaseController();
conInfos = dbController.getConnectionInfos(null);
for(int conInfosIndex = 0; conInfosIndex < conInfos.size(); ++conInfosIndex)
oldConInfo = (ConnectionInfo)conInfos.getConnectionInfo(conInfosIndex);
newConInfo = (ConnectionInfo)oldConInfo.clone(true);
pBag = newConInfo.getAttributes();
pBag.putStringValue(
"QE_ServerDescription"
,getConfigFile().getDBDataSourceConnections());
logonProps = new PropertyBag();
logonProps.putStringValue("Trusted_Connection", "false");
<b>logonProps.putStringValue("SSOKEY", "");</b>
logonProps.putStringValue(
"Server"
,getConfigFile().getDBDataSourceConnections());
pBag.put("QE_LogonProperties", logonProps);
newConInfo.setUserName(getConfigFile().getUNVConnectionUserName());
newConInfo.setPassword(getConfigFile().getUNVConnectionPasswordDecrypted());
dbController.replaceConnection(
oldConInfo
, newConInfo
, connFields
, connOptions);
newConInfo = (ConnectionInfo)conInfos.getConnectionInfo(conInfosIndex);
} // end for on conInfosIndex
clientDoc.save();
} // end for on reportIndex
} // end if on newInfoObjects
} // end for on queryPageIndex
} // end try
catch(ReportSDKServerException Ex)
// handle...
catch(Exception Ex)
// handle...
finally
getCms().commitToInfoStore(newInfoObjects);
if(clientDoc != null)
clientDoc.close();
</pre> -
Refresh data source view gets 'column' argument cannot be null
When I try to refresh a data source view in SQL Server 2008 BIDS, I get the error: System.Data 'column' argument cannot be null. Parameter name: column. How to resolve this? The underlying tables have no data yet.
Hi PCSQL66,
The error message should be caused by FOREIGN KEY constraint auto-generated. If you
add a FOREIGN KEY to the generated table, then you will see the error message after clicking refresh button. Please submit this issue to below official link and then post the link back here, I think we need to get confirmation from product group.
http://connect.microsoft.com/SQLServer
Thanks,
RaymondRaymond Li - MSFT -
We are adding field GAMNG ( Target Quantity ) in the Data Source 2LIS_04_P_ARBPL ( Work Center View from PP/PP-PI )
The field GAMNG is available in the communication structure maintainace.
The problem is- We are not able to drag & drap field GAMNG from the Communication structure LBWE. Getting the error - End phase 002 ***********************************************************
Message no. D0322 ..
We deleted Setup table , Meins field already exist in comm str.
1. How we able to drag the field from the communication structure as getting the above error. We searched SDN & try to follow that method but not working.
2. We can add the field in SE11 - Structure -Manually, then we have to write ABAP code.
Kindly suggest correct answer.
Edited by: sk kamaruzzaman on Dec 20, 2011 2:08 PMHi,
There could be a number of reasons why you are getting the error:
1. Fields are not assigned to datatypes.
- Check structure in SE11 and assign to datatypes.
2. There are inactive appends in the extract structure.
- Double-click one of the includes. You will get a new screen with the INCLUDE structure. Click the button append-structure. Check if the append is inactive.
3. The appended structure is in a different development class from the one of the structure it is being appended to.
Please review and apply the following notes carefully :
766603 Activation problems with extract structures
623411 LBWE: Gener. terminates with D0 322 (end phase 002)
757923 LBWE: Generation terminates with D0 322 (end phase
600708 D0 322: End phase 002
It is not possible to enhance the datasource 2lis_04_MATNR with the field GAMNG (so its possible that its the same for 2LIS_04_P_ARBPL) because GAMNG has the reference field AMEIN, which has a STATE F (forbidden) in table TMCEXCFS .
Check to see if this is the same on your system.
Rgds,
Colum -
Using InfoPath and the Web service GetUserProfileByName-An error occurred accessing a data source
Hi, Everyone,
I want to realize the function that when user fills out the infopath form the form can automatically get current users' name and I've searched that I can use the Web service GetUserProfileByName method. When I preview the form it is all right, however, when
I fill the form online, it occurs this error as folllowing. Anyone knows why and how to solve this problem?
Thanks forward!
Warning
An error occurred querying a data source.
Click OK to resume filling out the form. You may want to check your form data for errors.
Hide error details
An error occurred while trying to connect to a Web service.
An entry has been added to the Windows event log of the server.
Log ID:5566
Correlation ID:9c23d39c-18fa-1025-c7ec-600a1582a54aHi,
According to your post, my understanding is that you get error when using the Web service GetUserProfileByName in InfoPath.
Have the InfoPath form template call web service in code? If yes, please see following KB and check if it is the cause.
http://support.microsoft.com/kb/981684
You can also
follow the steps in the article to resolve this error in InfoPath. Please refer to:
Auto Populate User Information in InfoPath with Claims Based Authentication in SharePoint – Part 2 of 3
In addition, you need to disable the Loopback check.
Here is a similar thread for your reference:
https://social.technet.microsoft.com/Forums/en-US/d6d20308-a5d0-45fa-881d-0626c68c4e73/infopath-an-entry-has-been-added-to-the-windows-event-log-of-the-server-logid-5566?forum=sharepointcustomizationprevious
Best Regards,
Linda Li
Linda Li
TechNet Community Support -
Hello Forum,
I have a question regarding usage of a MySQL-Data-Source in combination with JPA
on the SAP NetWeaver Application Server, Java EE 5 Edition.
I have setup a custom datasource like explained in paper:
"Working with Database Tables, DataSources and JMS Resources"
- registered the database driver via telnet (Using mysql-connector-java-5.0.3-bin.jar)
- created the data-sources.xml file underneath the META-INF dir of the EAR project
[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data-sources SYSTEM "data-sources.dtd" >
<data-sources>
<data-source>
<data-source-name>titan_cruises_ds</data-source-name>
<driver-name>mysql-connector-java-5.0.3-bin.jar</driver-name>
<init-connections>1</init-connections>
<max-connections>10</max-connections>
<max-time-to-wait-connection>60</max-time-to-wait-connection>
<expiration-control>
<connection-lifetime>600</connection-lifetime>
<run-cleanup-thread>60</run-cleanup-thread>
</expiration-control>
<sql-engine>native_sql</sql-engine>
<jdbc-1.x>
<driver-class-name>com.mysql.jdbc.Driver</driver-class-name>
<url>jdbc:mysql://ourHost.internal.com:3306/practise_titan_cruises</url>
<user-name>myUser</user-name>
<password>myPass</password>
</jdbc-1.x>
</data-source>
</data-sources>
[/code]
After that I manually created the persistence.xml underneath the META-INF dir of the EJB project.
[code]
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="titan_cruises_pu">
<jta-data-source>titan_cruises_ds</jta-data-source>
</persistence-unit>
</persistence>
[/code]
After that I created the Entity named "Cabin" and the corresponding table within the db.
Entity code:
[code]
package de.collogia.beans.pojo.ship;
import java.io.IOException;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
This persisted POJO class models the cabin data.
<p>
In this class persistence annotations are placed on the getter methods
of the attributes. This tells the persistence manager to access them
via the corresponding get- and set-Methods.</p>
(Unfortunately this does not work on NetWeaver and I had to place them
on field level aggain...)
@author Henning Malzahn ([email protected])
svn-revision: $Rev:: 670 $:
svn-lasted-edited-by: $Author:: henning $:
svn-last-changed: $Date:: 2007-02-21 21:49:51 +0100 (Wed, 21 Feb 2007) $:
@Entity
@Table(name = "cabin")
public class Cabin implements Serializable {
/** The generated serial version UID used for serialization. */
private static final long serialVersionUID = -8522497314498903378L;
/** The actual version number of this class used for serialization. */
private static int actualVersion = 1;
/** The cabin's id. */
@Id
@GeneratedValue
@Column(name = "id")
private long id;
/** The cabin's name */
@Column(name = "name")
private String name;
/** The cabin's deck level */
@Column(name = "deck_level")
private int deckLevel;
/** The cabin's ship id */
@Column(name = "ship_id")
private int shipId;
/** The cabin's bed count */
@Column(name="bed_count")
private int bedCount;
/---- Serialization/ Deserialization methods -/
Method that is responsible for deserialization of the object.
@param in The <code>ObjectInputStream</code> object to read
the data from.
@throws IOException That may occur when reading from the
<code>ObjectInputStream</code> object
@throws ClassNotFoundException That may occur when invoking the default
deserialization mechanism.
private void readObject(final java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
/* Invoke default deserialization mechanism. */
in.defaultReadObject();
/* Read the actual version number of the class. */
actualVersion = in.readInt();
} // End of readObject()
Method that is responsible for serialization of the object.
@param out The <code>ObjectOutputStream</code> object to write
the data to.
@throws IOException That may occur when writing to the
<code>ObjectOutputStream</code> object.
private void writeObject(final java.io.ObjectOutputStream out)
throws IOException {
/* Invoke default serialization mechanism. */
out.defaultWriteObject();
/* Write the actual version number of the class. */
out.writeInt(actualVersion);
} // End of writeObject()
/---- Defining constructors -/
Private default constructor.
private Cabin() {
} // End of default constructor
Full constructor.
@param name The cabin's name.
@param deckLevel The cabin's deck level.
@param shipId The cabin's ship id.
@param bedCount The cabin's bed count.
public Cabin(final String name,
final int deckLevel,
final int shipId,
final int bedCount) {
this.name = name;
this.deckLevel = deckLevel;
this.shipId = shipId;
this.bedCount = bedCount;
} // End of full constructor
/---- Overridden class methods -/
Returns a string representation of the cabin's data.
@see java.lang.Object#toString()
@Override
public String toString() {
StringBuffer strBuf = new StringBuffer();
strBuf.append(this.name);
strBuf.append("\n");
strBuf.append(this.deckLevel);
strBuf.append("\n");
strBuf.append(this.shipId);
strBuf.append("\n");
strBuf.append(this.bedCount);
return strBuf.toString();
} // End of toString()
/---- Defining instance methods -/
Get method for the member "<code>id</code>".
@return Returns the id.
public long getId() {
return this.id;
Set method for the member "<code>id</code>".
HTDODO hm: Check whether it is possible to have setId method
using private accesss level with NetWeaver JPA-Provider!
@param id The id to set.
private void setId(final long id) {
this.id = id;
Get method for the member "<code>name</code>".
@return Returns the name.
public String getName() {
return this.name;
Set method for the member "<code>name</code>".
@param name The name to set.
public void setName(final String name) {
this.name = name;
Get method for the member "<code>deckLevel</code>".
@return Returns the deckLevel.
public int getDeckLevel() {
return this.deckLevel;
Set method for the member "<code>deckLevel</code>".
@param deckLevel The deckLevel to set.
public void setDeckLevel(final int deckLevel) {
this.deckLevel = deckLevel;
Get method for the member "<code>shipId</code>".
@return Returns the shipId.
public int getShipId() {
return this.shipId;
Set method for the member "<code>shipId</code>".
@param shipId The shipId to set.
public void setShipId(final int shipId) {
this.shipId = shipId;
Get method for the member "<code>bedCount</code>".
@return Returns the bedCount.
public int getBedCount() {
return this.bedCount;
Set method for the member "<code>bedCount</code>".
@param bedCount The bedCount to set.
public void setBedCount(final int bedCount) {
this.bedCount = bedCount;
} // End of class Cabin
[/code]
After that I created the TravelAgentBean, a Stateless Session Bean, implementing
a remote interface that allows construction and persisting of new Cabin objects:
[code]
package de.collogia.beans.session.stateless;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import de.collogia.beans.pojo.ship.Cabin;
Class that implements the <code>TravelAgentRemote</code> interface
and defines the business methods of the TravelAgent service.
@author Henning Malzahn ([email protected])
svn-revision: $Rev:: 670 $:
svn-lasted-edited-by: $Author:: henning $:
svn-last-changed: $Date:: 2007-02-21 21:49:51 +0100 (Wed, 21 Feb 2007) $:
@Stateless
public class TravelAgentBean implements TravelAgentRemote {
/** The <code>Log</code> object for this class. */
// private static final Log LOGGER;
/** The <code>PersistenceManager</code> object. */
@PersistenceContext(unitName = "titan_cruises_pu")
EntityManager em;
/---- Static initializer -/
// static {
// LOGGER = LogFactory.getLog(TravelAgentBean.class);
// } // End of static initializer block
/---- Implementing remote interface methods -/
{@inheritDoc}
public void createCabin(final Cabin cabin) {
this.em.persist(cabin);
} // End of createCabin()
} // End of class TravelAgentBean
[/code]
After that I created a Controller class containing a main method that looks up the remote
interface of the TravelAgentBena like explained in document "Accessing Enterprise JavaBeans Using JNDI
in SAP NetWeaver Application Server, Java EE 5 Edition" written by Validimir Pavlov of SAP NetWeaver
development team.
Unfortunately I receive an Exception after invoking the createCabin(...) method.
On the console of the NWDS I receive:
[code]
javax.ejb.EJBException: Exception in getMethodReady() for stateless bean sap.com/test2Earannotation|test2Ejb.jarannotation|TravelAgentBean;
nested exception is: com.sap.engine.services.ejb3.util.pool.PoolException: javax.ejb.EJBException: Cannot perform injection over bean instance
Caused by: java.lang.RuntimeException: The persistence unit is inconsistent:
The entity >>de.collogia.beans.pojo.ship.Cabin<< is mapped to the table >>cabin<<, which does not exist.
[/code]
But if I look at the log file located in "C:\NWAS_JAVAEE5\JP1\JC00\j2ee\cluster\server0\log\defaultTrace.0.trc"
I see the real reason is:
[code]
[EXCEPTION]
#6#1064#42000#You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax
to use near '"cabin"' at line 1#collnx02.collogia.de:3306:null:practise_titan_cruises#select * from "cabin"#com.mysql.jdbc.exceptions.MySQLSyntaxErrorException:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"cabin"' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3124)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1149)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1262)
at com.sap.sql.jdbc.basic.BasicPreparedStatement.executeQuery(BasicPreparedStatement.java:99)
at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:307)
at com.sap.sql.jdbc.direct.DirectPreparedStatement.executeQuery(DirectPreparedStatement.java:264)
at com.sap.engine.services.dbpool.wrappers.PreparedStatementWrapper.executeQuery(PreparedStatementWrapper.java:274)
[/code]
My goodness - what a long post - sorry for this - I hope I provided all information
necessary to deal with the issue.
Am I thinking in the right direction to blame attribute [code]<sql-engine>native_sql</sql-engine>[/code]
of file data-sources.xml for the beaviour? Are there any other argument options than native_sql?
Thanks in Advance!
Henning MalzahnHi Henning,
> Despite the fact it's working now I have to do some
> changes to my code currently
> developed using JBoss/ Hibernate combination.
> Hibernate allows you to have the
> default no-arg constructor with private visibility -
> any special reason for the fact that
> only protected is allowed on NetWeaver?
Here we strictly implemented the checks according to the requirements of the JPA specification. Technically, we could do with private constructors as well. But the JPA specifications requires the constructor to be protected to allow a JPA implementation to subclass entities if needed.
> The entities in the project are final classes
> so declaring a ctor protected doesn't really make
> sense...
For the same reason, your entities should not be final. Are we missing a check here ?
> Also the persistence.xml parameter
>
hibernate.hbm2ddl.auto
with the value of
> create-drop is very useful while
> developing the app - everytime you deploy the project
> you get a fresh database.
> Is there a comparable option for NetWeaver?
No, unfortunately, there is no comparable option in SAP JPA (yet). We understand that there is a need for forward mapping. We would have liked to delegate this task to the JPA design time (i.e. Dali). However, we had to discover that Dali does not perform this task properly and we can't recommend using it any more.
Consequently, there is no automatic schema generation in SAP JPA 1.0.
>
> Another thing is the extra TMP_SEQUENCE table which
> isn't necessary using JBoss and
> Hibernate - what's the reason for that?
With Hibernate Entity Manager, the id generation strategy in use with GenerationType.AUTO depends on the database dialect. This means that depending on the database dialect, IDENTITY columns, SEQUENCES or generator tables (TableHiLo) are required. As Hibernate has the before mentioned schema generation property this fact can be hidden to the user.
In SAP JPA, we are always using a table generator if GenerationType.AUTO is used. This allows for better portability across databases. It requires the table TMP_SEQUENCE. As we unfortunately do not have a schema generation capability, the user must create this table.
Best regards,
Adrian -
Problem with a Data Source in Web Logic
Hi everybody,
Currently i am deploying a 11g ADF application, i am testing my application in a Web Logic 10.3.2.0, and in the beginning all works OK, but when the user test the application like a half of hour the data source throws this exception:
Messages
Test of MOR_DS_ORA2 on server soa_server1 failed, reason:
Connection test failed with the following exception: weblogic.common.resourcepool.ResourceUnavailableException: No resources currently available in pool MOR_DS_ORA2 to allocate to applications. Either specify a time period to wait for resources to become available, or increase the size of the pool and retry..
This error only occur in the development server of the company, never in the embed WL of my JDeveloper 11 g
Checking my code (appModuleImpl where is all the logic and integration with my DB) i don't see any wrong.
I call SP like this:
String stmt = "BEGIN XXMOR_FUNCIONAL_PKG.XXMOR_SOL_REPROCESAR_PR(?, ?); END;";
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(stmt, 2);
st.setInt(1, idSol);
st.setString(2, rw.getTrackingIdConcom());
st.execute();
System.out.println("Exito.");
catch (SQLException e) {
throw new JboException(e);
finally {
if (st != null) {
try {
st.close();
catch (SQLException e) {}
Execute some querys like this:
public ArrayList getElementsByArguments(String query){
ArrayList al = new ArrayList();
ResultSet rs = null;
try {
rs = getDBTransaction().createStatement(0).executeQuery(query);
ResultSetMetaData rsMeta = rs.getMetaData();
int numColumnas = rsMeta.getColumnCount();
while(rs.next()) {
for (int i = 1; i <= numColumnas; i++) {
al.add(rs.getString(i));
} catch (SQLException e) {
getDBTransaction().commit();
return al;
And some insert and update like this:
public String setNewFzaVta(Number idSegNeg, String idenFzaVta, String nomFzaVta, String region, String copysOrden,
String copysFecha, String mutlifuerza, String rtcrdAut, String autCorreo, String mercadotecnia,
String divCanal, String conCom, String activa, String notificacion, String createBy, Date currentDate,
String matloc, Number tolerancia, String rate){
XxmorFzasVtasTabViewImpl u = (XxmorFzasVtasTabViewImpl)getXxmorFzasVtasTabView1();
XxmorFzasVtasTabViewRowImpl newRow = (XxmorFzasVtasTabViewRowImpl)u.createRow();
SequenceImpl seq = new SequenceImpl("XXMOR_ID_FZAVTA_SQ", getDBTransaction());
Number seqNextval = seq.getSequenceNumber();
newRow.setIdSegNeg(idSegNeg);
newRow.setIdFzaVentas(seqNextval);
newRow.setIdentFzaVentas(idenFzaVta);
newRow.setNombreFzaVentas(nomFzaVta);
newRow.setRegion(region);
newRow.setCopysXOrden(copysOrden);
newRow.setCopysXFecha(copysFecha);
newRow.setMultifuerza(mutlifuerza);
newRow.setRtcrdAuthAut(rtcrdAut);
newRow.setAutXCorreo(autCorreo);
newRow.setMercadotecnia(mercadotecnia);
newRow.setDivXCanal(divCanal);
newRow.setCondicionesComerciales(conCom);
newRow.setActiva(activa);
newRow.setNotificacionExtInt(notificacion);
newRow.setCreatedBy(createBy);
newRow.setCreatedDate(currentDate);
newRow.setMatloc(matloc);
newRow.setAutTolerancia(tolerancia);
newRow.setGetRate(rate);
u.insertRow(newRow);
getDBTransaction().commit();
return seqNextval.toString();
Can anybody help me ! ????Hi,
from the original post it is not obvious from where the code is called and if the AM is released properly. So if you face the same issue, maybe you can explain more
Frank -
2.5 GB CSV file as data source for Crystal report
Hi Experts,
I was asked to create a crystal report using crystal report as datasource(CSV file that is pretty huge (2.4Gb)). Could you help with me any doc that expalins the steps mainly with data connectivity.
Objective is to create Crystal Report using that csv file as data source, save the report as .rpt with the data and send the results to customer to be read with Crystal Reports Viewer or save the results to PDF.
Please help and suggest me steps as I am new to crystal reports and CSV as source.
BR, Nanda KishoreNanda,
The issue of having some records with comma and some with a semi colon will need to be resolved before you can do an import. Assuming that there are no semi colons in any of the text values of the report, you could do a "Find & Replace" to convert the semi colons to commas.
If find & replace isn't an option, you'll need to get the files separately.
I've never used the Import Export Wizzard myself. I've always used the BULK INSERT command
It would look something like this...
BULK INSERT SQLServerTableName
FROM 'c:\My_CSV_File.csv'
WITH (FIELDTERMINATOR = ',')
This of course implies that your table has the same columns, in the same order as the csv files and that each column is the correct data type to accept the incoming data.
If you continue to have issues getting your data into SQL Server Express, please post in one of these two forums
[Transact-SQL|http://social.msdn.microsoft.com/Forums/en-US/transactsql/threads]
[SQL Server Express|http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/threads]
The Transact-SQL forum has some VERY knowledgeable people (including MVPs and book authors) posing answers.
I've never posed to the SQL Server Express but I'm sure they can trouble shoot your issues with the Import Export Wizard.
If you post in one of them, please copy the post link back to this thread you I can continue to to help.
Jason
Maybe you are looking for
-
How to Print a interactive report without action button and search bar
Hello every one.... I am working on printing an interactive report. If there are 20 columns in that report i need to select some columns for printing. For this purpose i used actions button which is in the search bar of the interactive report. But i
-
BPC 10.0 NW - How do I make Business Rules run one Period at a time
I was wondering if anyone has a way to make business rules run one period at a time before moving on to the next to the next time period (i.e. January 2014 calc prior to moving on to February 2014). In past SQL this could be achieved with a piece of
-
Need access to the user view from a form
How can I get access (only need read access) to the user view from inside a form, in this case, the Question Login Form?
-
i lost my ipod the yesterday but i bought songs before i lost it could i in some way get the songs to my computer under the same account?
-
Why curves in ACR acts so different in comparison on other programms?
Similar question I made in LR forum but realize that in here more suitable place. "Does anybody knows, why Adobe made adjustment of curves in lightroom so different in comparison of curves Photoshop? I mean not of adjustment method, but colour shifts