Connect to Derby using IKVM, C# - derby

I used IKVM (ikvm-7.2.4630.5) to convert derby-10.11.1.1.jar and derbyclient-10.11.1.1.jar to dll and add reference to my project.
I want to write an C# app that connect to Derby database and get data.
Here is code (work well with Java)
DriverManager.registerDriver(new org.apache.derby.jdbc.EmbeddedDriver());
Connection conn = DriverManager.getConnection("jdbc:derby:C:/sampleDb;create=true");
But it throw exception at line 1. See error.
An unhandled exception of type 'System.TypeInitializationException' occurred in app.exe
Additional information: The type initializer for
'org.apache.derby.jdbc.EmbeddedDriver' threw an exception.
How to solve it or another way to get data from it?

Related

Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error]

I am using the SSAS to develop the tabular model. I am able to extract the data from the database. However, when I try to deploy I keep on getting this error.
Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error] An error happened while reading data from the provider: 'Object reference not set to an instance of an object.'. '.
I have tried many solution like:
Check my database connection
Check the datatype in the table
However, none of the solution works.
Is there a way to find the issue with the Object reference not set to an instance of an object error?

Visual Studio Sql Server project cannot compile (dacpac generation ) with External source of type 6

I am trying to do a Sql Project in visual studio (out of a Azure Sql Pool formerly SQL Datawarehouse ) . However I am getting an issue while the engine is parsing my external datasource with managed identity. The external data source code is the following :
SQL
CREATE EXTERNAL DATA SOURCE [data_toto_dfs_core_windows_net] WITH (LOCATION = N'abfss://data#toto.dfs.core.windows.net')
And the error code is the following :
Error An error occurred while attempting to reverse engineer elements
of type
Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlExternalDataSource:
Unsupported external data source type '6'.
Any idea how to deal with it ?
Regards
Vincent
You need to create a database scoped credential which helps to access the external data source.
Make sure your external data source have permission to Managed Identity for accessing the data.
Please go through this document Database-scoped credential with Managed Identity for more information.

BizTalk - polling an Oracle database package

I need to poll an Oracle database in BizTalk. In the postPollStatement I need to add the package that has been created for me in the Oracle DB. Can anyone assist me with this?
I have created the schema in Visual Studio, the port is created and I have configured everything except the postPollStatement.
EDIT1:
I have done some research and followed Microsoft Docs but still not managed to get the postPollStatement working.
https://learn.microsoft.com/en-us/biztalk/adapters-and-accelerators/adapter-oracle-database/poll-oracle-db-using-stored-procedures-functions-or-packaged-procedures
This is the error I receive: System.TypeInitializationException: The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception. ---> System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
To get this working you need to do the following:
polledDataAvailableStatement: SQL Statement that returns '1' or '0'.
SELECT COUNT (*) FROM TABLE
pollingAction: Retrieve the polling action from the schema generated for the inbound message.
pollingStatement: For this binding property, specify the entire XML request message that you generate from the schema in Visual Studio.
(No parameter needed if not specified in schema).

ClassCastException when running on Oracle Database JVM

I have the following code:
OracleDataSource ods = new OracleDataSource();
ods.setURL(thinConnectionString);
OracleConnection conn = (OracleConnection) ods.getConnection();
ArrayDescriptor d = ArrayDescriptor.createDescriptor("MDSYS.RDF_MODELS", conn);
When I run this code from outside Oracle's VM it works without a problem. However, when I load it on the Oracale Database JVM with loadjava tool and then run it inside Oracle, I get the following exception:
java.lang.ClassCastException
at oracle.jdbc.driver.PhysicalConnection.putDescriptor(PhysicalConnection.java)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:156)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:123)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:106)
at oracle.sql.ArrayDescriptor.createDescriptor(ArrayDescriptor.java:73)
at XercesTest.Test1(XercesTest.java:46)
at XercesTest.Test(XercesTest.java:171)
What is causing this problem and how to possibly fix it?
Edit:
When I inspect the underlying type of the connection object, I get the type oracle.jdbc.driver.T4CConnection when running outside Oracle's VM, and oracle.jdbc.driver.T2SConnection when running on the server.
Edit 2: [SOLVED]
The issue was due to conflict in the jdbc driver classes; loadjava loaded accidentally dependency files from ojdbc5.jar to the database wich caused conflit with those of Oracle. Once I dropped these, everything worked fine.
Where does the OracleDataSource and OracleConnection classes come from? Have you tried to get the connection just by using "standard JDBC classes"?
Connection conn = DriverManager.getConnection("jdbc:default:connection")
It seems that your data source connection is not that what the Oracle driver expects.
Have you changed the JDBC URL accordingly?
Do other operations fail as well, or is it just the ArrayDescriptor?

JDeveloper DB-based MDS-connection issue

During creating of DB-based MDS-connection in JDeveloper list of partitions is empty.
I have tried to install Oracle SOA Suite 11g on both Oracle and SQL Server and have this issue in JDeveloper with different jdbc-drivers.
Of course, MDS schemas in database are created using Oracle Repository Creation utility and both sys/sa and DEV_MDS users were tried.
I have looked into JDeveloper Messages tab and see such error:
WARNING: Error reading db partitions for connection name Connection1. Reason : MDS-00003: error connecting to the database
Unable to start the Universal Connection Pool: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager: java.sql.SQLException: Invalid Universal Connection Pool configuration: java.sql.SQLException: Unable to create factory class instance with provided factory class name: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
Error during pool creation in Universal Connection Pool Manager MBean: oracle.ucp.UniversalConnectionPoolException: Error during pool creation in Universal Connection Pool Manager: java.sql.SQLException: Invalid Universal Connection Pool configuration: java.sql.SQLException: Unable to create factory class instance with provided factory class name: java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
It is strange, because it is class from sqljdbc4.jar which I have specified as JDBC-driver (Microsoft SQL Server JDBC Driver 3.0).
So I tried jTDS SQL Server driver and received such error:
Apr 26, 2011 9:52:01 PM oracle.tip.tools.ide.common.resourcepalette.adapter.mds.DBConnectionInfo
WARNING: Error reading db partitions for connection name Connection2. Reason :
This answer is coming a "bit" late, but hopefully it will be of some use to the next coder who stumbles upon this.
I'm currently banging my head to the wall trying to get a simple SOA/BPM/ADF application built and deployed using MS SQL Server as the backend DB containing the MDS data.
I was able to create a DB connection to the SQL Server instance with JDeveloper, but I ran into the same problem as Denys when I tried to create a new MDS Connection: The list of partitions was empty and after several hours (or days) I discovered the same error message in the Messages tab:
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerXADataSource
even though the actual DB connection was working properly.
Also, whenever I tried to build my application using JDeveloper's build command or Maven or Ant tasks, I received the same error.
All of the errors pointed in the direction of a missing JDBC driver, which was actually not missing.
I was finally able to at least partially solve the issue, although I had to use very dirty hacks.
Solution to create MDS connection in JDeveloper:
To get this to work I had to make the MDS module realize that there actually exists a JDBC driver for SQL server, so I added the driver's jar into the module's classpath in ${jdev.home}/extensions/oracle.mds.dt.jar#META-INF/extension.xml:
<classpath>c:/dev/jdbc/mssql/sqljdbc4.jar</classpath>
In my opinion, it should have been enough to just have the driver in the project's library settings, but somehow that just wouldn't cut it.
Solution to get the ant scac task working:
I got the build a bit forward by doing essentially the same thing. I added the JDBC driver's jar into scac's classpath by modifying ${jdev.home}/bin/ant-sca-compile.xml:
<path id="scac.tasks.class.path">
<!-- Added this line -->
<pathelement path="c:/dev/jdbc/mssql/sqljdbc4.jar"/>
</path>
All in all, these are not the kind of solutions I was hoping for, but maybe someone else will benefit from them.
Now I'm at the point where my composite.xml validation fails because of missing and/or broken wsdl files:
[scac] Validating composite "C:\install\fod\CompositeServices\OrderBookingComposite\bin/..//composite.xml"
[scac] error: location {/ns:composite/ns:import[#location='oramds:/apps/FusionOrderDemoShared/services/orderbooking/OrderBookingProcessor.wsdl']}(15,125): Load of wsdl "oramds:/apps/FusionOrderDemoShared/services/orderbooking/OrderBookingProcessor.wsdl" failed
[scac] error: location {/ns:composite/ns:import[#location='oramds:/apps/FusionOrderDemoShared/services/partnersupplier/PartnerSupplierComposite.wsdl']}(25,30): Load of wsdl "oramds:/apps/FusionOrderDemoShared/services/partnersupplier/PartnerSupplierComposite.wsdl" failed
[scac] error: location {/ns:composite/ns:import[#location='oramds:/apps/FusionOrderDemoShared/services/oracle/fodemo/storefront/store/service/common/serviceinterface/StoreFrontService.wsdl']}(29,30): Load of wsdl "oramds:/apps/FusionOrderDemoShared/services/oracle/fodemo/storefront/store/service/common/serviceinterface/StoreFrontService.wsdl" failed
... continues with errors for everything else
This error occurs when trying to execute the compile-build-all task in Oracle's Fusion Order Demo application. Any advice regarding this is most welcome.

Resources