Oracle 12c to 11g - sql

I designed a windows form application that connects to oracle 12c server.
Everything was great until I discovered that the client has a 32 bit operating system, and oracle c can only be installed on 64 bit operating systems.
I have been trying for a week to adapt my application to work with oracle 11g since this version can be installed in my client's computer, and it is becoming a hopeless task.
ODBC for oracle 11g does not have Oracle.ManagedDataAccess.dll included, and also Oracle.DataAccess cannot read Boolean datatypes from the stored procedures that I am using.
I either have to modify all my procedures, and try to fix all the issues related to Oracle.ManagedDataAccess.dll or start by developing a new application using oracle 11g.
I installed windows 7 32-bit on a virtual machine and had been working on it, started by a very small version of my application, and it I working, but requiring too much time !
Is there a faster way or solution to make my application compatible with oracle 11g ?
Is really oracle 11g more suitable for weak and limited computer than oracle 12c ? (In case I managed to convince the client to install a 64bit operating system and re-install all the programs he is using) : Client has 2GB of RAM
Update :
I installed the packed as instructed, and the application is now running. The only problem is that I am having an error when adding a parameter of type Boolean, the error is : 'Oracle.DataAccess.Client.OracleDbType' does not contain a definition for Boolean
this is the code I am using to call the procedure :
tring constr = "DATA SOURCE=localhost;PASSWORD=kidzclubadministration;PERSIST SECURITY INFO=True;USER ID=C##KidzClub";
OracleConnection con = new OracleConnection(constr);
OracleCommand cmd = new OracleCommand();
cmd.Connection = con;
con.Open();
cmd.CommandText = "get_admin_pass";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("pass", OracleDbType.NVarchar2);
cmd.Parameters["pass"].Direction = ParameterDirection.Input;
cmd.Parameters["pass"].Value = password;
cmd.Parameters.Add("done", OracleDbType.Boolean);
cmd.Parameters["done"].Direction = ParameterDirection.Output;
cmd.ExecuteNonQuery();
the exact error sentence is :
Error 2 'Oracle.DataAccess.Client.OracleDbType' does not contain a definition for 'Boolean' C:\Users\Jad-HP\Desktop\Windows Application\WindowsFormsApplication1\WindowsFormsApplication1\Form5.cs 44 53 WindowsFormsApplication1
I went to OracleDbType definition, and could not find a definition for Boolean :
#region Assembly Oracle.DataAccess.dll, v2.111.7.20
// C:\app\Jad-HP\product\11.1.0\client_2\ODP.NET\bin\2.x\Oracle.DataAccess.dll
#endregion
using System;
namespace Oracle.DataAccess.Client
{
public enum OracleDbType
{
BFile = 101,
Blob = 102,
Byte = 103,
Char = 104,
Clob = 105,
Date = 106,
Decimal = 107,
Double = 108,
Long = 109,
LongRaw = 110,
Int16 = 111,
Int32 = 112,
Int64 = 113,
IntervalDS = 114,
IntervalYM = 115,
NClob = 116,
NChar = 117,
NVarchar2 = 119,
Raw = 120,
RefCursor = 121,
Single = 122,
TimeStamp = 123,
TimeStampLTZ = 124,
TimeStampTZ = 125,
Varchar2 = 126,
XmlType = 127,
Array = 128,
Object = 129,
Ref = 130,
BinaryDouble = 132,
BinaryFloat = 133,
}
}
Although when going to that same definition in Visual studio where I am developing with oracle 12c, I have a definition for Boolean :
#region Assembly Oracle.DataAccess.dll, v4.121.1.0
// D:\app\Jad-HP\product\12.1.0\client_2\ODP.NET\bin\4\Oracle.DataAccess.dll
#endregion
using System;
namespace Oracle.DataAccess.Client
{
public enum OracleDbType
{
BFile = 101,
Blob = 102,
Byte = 103,
Char = 104,
Clob = 105,
Date = 106,
Decimal = 107,
Double = 108,
Long = 109,
LongRaw = 110,
Int16 = 111,
Int32 = 112,
Int64 = 113,
IntervalDS = 114,
IntervalYM = 115,
NClob = 116,
NChar = 117,
NVarchar2 = 119,
Raw = 120,
RefCursor = 121,
Single = 122,
TimeStamp = 123,
TimeStampLTZ = 124,
TimeStampTZ = 125,
Varchar2 = 126,
XmlType = 127,
Array = 128,
Object = 129,
Ref = 130,
BinaryDouble = 132,
BinaryFloat = 133,
Boolean = 134,
}
}
Is there a solution other then modifying all the procedures and replacing all Boolean variables ?

You can use the Oracle Managed Data Access DLL to talk to an 11g database. I have an application in production doing that right now.
I can't say I've yet installed an Oracle 12c database, nor even a 12c Oracle client, so I can't say whether either requires a 32-bit client. I got the Oracle Managed Data Access DLL from NuGet, and I avoid the need for an Oracle client by using a connect descriptor rather than a TNS name in the connection string. I don't see why you can't use this approach with your app.

Related

nodejs and vb.net - zlib deflate compression non-compatibility between nodejs and vb

I'm trying to communicate between a client and a server, with the client being on VB.NET and the server on nodejs.
It works, but I'm now trying to use the deflate compression method which seems to not work exactly the same in vb.net and nodejs.
Here's the code. I will explain the problem next in order to be understandable.
deflate compression on (VB.NET)
Shared Function Compression(buffer As Byte()) As Byte()
Try
Dim ms As New MemoryStream()
Using zipStream As New Compression.DeflateStream(ms, IO.Compression.CompressionMode.Compress, True)
zipStream.Write(buffer, 0, buffer.Length)
End Using
ms.Position = 0
Dim outStream As New MemoryStream()
Dim compressed As Byte() = New Byte(ms.Length - 1) {}
ms.Read(compressed, 0, compressed.Length)
Dim gzBuffer As Byte() = New Byte(compressed.Length + 3) {}
System.Buffer.BlockCopy(compressed, 0, gzBuffer, 4, compressed.Length)
System.Buffer.BlockCopy(BitConverter.GetBytes(buffer.Length), 0, gzBuffer, 0, 4)
Return gzBuffer
Catch
Return buffer
End Try
End Function`
I use it like this:
Compression(stringtobyte("testTESTtestTESTtestTESTtestTEST"))
It returns this byte() data: [32,0,0,0,43,73,45,46,9,113,13,14,41,193,65,3,0].
deflate compression in (nodejs) (using zlib)
zlib.deflateSync(Buffer.from("testTESTtestTESTtestTESTtestTEST"))
That returns: [120, 156, 43, 73, 45, 46, 9, 113, 13, 14, 41, 193, 65, 3, 0, 201, 232, 12, 1]
As you can see, the "inside" compression bytes are the same in nodejs and VB (they are bolded). In VB there are four leading bytes [32,0,0,0]. I understand that that shows the length of uncompressed original data. That's true since the length of "testTESTtestTESTtestTESTtestTEST" is 32 chars.
However in NodeJS there is always [120,156] at the start, and some bytes at the end (always 4?). Here [201, 232, 12, 1]. They are never the same if I change the string that I want to compress.
So what i tried:
In nodejs, using zlib.inflate(Buffer.from([120, 156, 43, 73, 45, 46, 9, 113, 13, 14, 41, 193, 65, 3, 0, 201, 232, 12, 1])).toString() actually returns my input string: "testTESTtestTESTtestTESTtestTEST".
However I must compress a string in VB (without the 2 firsts chars that you get in the nodejs compression [120,156], and without also the 4 chars at the end : [201, 232, 12, 1]) , and then decompress/uncompress it in Node.js.
I tried to add the [120,156] characters in the VB compressed string, while removing the first four chars in the VB compressed string that indicate the length of uncompressed data, but I don't have any clue as to what the four last chars are in the Node.js compression function. So the inflate(uncompress function) in Node.js doesn't work with my modified VB compressed string:
vb compressed data: [32,0,0,0,43,73,45,46,9,113,13,14,41,193,65,3,0] that I must turn into: [120, 156, 43,73,45,46,9,113,13,14,41,193,65,3,0,201,232,12,1]
//but I can't get those 4 last chars in vb
zlib.inflateSync(Buffer.from([120, 156, 43,73,45,46,9,113,13,14,41,193,65,3,0]))
//i remove the first 4 chars and add 120,156 "header" that i always got in nodejs, but i can't add the last 4 chars as I don't know what there are about, i only get them in nodejs zlib.deflateSync but not in my VB.net compression function.
The inflateSync function returns an error: "unexpected end of file" (the end that precisely I don't know how to get).
How can I find out what the four last chars from the Node.js deflate function are? (I imagine the two first chars 120,156 are about specifying that it's the deflate compression mode) I would like to add them in my VB.NET return string to make it compatible with Node.js.
Actually I found a solution, it's using GZIP compression mode instead of DEFLATE, it seems more stable and cross-platform compatible.
here are my VB.Net compression and decompression
Shared Function compression(buf As Byte()) As Byte()
Using ms As New MemoryStream()
Using gzipstream As New GZipStream(ms, CompressionMode.Compress) 'si m arche pas, ajouter dernière param
gzipstream.Write(buf, 0, buf.Length)
End Using
Return ms.ToArray()
End Using
End Function
Shared Function decompression(buf As Byte()) As Byte()
Using ms As New MemoryStream(buf)
Using outputstream As New MemoryStream
Using decstream As New GZipStream(ms, CompressionMode.Decompress)
decstream.CopyTo(outputstream)
End Using
Return outputstream.ToArray()
End Using
End Using
End Function
and in node instead of deflateSync and inflateSync, i simply use gzipSync and gunzipSync... it works perfectly
bye
You are using two different formats on the two platforms, plus the extra twist of the leading uncompressed size on the VB side. On the VB side you are using raw deflate format. On the Node.js side you are using the zlib format. The zlib format is a deflate stream with a two-byte zlib header and a four-byte Adler-32 integrity check value, which is a function of the uncompressed data.
On the VB side can use ZLibStream instead of DeflateStream, and you can get rid of the leading four bytes by simply removing that from your VB code: just have one BlockCopy line: System.Buffer.BlockCopy(compressed, 0, gzBuffer, 0, compressed.Length). That will then be compatible with the use of inflate on the Node.js side.

Sliding Expiration in Redis using Redisson

Redisson implementation is not working when deployed to AWS Environment
I have built a POC With Spring boot application to implement Sliding expiration of a cache in Redis using redisson client. It is working fine in my Local Env. but now my challenge is when I tried to apply the configuration to our existing code and deployed it to AWS Env. it is not giving the cached values.
Is there anything I forgot to specify? config? annotations?
I have used below configurations for Redisson
#Bean(name = "sessionCacheManager")
public CacheManager cacheManager(RedissonClient redissonClient) throws IOException
{
Map <String, CacheConfig> config = new HashMap <>();
CacheConfig configItem = new CacheConfig(0, Long.parseLong(maxIdleTime));
config.put("sso_client",configItem);
return new RedissonSpringCacheManager(redissonClient, config);
}
#Bean(destroyMethod = "shutdown")
public RedissonClient redissonClient() throws IOException {
Config config = new Config();
config.setNettyThreads(Integer.parseInt(nettyTrade)).setThreads(64).useReplicatedServers()
.setScanInterval(2000)
.addNodeAddress(address)
.setConnectTimeout(Integer.parseInt(connectTimeout))
.setTimeout(Integer.parseInt(timeout))
.setRetryAttempts(Integer.parseInt(retryAttempts))
.setRetryInterval(Integer.parseInt(retryInterval));
redisson = Redisson.create(config);
logger.debug("RedissonClient Bean has been created");
return redisson;
}
and this is how I get and update the cache
#Component
#CacheConfig(cacheNames = "sso_client", cacheManager = "sessionCacheManager")
public class SSOClientAuthenticationService
{
private static final Logger logger = Logger.getLogger(SSOClientAuthenticationService.class);
#Autowired
private CacheManager sessionCacheManager;
#Cacheable( key = "#clientAccessKey", unless = "#result == null")
public String getSSOSessionKey(String clientAccessKey)
{
logger.debug("Inside getSSOSessionKey()" + clientAccessKey);
org.springframework.cache.support.SimpleValueWrapper value = (org.springframework.cache.support.SimpleValueWrapper) sessionCacheManager.getCache("sso_client").get(clientAccessKey);
if(value!=null && (value.get() instanceof String))
{
logger.debug("session active" + value.get());
return (String)value.get();
}
logger.debug("session is out for ClientAccessKey" + clientAccessKey);
return null;
}
#CachePut(key = "#clientAccessKey", condition = "#result != null")
public String updateClientRequestMapping(String clientAccessKey, String sessionKey)
{
logger.debug("Inside updateClientRequestMapping()");
return sessionKey;
}
#CacheEvict(key = "#clientAccessKey", condition = "#result != null")
public String removeClientRequestMapping(String clientAccessKey)
{
logger.debug("Evict removeClientRequestMapping: " + clientAccessKey);
return clientAccessKey;
}
}
This is the log I got from splunk
2022-07-02 22:38:27 DEBUG o.r.c.ReplicatedConnectionManager - Current master myr1xfltu6ld0ybp.cxsbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379 unchanged
2022-07-02 22:38:27 DEBUG org.redisson.command.RedisExecutor - acquired connection for command (GET) and params [[115, 101, 115, 115, 105, 111, 110, 83, 105, 109, ...]] from slot NodeSource [slot=0, addr=null, redisClient=null, redirect=null, entry=null] using node kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379... RedisConnection#599724954 [redisClient=[addr=redis://kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com:6379], channel=[id: 0x0610f655, L:/10.4.11.206:35298 - R:kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379], currentCommand=null, usage=1]
2022-07-02 22:38:27 DEBUG org.redisson.command.RedisExecutor - connection released for command (GET) and params [[115, 101, 115, 115, 105, 111, 110, 83, 105, 109, ...]] from slot NodeSource [slot=0, addr=null, redisClient=null, redirect=null, entry=null] using connection RedisConnection#599724954 [redisClient=[addr=redis://kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com:6379], channel=[id: 0x0610f655, L:/10.4.11.206:35298 - R:kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379], currentCommand=CommandData [promise=java.util.concurrent.CompletableFuture#2121da78[Completed normally], command=(GET), params=[[115, 101, 115, 115, 105, 111, 110, 83, 105, 109, ...]], codec=org.redisson.client.codec.ByteArrayCodec], usage=0]
2022-07-02 22:38:27 DEBUG org.redisson.command.RedisExecutor - acquired connection for command (GET) and params [[115, 101, 115, 115, 105, 111, 110, 83, 105, 109, ...]] from slot NodeSource [slot=0, addr=null, redisClient=null, redirect=null, entry=null] using node kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379... RedisConnection#632704404 [redisClient=[addr=redis://kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com:6379], channel=[id: 0x67d414b2, L:/10.4.11.206:35300 - R:kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379], currentCommand=null, usage=1]
2022-07-02 22:38:27 DEBUG org.redisson.command.RedisExecutor - connection released for command (GET) and params [[115, 101, 115, 115, 105, 111, 110, 83, 105, 109, ...]] from slot NodeSource [slot=0, addr=null, redisClient=null, redirect=null, entry=null] using connection RedisConnection#632704404 [redisClient=[addr=redis://kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com:6379], channel=[id: 0x67d414b2, L:/10.4.11.206:35300 - R:kyrld0ybp.cbjl.ng.0001.use1.cache.amazonaws.com/10.4.14.237:6379], currentCommand=CommandData [promise=java.util.concurrent.CompletableFuture#6c2d2f7d[Completed normally], command=(GET), params=[[115, 101, 115, 115, 105, 111, 110, 83, 105, 109, ...]], codec=org.redisson.client.codec.ByteArrayCodec], usage=0]
thanks
zola

How to export to text from the crystal report viewer

I have vb.net 2010 and I downloaded the support pack 6 from
http://scn.sap.com/docs/DOC-7824
I read that this version does allow the export of text from the export button inside the crystal report viewer. However, I can't find it in the list when I try to exporta a report.
Is there something that I am missing?
Export to text is supported in Report Document but it is not available in the viewer. If you are writing your own application you can use ReportDocument ExportToDisk. The first parameter for this methid is ExportFormatType and this is the enumeration
public enum ExportFormatType
{
NoFormat = 0,
CrystalReport = 1,
RichText = 2,
WordForWindows = 3,
Excel = 4,
PortableDocFormat = 5,
HTML32 = 6,
HTML40 = 7,
ExcelRecord = 8,
Text = 9,
CharacterSeparatedValues = 10,
TabSeperatedText = 11,
EditableRTF = 12,
Xml = 13,
RPTR = 14,
ExcelWorkbook = 15,
}

can i use narrow the Type i want to instantiate with Activator.CreateInstance

i got a large branch of Types that all got the same superclass and interface.
SuperClass: AbstractPackage
Interface: IPackage
Types made with this.
Package0....Package723
i use Activator.CreateInstance to create a new instance of the packages, depending og the pattern, recieved from a UDP bytestream.
i got all the registered packages, in a New Dictionary(Of UInt32, Type).
the Uint32 is the package number (0-723) and the Type, is any of the Package0 - Package723 Types.
problem is, that Activator.CreateInstance creates any type of class, and i was wondering if i could narrow the scope Down?
i wanted to make the Dictionary(and Activator.CreateInstance) to only accept Packages.
is that posable?
thanks
i made a sligth change as Hans Passant pointed out for me, i might have been overthinking it.
here is my new method ( i still need to add all the classes Again, but now i atleast know what types it generate.
Public Function getPackage(ByVal bytes() As Byte) As APackage
Dim pkgbytes As Byte() = New Byte(3) {}
Dim o As Integer = 0
For i As Integer = 8 To 11
pkgbytes(o) = bytes(i)
o += 1
Next
Dim package As APackage
Dim iT As UInt32 = UByteChunk.getUInt32(pkgbytes)
Select Case iT
Case 0
'0 Acknowledge
package = New Package0(bytes)
Case 152
'152 EventCall
package = New Package152(bytes)
Case 157, 162, 165, 166
' 157 Event Extension
' 162 Event Delta Call
' 165
' 166 Event Call Logging
package = New PackageCall(bytes)
Case 174
'174 Event Targeting
package = New Package174(bytes)
Case 187, 188
'187 SIP Rx
'188 SIP Tx
package = New PackageSIP(bytes)
Case 93, 501, 502, 626
'93 Version
'501 Info
'502 Info 2
'626 License
package = New PackageText(bytes)
Case 563
'563 System Endpoint
package = New Package563(bytes)
Case Else
package = New PackageDefault(bytes)
End Select
Return package
End Function

How can I programmatically check if a server feature is installed in Windows Server 2008?

Specifically, I'm working with an application that only runs on Server 2008 if the "Desktop Experience" feature is installed, and I'd like to have that application's installer verify it's there.
The only way I'm aware of currently is to run ServerManagerCmd -query and parse the output; I'd prefer something more lightweight (like checking a registry key).
This is a code snippet of what I use to do it at runtime.
public static bool isServerFeatureInstalled(Win32_ServerFeature_ID id)
{
bool idFound = false;
ConnectionOptions connectionOptions = new ConnectionOptions();
ManagementScope managementScope =
new ManagementScope(
#"\\localhost\root\cimv2", connectionOptions);
ObjectQuery oQuery =
new ObjectQuery("SELECT Id FROM Win32_ServerFeature");
ManagementObjectSearcher oSearcher =
new ManagementObjectSearcher(managementScope, oQuery);
ManagementObjectCollection oReturnCollection = oSearcher.Get();
foreach (ManagementObject oReturn in oReturnCollection)
{
if ((uint) (oReturn["ID"]) == (uint) id)
{
return true;
}
}
return idFound;
}
// short list of names and values taken from MSDN.
public enum Win32_ServerFeature_ID
{
Application_Server = 1,
Web_Server = 2,
Media_Server = 3,
Windows_Sharepoint_Services = 4,
Fax_Server = 5,
File_Services = 6,
Print_Services = 7,
Active_Directory_Federation_Services = 8,
Active_Directory_Lightweight_Directory_Services = 9,
Active_Directory_Domain_Services = 10,
UDDI_Services = 11,
DHCP_Server = 12,
DNS_Server = 13,
Network_Policy_and_Access_Services = 14,
Certificate_Server = 16,
Active_Directory_Rights_Management_Services = 17,
Terminal_Services = 18,
Windows_Deployment_Services = 19,
Failover_Clustering = 33,
Network_Load_Balancing = 34,
Desktop_Experience = 35,
DOTNET_Framework_30 = 36,
}
On my testing Windows 2008 x64 std server running this command(adds the role):
ServerManagerCmd.exe -install AS-AppServer-Foundation
adds this registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppServer
This command (removes the role):
ServerManagerCmd.exe -remove AS-AppServer-Foundation
removes the key. So I'd think it's a good enough of an indicator.
These are just the results of my own research/experiment and is not an official/supported way of detecting if AppServer role is configured.