I have been looking online for days trying to solve my problems and I cannot find anything which hints as to why I get this issue.
The exception is: System.ArgumentException: Invalid argument
I am using IBM.Data.Informix.dll version 9.0.0.2, the connection string has been through many permutations, but based on most examples from IBM and online this is what I have:
Database=testdb; Host=10.0.0.123; Server=test; Service=3013; User Id=testuser; Password=test123; Protocol=onsoctcp;
I have tried setting Service to the name of the service, I have removed it, even tried setting server to the IP rather than the Host. Whatever I do it just keeps coming up with a useless exception which doesn't help at all in debugging.
I am using the IfxConnection class when instanciating:
using System.Data;
using IBM.Data.Informix;
namespace InformixTest
{
public class InformixConnectionFactory : IConnectionFactory<IDbConnection>
{
private string connectionString;
public InformixConnectionFactory(string connectionString)
{
this.connectionString = connectionString;
}
public IDbConnection GetConnection()
{
return new IfxConnection(connectionString);
}
}
}
Every time it steps into the new IfxConnection(connectionString) the exception is thrown, the connection string is injected via the web.config ConnectionStrings section. I am also targeting .net 4 incase this is a problem.
I was using the v9.5fp4_nt32_dsdriver_EN.exe installer to get the driver installed, I did read somewhere once that someone had a similar issue, so they installed the Informix Client SDK, which fixed their issue. I have also done the same but no such luck.
I am using the following sites as a reference for how my connection string should look:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0510durity/
http://stackoverflow.com/questions/611345/connection-string-for-informix-for-net
Any help would be great!
your connection string works on my machine. I had a lot of problem with IfxConnection because I also installed driver first. Then I unistalled drivers and client sdk, restart windows and installed client sdk again. Just in case I restarted windows again. That did it for me.
Also, I think you should switch (if possible) to IBM Data Server .NET Provider for Informix because old informix driver won't be enhanced any more. Look here for comparison:
http://www.ibm.com/developerworks/data/library/techarticle/dm-1007dsnetids/index.html
You will find that "Informix server support" and "Support for .NET framework 3.0, 3.5" features are quite important and old driver doesn't support it. Also, article doesn't mention that old driver doesn't support database metadata retrieval.
Related
Is driver.getContextHandles() or driver.context() removed in Selenium4 as these methods are coming for Appium driver?
I am Using Selenium 4.1.1 and JavaClient- 8.0.0-beta2.
Facing issue to find element while running a test in Hybrind app.
Scenario
A Web view is opening in App post click of an icon. Element not found exception is coming whereas element is uniquely found/identified in Chrome.
Any suggestions in this will help to procced further.
Regarding the question about driver.context()
This moved to io.appium.java_client.remote.SupportsContextSwitching interface which also includes the default implementation.
In your tests if you're using AppiumDriver, just cast the driver, like:
io.appium.java_client.remote.SupportsContextSwitching
((SupportsContextSwitching) driver).getContextHandles();
NOTE: To have this work without ClassCastException, the driver initially should be created as AndroidDriver or IOSDriver, e.g.:
BaseOptions options = new UiAutomator2Options().setAutoGrantPermissions(true);
AppiumDriver driver = new AndroidDriver(new URL("http://localhost:4723/wd/hub"), options);
More Details
I mention this, because driver.context() is a special case of a larger context.
There are a lot of changes in appium java client version 8 from version 7.
One of them: A lot of platform-specific and not defined by W3C WebDriver standard methods moved out to additional interfaces.
So pure AppiumDriver doesn't have this methods.
But if we look throught the code, e.g. to AndroidDriver, we see it implements 20+ additional interfaces:
public class AndroidDriver extends AppiumDriver implements
PressesKey,
SupportsRotation,
SupportsContextSwitching,
SupportsLocation,
PerformsTouchActions,
HidesKeyboard,
HasDeviceTime,
...
and the same for IOSDriver.
If you cannot find some method in AppiumDriver, try to go throught the interfaces, which AndroidDriver/ IOSDriver are implementing.
as the title says , I have implemented this deprecated function for some odbc 2.0 applications ,when one application start to connect a database via this odbc driver , shows the below error message
I have implemented SQLGetFunctions also ,so this deprecated API could be noted as already implemented.
I am really confused ,any help will be appreciated ,thanks a lot!
I can answer my own question .
The reason is odbc driver on windows is dll.So I need to export the api either by declspec(dllexport) or by dll_name.def file . I don't add the the API name to the def file,so driver manager panics.(I just developed the project halfway ,and not aware of the def file)
It is dumb ,indeed .But maybe it can help some novice like me ,who are not familiar with dll mechanism
I want to make a working program written in Java on Mac available to a Windows user, but the connection fails on Windows with a strange error message indicating Windows is looking for the DB in C::\windows\system32. The SQLite DB is located in the same folder as the Java program:
Connection conn = DriverManager.getConnection("jdbc:sqlite:Databasess/Logic1.sqlite");
I've made a JAR and put it in a folder called Aurora, so it looks like this:
TeachingMachine
Aurora.v2.jar
Images
Audio
databases
Logic1.sqlite
Logic2.sqlite
Transfer the entire folder to another Mac and it works perfectly.
Transfer the same folder to my HP running Windows10 and it immediately gives me an error that I had copied from my HP to my Mac:
JAVA.SQL ‘SQLEXCEPTION: path to ’databases/Logic1.sqlite’: C:\windows\system32:’databases’ does not exist
I've searched for pleas for help regarding windows\system32, and larger portions of the error message. I've found some people whose questions involved gremlins in their code for making a connection to SQLite or other databases, but nothing so far mentioning the problem I've outlined here.
There is a folder for system32 on my Windows PC, but I'm trying for a single program that I can maintain and distribute to people running various operating systems. It would be self-defeating to have to copy my databases into system32.
This is the same basic code for connecting I've been using for over a year. There is, of course, no mention of system32.
Connection conn = null;
try {
Class.forName("org.sqlite.JDBC");
conn = DriverManager.getConnection("jdbc:sqlite:databases/Logic2.sqlite");
return conn;
}catch (Exception e)
The expected results are what I get on any Mac that I've tried it on, and the actual result when I run the same code on Windows 10 is that I only get one error message.
The problem you're running in to is the default directory that the process is using.
On windows, it's apparently using c:\windows\system32.
On the Mac, it's using your applications folder.
So, you need to either specify an absolute path for your database URL, or you need to change your current working directory for your application.
I have been using the method to import excel data to my WPF application as mentioned in
Import Excel file into Microsoft SQL Server using C#
and
Reading Excel files from C#
it works great on debug mode but on release mode it dies!
The problem is my client has moved to x64 based machines and the application works fine but just that this piece of code is not working on x64 just because there is no more "Microsoft .Jet.OLEDB.4.0" drivers made available for x64 machines any more.
I dont want to use office interop or provide any dependency for the user to have office installed on the machines.
So any suggestion to avoid this?
Try using Microsoft.Ace.OLEDB.12.0 drivers instead
When we started upgrading all our machines, all my queries using Microsoft.Jet.OLEDB.4.0 stopped working and I had to upgrade them to use Microsoft.Ace.OLEDB.12.0. You shouldn't need to do anything other than change your connection string for it to work.
You could also try using the OpenXML SDK 2.0!
Here's an article that explains reading an excel file using the SDK: http://debugmode.net/2011/10/08/reading-excel-file-in-a-collection-using-open-xml-sdk-2-0/
Getting started and best practices: http://blogs.msdn.com/b/erikaehrli/archive/2009/05/14/open-xml-format-sdk-2-0-getting-started-best-practices.aspx
Hope this helps! ;)
I am using Aspose.cells library. It works pretty good and really easy to work. you can give it a try!
http://www.aspose.com/.net/excel-component.aspx
As the question says:
How to access Microsoft SQL Server 2005 from Cocoa on Mac OS X 10.5?
The database driver should be free if possible, paid solutions can be OK as well.
If you use ODBC, Actual Technologies makes a Microsoft SQL Server driver for OS X:
http://www.actualtechnologies.com/product_sqlserver.php
Some Googling suggests this question:
http://lists.apple.com/archives/Cocoa-dev/2004/Jul/msg00077.html
Which points to these two apps:
http://www.freetds.org/
http://www.macosguru.de/
Do those meet your needs? If not, can you elaborate on the question? Thanks!
FreeTDS is pretty good and fairly easy to use from Objective-C as it has a C API.
However an even easier way is to use the jTDS JDBC driver via the Java bridge. I know that Apple no longer recommends using the Java bridge but it is probably the easiest way to talk to SQL Server and if you structure you code nicely pretty much any other database on the planet.
Commenting on this because this is one of the top results on a google search for adding SQL Server connectivity to a Cocoa (MacOS) app but I don't see any current solutions listed.
FreeTDS - as Daniel suggested, is the fastest/easiest way to go but some information about how to make that happen without using the dreaded Java bridge or some kind of Python hack. Build FreeTDS with Homebrew (don't for heaven's sakes try to build it on the mac yourself), then select your project in the Xcode finder, select the "build phases" tab, then under "link binaries with libraries" link the FreeTDS library libsybdb (use either the dynamic or static one). click on the "+" sign, then choose "add other" then navigate to where the libraries are - for me the directory the libs were installed in was
/usr/local/Cellar/freetds/1.00.109/lib
then select (e.g.) libsybdb.a in that directory
You can then use the FreeTDS API or use a wrapper like this one by Martin Rybak, which is what I did (I'm using an old version of this "SQLClient" code). It works fairly straightforwardly for a SQL Server instance on AWS, and predictably slightly more complicatedly for an Azure AWS instance - I needed to hack the wrapper since the wrapper code issues a "use db" command to azure after login which Azure won't accept - for azure the database has to be set during the connection - instead I added (using the newer code from GitHub):
DBSETLDBNAME(_login, [host UTF8String]);
in the SQLClient.m file, which I added to the section:
DBSETLUSER(_login, [username UTF8String]);
DBSETLPWD(_login, _password);
DBSETLHOST(_login, [host UTF8String]);
DBSETLCHARSET(_login, [self.charset UTF8String]);
and I commented out:
if (database) {
_returnCode = dbuse(_connection, [database UTF8String]);
if (_returnCode == FAIL) {
[self connectionFailure:completion];
return;
}
}
My app is swift-based so I use a bridging header, adding to it:
#import SQLClient.h
To use the lib, something like (pseudocode since I'm not in front of my code right now):
let client = SQLClient.sharedInstance()
//I'm using the older code which uses a delegate and not notifications callback
self.client!.delegate = self
self.client!.connect("database_network_address", username: "username", password: "password", database: "database_name", completion: { (success) -> Void in
if(success) {
print ("connection has succeeded")
// now do something with the connection
self.client!.execute("select * from table_name", completion: { (data) -> Void in
//... do something with the returned array "data" per the wrapper API
})
} else {
print ("connection has NOT been success")
}
})
Let me know if you have any questions on this. This absolutely works for a Cocoa app, I use my app to upload tons of data into an Azure SQL Server instance. Good luck!