Objective-C: Database support - sql-server

How can I connect to an Oracle database and SQL Server 2005-2008 database with Objective-C?

There seem to be few Objective-C libraries, probably because you can simply use the already available C libraries in Objective-C.
You can:
look at MacSQL Framework (commercial)
use any of the usual C APIs (and possibly wrap them nicely)
use any of the C++ abstractions via Objective-C++

Related

How to identify language using ML.NET?

Is it possible to identify language using ML.NET like fastText does it, but it is in python:
https://fasttext.cc/docs/en/language-identification.html
But I'd like to do it in SQLCLR function and in NET Core application.
SQL Server should be .NET Framework only, so I don't see a single .NET Core library being an option.
Also, while the ReadMe for the main ML.NET repository does state:
ML.NET also works on the .NET Framework 4.6.1 or later, but 4.7.2 or later is recommended.
Also, a white-paper on ML.NET stated that a portion of it is written in C++, and that could mean that one or more DLLs are mixed-mode (not pure MSIL) in which case that would not load into SQL Server under any circumstance (i.e. not even marked as UNSAFE). But you are certainly welcome to try loading the ML.NET libraries into SQL Server to see if it works. But even if it does, you likely have a lot of work ahead of you in terms of re-creating what they did with fastText.
You might be able to make use of this C# wrapper for fastText:
https://github.com/rafael-aero/fastText/tree/master/vs2015
You will still need the main fastText library, fastText.dll, as the wrapper code will call it. The wrapper code will need to be loaded as UNSAFE due to the calls to unmanaged code.
If you do try this and it does work, please let us know.

ODBC v Libpq: C library for PostgreSQL

I am going to be using a C library to connect and use a PostgreSQL database, I was wondering what are the pros and cons to ODBC and Libpq. From what I can tell, libpq seems to be faster but I was not able to get any clear answers or benchmarks.
Also, is there any other library that might be better then ODBC/Libpq.
ODBC is useful if you want a standard adapter that speaks a similar API for different databases. I personally think it's an awful API, but it's widely understood and well documented.
libpq talks more directly to PostgreSQL. You can get better performance with it, but probably not enough more that it'll make any difference for most apps, which spend time on query execution, network latency, etc, not in the client library.
Newer versions of psqlODBC are built on libpq and serve as an ODBC wrapper for libpq.
There's also libdbi, which offers a less ghastly API than ODBC.
For completeness, there's also the server-backend SPI, which can be used by user-defined functions written in C and loaded into the PostgreSQL server. It's not useful outside server extensions and functions.
Oh, and there's ecpg. Don't use ecpg. It's a super-legacy language-integrated-SQL tool that exists mainly for easier porting from certain other database engines. Don't use ecpg. Really.
For C++ there's the QtSQL interface (unusually for Qt, it's awful and painfully limited, don't use it) and libpq++ (OK but largely unmaintained).
Personally I write libpq code directly, but that's because I'm working on code that usually goes into PostgreSQL its self. If you can't imagine ever wanting to target anything except PostgreSQL you might want to write libpq code; otherwise probably use ODBC with psqlODBC.
ODBC is generic mostly MS Windows database access interface. Libpq is native PostgreSQL client interface. If you don't need generic interface, don't use ODBC. It is old school unfriendly designed library with high complexity. There is not any advantage against libpq.

Is there any available free & open source implementation of RSA-2048 for SQL Server 2000?

I'm trying to do some cryptography for SQL Server 2000, and I know that only SQL 2005+ comes with built-in functionality for doing this natively.
Do you know any open source implementation that I can use for free of RSA-2048 cryptography?
I believe you need Extended Stored Procedures to do this. You can make them yourself building on one of the many C or C++ open-source implementations or the Windows CryptoAPI.
Alternatively a quick Google search reveals XP_CRYPT which is an implementation of this (but it is not free if you want RSA with any secure keylength).
Check open source libraries under Elliptic curve cryptography
Which should you should be able to use following developer guide

Anyone know how to use WMI with C instead of C++?

I'd hate to have to relearn C++ just for this! Any libraries/URLs would be great and yes, Google didn't help much here :-(
This is for an upcoming project in which my product (Java based) would provide support for Microsoft's Hyper-V virtualization platform. Unlike VMware, which provides a Web-service, the Hyper-V APIs are mere extensions of WMI. I'd prefer not to use commercial tools such as J-Integra for Java integration into COM/WMI and the few open source tools I found are way outdated.
I would rather use JNI with C than C++. Anybody know where I can find libraries et cetera for using C for WMI operations? In the same vein as Python clients can be used? (And yes, I know C is not an OOP language :D ).
Thanks in advance.
WMI is acessed via COM right?
While it is more verbose and more error-prone (it is easy to accidentally use different pointers for the vtable and the "this" parameter), you can also use COM from the C language.
You also could use C++ but treat it as "C with language extensions to make using COM easier".
The JNI interface itself is a derivative of COM and you will find those methods and the methods of the WMI interfaces much easier to use if you use enough C++ to treat interfaces as implemented by C++ classes.
The other thing that will be helpful is that you will be able to use the COM interface pointers and reference counting as a way to bind the lifecyle of the COM interface to the lifecycle of your JNI-implemented Java classes.
I used an approach like this to implement a Java bridge, via JNI, to some C Language interfaces on Windows. I hand-rolled COM interfaces and a .lib that is used in building the JNI DLL.
The difficult part, with WMI, is that you will want to use the standard COM APIs to Instantiate the COM objects, whereas I created my own custom "factory" code, since it was all a private implementation.
You can download a snapshot of my development tree for the ODMJNI 1.0 0.50beta Function-Complete Release. If you look at info.odma.odmjni100 in the development tree you'll see how the JNI DLL is built (using VC++ 2005 Express Edition) and Java 1.5. The OdmJniBind.java class consists of the static methods that are used in the Java classes to coordinate object lifecycles between Java Classes and COM Object interfaces. (the OdmNative peer section of the tree provides the implementation of the OdmNative100.lib that is used in compiling the odmjni100.dll that is used via JNI.
#z0ltan
You can write your code in C but you ll have to save the file as CPP. As someone had mentioned earlier, for DCOM support your file needs to be a CPP file.
#Umi
For Java Integration - compile your WMI code in C/CPP as a DLL (with proper JNI header files) and then you will have to load the DLL library file. Once this is done, you can access the WMI methods in DLL files just like calling a Java Method.

Extending PythonCE to Access gsm/camera/gps Easily from PythonCE

As it seems there is no scripting language for Windows mobile devices that gives access to phone (sms, mms, make a call, take photo). I wonder how complex it would be to make a Python library that would enable that (write something in C, compile, and import in PythonCE).
Question: Where shall start to understand how to compile a PythonCE module that will give additional functionality to Python on Windows mobile. Also, what is the required toolkit. Is it at all possible on Mac (Leopard)?
As the first step, you should try to create executable programs that invoke the functions you want. For example, to send SMS, it appears you need to call MailSwitchToAccount, passing "SMS", and so on - familiarize yourself with the C API on the platform.
To create executables, you need Visual Studio, and the Windows Mobile SDK. Those run on Windows. For cross-compilation, there is CeGCC (http://cegcc.sourceforge.net/docs/using.html), but using it probably makes things more complicated than using the Microsoft tools.
When you have executables that perform the functions you desire, creating Python extension modules out of them should be easy. Just follow the extending-and-embedding tutorials.
MSDN has plenty of samples for C++ development on Windows Mobile, and the SDK comes with several sample application. Unfortunately VS Express editions (the free ones) do not come with compilers for Smart Devices. The only free option is the older eMbedded Visual C++ (eVC), which is now something like 8 years old and not supported (though it can still create apps for devices at least up through CE 5.0).
just tried establishing an environment to get pythonce modules compiled (http://pythonce.sourceforge.net/Wikka/SConsBuild) but seems that I can only use 2003 PPC SDK and it has no recent functions available. Even when I followed all the steps in tutorial, sample spammodule.c does not compile :(
Is there any good tutorial I can utilize to startup C (C++) programming for Windows Mobile?
Also is it possible using free version of VisualStudio (Express version)?

Resources