Advantage Database Error 5175 - c#

I'm trying to read data from an Advantage Database with Advantage .Net Data Provider.
When I execute my app, I have the following error :
"Error 5175 the index was created with a different collation sequence"
A way to fix it is to open the table with Advantage Data Architect and reindex or delete the index file (.adi) but I can't do this because the database is used by an accounting software (Sage BOB 50) and if I reindex or delete the index, the software is unable to access the data anymore.
Any ideas?

The collation your connection will use depends on the way you are connecting to the server. (See also Advantage Database Index Collation Sequence).
In order to avoid the 5175 error you should use the same connection method that the accounting software uses.
If it uses ALS you can copy the adslocal.cfg config file over to your application. If it uses ADS you should make sure that you connect to the same database server that the accounting software does.

Related

Informix connection string field descriptions and values to be used

I am writing a test application in .net using c# to connect to IBM's Informix database.
So far what i did is, i installed Informix client sdk v4.10 in my machine. After that i wrote a piece of code referring from here and here. In my code i have a reference to IBM.Data.Informix.dll which is referred from installed path of Informix client sdk's bin folder netf40.
When i run a test application, i am getting below error while trying to opening up an connection,
ERROR [HY000] [Informix .NET provider][Informix]System error occurred
in network function.
i assume this error is due to connection string field not been supplied properly, i referred https://www.connectionstrings.com/informix/ and tried using connection string like informix with ODBC driver and informix .net provider mentioned in above link but no use, i am also having difficulty in understanding from where to get values for each connection string fields like protocol, port, host-name , server-name and service name.
To find values of above fields, i tried looking for SQLHOSTS key in registry entries under HKEY_LOCAL_MACHINE\SOFTWARE\INFORMIX\ unfortunately it wasn't there! and also tried running setnet32.exe from client sdk's bin folder and i could see below screen with only protocol info!.
It would be really helpful if anyone can help me.
This is a very, very difficult question to answer blind. :-)
setnet32.exe will not know the information you are looking for, you need to provide this information to setnet32.exe.
The first question to ask is: is your database running on Unix or Linux? If it is, then by logging in to the database server as user "informix" and running the command
cat $INFORMIXDIR/etc/sqlhosts
If you're on Windows, then login to the Windows server and from a command prompt, run
TYPE %INFORMIXDIR%\etc\sqlhosts
This should give you a file with potentially a bunch of information, you're looking for lines that are not comments and have at least 4 columns. This is my sqlhosts file on a Docker I'm testing:
$ cat $INFORMIXDIR/etc/sqlhosts
############################################################
### DO NOT MODIFY THIS COMMENT SECTION
### HOST NAME = 7edf3045c382
############################################################
informix onsoctcp 7edf3045c382 9088
informix_dr drsoctcp 7edf3045c382 9089
The last two lines are the guts of the file.
Column 1 is the name of the INFORMIXSERVER or an alias (IBM Informix Server in setnet32.exe)
Column 2 is the protocol name (Protocolname in setnet32.exe)
Column 3 is the host name (HostName in setnet32.exe)
Column 4 is the port number or name (Service name in setnet32.exe)
If column 4 is a name and you're on Unix or Linux, then search for the port name in /etc/services on your Unix or Linux server. If you're on Windows, then it will be in %windir%\system32\drivers\etc\services (or similar).
Once you have that, you can then run the command
dbaccess
Choose the Database option, followed by the Select option. This should present you with a list of databases, roughly like:
SELECT DATABASE >>
Select a database with the Arrow Keys, or enter a name, then press Return.
------------------------------------------------ Press CTRL-W for Help --------
backbone#informix wallet#informix
cust#informix
retail#informix
sports#informix
sysadmin#informix
sysha#informix
sysmaster#informix
sysuser#informix
sysutils#informix
In general, databases called "sys" are reserved for Informix administration, and may not be actual databases, although you can query them with SELECTs, you probably won't be able to (and really shouldn't!!) INSERT, UPDATE or DELETE or use DDL.
In my database list above, all the sys* databases are Informix administration "databases". Database names are shown in my example in "databasename#informixservername" format.
You should now have all the information you need to access your database.

ODBC ISAM_EOF without any reason

I have a strange behavior with an ODBC Driver and the underlying COBOL database. The database driver is acuODBC of AcuCorp(now Microfocus), the database itself is a COBOL database.
The DSN is a system DSN and works just fine. Via Access/Excel u can read/write data with the DSN successfully.
In C# the ODBCConnection.ConnectionState is open. Retreiving the table headers works just fine. But when reading data, a strange error occurs. Here is a summerize of the trace log:
[Retreiving Column Headers]
ISAMRestrict - NO_ISAM_ERR
ISAMRewind - NO_ISAM_ERR
ISAMNextRecord – ISAM_EOF
This occurs when I add a WHERE clausel to the SELECT statement. When I do not add a WHERE clausel and just retreive the whole table, it takes incredible long (about 12 minutes for 40000 records), but at least I retreive data.
So my question would now be, has anyone else occured such a strange behavior with an ODBC driver? End of File where data should be?
Just as a side note, I have contacted Microfocus too, if they have a solution I will post it here.
It seems to be Windows UAC reliant. As our application run in compatibility mode, UAC visualization is active and causing may some problems. The reason for this is, that the COBOL databse is a file based database, and the client where are coding for uses these files in ODBC DSN config directly instead of running an ODBC server to handle the requests.
So the UAC leads to some strange behavior.

HBase AggregationClient in HDInsight

I am trying out the C# REST client accessing HBase in HDInsight.
I would like to get a filtered row count without bringing results down to the client, and from what I've seen online, the AggregationClient coprocessor seems to be what I need. But I haven't been able to find any documentation as to whether it's available in HBase in HDInsight, and more specifically, available to the REST client.
Anyone have any experience with it, or suggestions?
Thanks.
Any processing on server that needs to be done, I typically end up mapping the HBase table to a hive table and leveraging the hive connection drivers or for it for C# or via the Hive Type Provider in F#...
Mapping HBase to Hive:
http://indiedevspot.com/2015/07/09/powering-azureml-with-hadoop-hbase/ (about 1/4 down)
Linq to Hive (C#):
http://hadoopsdk.codeplex.com/
Hive Type Provider F#:
http://fsprojects.github.io/FSharp.Data.HiveProvider/

Creating MySql Database on new install of c# application if it doesnt exist

I am about to deploy my application and have came into a bit of trouble.
I have the connection string for the database held in the application.settings and need a way to check if the database exists when the program first starts up, and if it doesn't, i need the program to create it before starting the program.
I am assuming it would be a mysql statement to check if db exists, if not create. However, I don't know where or how to do this, can I create a mysql dump of a blank database with tables etc already created and use that?
I have already stored the mysql dll files locally so there is no problem with that, its just creating the database that the string wants to connect to before the application runs so there are no connection errors straight away.
Thanks.
You can do this by running the following SQL statement:
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = "my_db"
If it doesn't exist from the result set you get returned you can then create it.
This does pose questions regarding MySQL permissions and if your application should have user rights that enable such checking.
Edit in response of comments.
It isn’t clear if you create the connection string or not – I’ll assume the worst and that it is a part of the setup so your client can enter it (if you do know it the process below simplifies.
I would pass the connection string to the constructor of the MySqlConnectionStringBuilder class, this then makes it easy to connect to the database using the MySqlConnection class. I would use the properties from the new instance of the MySqlConnectionStringBuilder class (Server, Host, User etc) to setup the MySqlConnection class.
If the connection didn’t work I would return information to the user and they can update their connection string.
Once I’ve successfully connected to the database I would then use the database name from the Database property of my MySqlConnectionStringBuilder instance to build the query above.
If the command returns NULL the database doesn't exist and then needs creating, if the database does exist then the command will return the name of the database.
Now there are two paths:
It Doesn't exist – It needs creating, I would probably have an external SQL file with the create statements in (can be produced by MySQL dump by using the –nodata option). I would parse this file and execute the create statements
It does exist – I would now check the structure of the database to make sure it is compatible before continuing the installation.

Cheat application to connect to different SQL Server database

At work I wrote an application that processes data from a SQL Server database and outputs it in file format.
Now I need to use it at home and since app has hard-coded connection string I've got a problem. I got a copy of database at my company, the original database is inaccesable from the outside of the company.
Connection string format looks like this
Data Source=serverName-01;Initial Catalog=dbName_01;Integrated Security=True;Pooling=False
I've tried to cheat app by editing windows hosts file:
serverName-01 127.0.0.1
But it did not work. Is there a way to make it work without going to work and editing source code ?
Lesson learned hard way - never hard-code connection srings :<
To do this you can use an alias defined in SQL Server Configuration manager. Create an alias for your local instance that has the exact same name as the one in the connection string.
Have a look at the following article for how to do this (it's pretty simple):
Create or Delete a Server Alias for Use by a Client (SQL Server Configuration Manager)

Categories