How do I stop DataGrip being so index picky? - sybase-ase

I am trying to get a new machine up and running and have been told to install JetBrains DataGrip.
Having installed it, however, there are some tables for which this error message keeps appearing:
The optimizer could not find a unique index which it could use to scan
table [...] for cursor [...]
I appreciate that this means the table does not have a unique index but I am not going to go and ensure every table in the whole system has a unique index. Is there a way around this please, apart from not using Datagrip...?

Related

Mysql Views - Auto incremental not working (through Eloquent ORM)

For a project I have multiple databases set-up which should be working cross-site. I got one "master" website that contains all (important) tables such as users and categories and groups. Then I also have "slave" websites set-up, basically forming a website-cluster. All of these websites reside on the same database.
The slave websites have Views connected to the Tables from the master and getting the results through Eloquent works flawlessly, I get the results I should.
Now the problem is when I try to insert something into the slave (view) as the auto-increments doesn't seem to be working / accounted for.
I suppose a solution could be to run a SELECT COUNT .. query and increase the returning Integer by one, but that doesn't feel like a solution that should be used.
Some information that should be useful:
The view is created by the following query:
CREATE OR REPLACE VIEW {$this->tablename} AS SELECT * FROM {$this->source}.{$this->tablename} WITH CASCADED CHECK OPTION
The commands I try to execute are as follows:
// Create a new id/entry in the Group table.
$__model = new \App\Group;
$__model->setConnection('ext_connection');
$__model->save();
// Create the translations here..
Versions information:
I am running MySQL version: mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64)
I am using Laravel version: 5.4.21
I am using php version: PHP 7.1.4-1+deb.sury.org~xenial+1
I hope someone could enlighten me how I can insert properly into Views.
Well after tinkering about in artisan tinker, I came to the realization that the Eloquent ORM does not insert empty fields as NULL values (as should be the case following the MySQL standards), but rather leaves them completely empty.
Inserting into Views this way throws an exception that it is missing column values, which is a correct error to be thrown out for a View.
So, a good way to solve this issue would be something like is described in the following thread: View Here.

Create Table Just Once?

I have a few nagging questions about creating tables:
If I use PHP to create a MySQL function to create a table, I know it works the first time (to create a database for usernames and passwords) but what about the following times when the database sees the code to "create table". It seems to ignore it on my virtual server, but I was just wondering if this is wrong. Does it keep trying to create a new table each time? Is it okay to leave that code in?
Another question I have is, let's say I go into PHPMyAdmin and add a column called "role" (to define the user's role). The sign in page will crash since I added a column in PHPMyAdmin, but if add the column using PHP/MySQL it is perfectly fine. Why is that?
1.) It depends on the purpose of the table.
If you need to create tables dynamically then your code should check each time
if the table exists:
CREATE TABLE IF NOT EXISTS 'yourTable'
However if you create the table only ones, there is no need to check for existence over and over again, so the code to create these table(s) should execute one time only.
2.) You need to update the function that does the insert or read after adding a column via PHPMyAdmin. It's difficult to answer your second question as I don't know what your functions do.
Do not keep your CREATE TABLE ... statements in your PHP code so that they execute every single time on every single page load. It's unnecessary and error prone. The statements are not being ignored, very likely they are run and are producing errors, and you're simply not checking for errors.
Database creation is a deployment step, meaning when you upload your code to your server, that's the one and only time when you create or modify databases. There are entire toolchains available around managing this process; learn something about automated deployment processes and database schema versioning at some point.
No idea without seeing your code and the exact error message.
CREATE TABLE is executed each time you run the function. It's better to replace the syntax with CREATE TABLE IF NOT EXISTS.
The keywords IF NOT EXISTS prevent an error from occurring if the
table exists.
If you does not add IF NOT EXISTS it will throw the error.
Reference: http://dev.mysql.com/doc/refman/5.7/en/create-table.html
Please post your code in question to help you with second query.

What is the reason for receiving jdbc error when attempting SonarQube 5.6 install

We are going from SonarQube-4.5.7 to SonarQube -5.6. While starting Sonar after the install, the sonar.log captures this error:
ActiveRecord::JDBCError: The CREATE UNIQUE INDEX statement terminated because a duplicate key was found for the object name 'dbo.projects' and the index name 'projects_uuid'. The duplicate key value is (xxxxxxx).: CREATE UNIQUE INDEX [projects_uuid] ON [projects] ([uuid])
I have looked at other issues that refer to the first portion of this error, but those point to issues with a plugin. We have removed the plugins to rule out the possibility of being the issue. Is it still looking at plugin information in the database? Or is it really error due to a duplicate key of sorts in a table? If so, what is the best way to resolve it?
This error was due to the database not being updated with the proper collation for the VARCHAR columns. It needs to be Latin1_General_CS_AS. The key was considered a duplicate to another, without using the case sensitivity it needed to have.

sphinx search error on amazon linux [closed]

I have installed sphinx 2.0.6 version on Amazon Linux.
I have run /usr/local/bin/searchd by root user.
I have set 777 permission to all (all indexfiles ,searchd.log, query.log, searchd.pid ) to avoid permission issue.
I have setup main-delta index.
I want that after insert a new record in database, delta index should be updated from php code. and This new record I want to show to user immediately after insert.
For this purpose I have used
exec(/usr/local/bin/indexer --rotate delta_index) in my php code. and write code to return this new record using sphinxapi.(using codeignitor framework)
$result = $this->sphinxclient->query($term,'main delta');
But everytime I do it, it throws an error:
index 'delta': search error
Index files are created on there place. But Search is not working.
I have test search from command line also.But following error occurred
/usr/local/bin/search --index delta test
Sphinx 2.0.6-release (r3473)
using config file '/usr/local/etc/sphinx.conf'...
index 'delta': search error:
Please Have anyone any idea where the things go wrong ???
Please help me in how to update index after insert on db via php. & how to sphinx search get in working. Please give me any link, article, guide anything!!!
Thanks In Advance....
Yogi
If you want the 'php' - ie the webuser - to be able to rebuild the indexer. Best to run searchd as that user. So the same user runs indexer and searchd. often 'www-data' or something like 'apache' - depends on distribution.
Set all sphinx files to be owned by that user, do not set 'execute' bit on the files.
If you get "index 'delta': search error" when trying to run a query, suggests, that the query function is using "search" command under the hood - bad! Use the proper sphinxapi (ie sphinxapi.php) - and if it doesnt work check getLastError/getLastWarning.

MS Access “id” is not a valid index

When I try to open my access database I get an error that says id is not a valid index.
I did not change the layout of the database at all. The database is live on a website and it is able to edit and add to it without a problem.
What can I do to open the database?
I had the same issue and found this on Internet. It may help you
You can do following approach
At first, I tried to “Compact and Repair” the database. That didn’t work. Next, I tried creating a new database and importing the tables, forms, reports and queries from the corrupted database. When I tried the import, I just got a bunch of “ID is not an index in this table” messages and nothing more. The import would stop at this point.
What eventually worked was to open the corrupted database and manually export each object from the corrupted database to a brand new database. I was able to do this with the export tools in the ribbon bar and by selecting “Access” as my export option. I did have to create the new, blank database first; the database to export all of the data to.
Unfortunately, I could only export one object at a time. So it took a while to do;
Answer Source : "http://www.lmhproductions.com/237/microsoft-access-id-is-not-an-index-in-this-table/"
Thanks
Do you have special keys enabled? You may try skipping startup routines if there are any. You do that by holding shift key while starting. Once you get it opened you may be able to repair it.
It sounds likely there is a corruption of a table index. You should backup and be sure to keep any old backup handy as well. If you can, try compact and repair on a copy then the usual round of corruption Hail Marys.

Resources