I have some queries against a Sybase database that after some changes in our Java (JDBC) code are failing to execute because the database is returning an error message where it demands we provide the owner in front of the table name but that is something I would prefer to provide in a single place in our configuration. We are using ASE 16.
For example, we had a query like "SELECT * FROM table_name" that will not work anymore unless we specify "SELECT * FROM database_name..table_name"
I think there should be a simple answer for this but I am struggling to find one, thank you in advance.
Related
I am running one jmeter script to read data from Database (using JDBC Request). Here I am getting following error if I am running script in Jmeter3.0.
Cannot create PoolableConnectionFactory (ORA-00936: missing expression
)
But same script is running fine with jmeter2.13.
Do I need to change any property values?
Just modify Validation query in JDBC Connection Configuration to select 1 from DUAL as per documentation:
A simple query used to determine if the database is still responding. This defaults to 'SELECT 1' which is suitable for many databases. However some may require a different query; for example Oracle requires something like 'SELECT 1 FROM DUAL'. Note this validation query is used on pool creation to validate it even if "Test While Idle" suggests query would only be used on idle connections. This is DBCP behaviour.
I'm attempting to query a proprietary RDBMS using Apache Drill. I've created the plugin as a JDBC data source and put my JDBC jar in the jars/3rdparty directory, and I'm able to successfully run a query such as SELECT * FROM mytable.
However, if I use a column name in the query such as SELECT mycol FROM mytable, Drill returns the following error: Error: VALIDATION ERROR: From line 1, column 8 to line 1, column 9: Column 'mycol' not found in any table. Moreover, I've noticed that my schema is entirely missing if I run SELECT * FROM INFORMATION_SCHEMA.SCHEMATA, so I have a hunch that Drill is unable to retrieve my database schema from the JDBC driver.
I'm wondering what method of the JDBC driver may be implemented incorrectly that's causing this problem. The JDBC driver has been used with other 3rd party software such as Spark with no issue.
In order to perform a query on your table you need to prefix the name of your table with the name you gave your storage plugin. For example if you named your storage plugin rdbms your query should look like this:
SELECT * FROM rdbms.mytable
Your additional query SELECT * FROM INFORMATION_SCHEMA.SCHEMATA likely failed for the same reason. Try SELECT * FROM rdbms.INFORMATION_SCHEMA.SCHEMATA. And don't forget to replace rdbms with the name you gave your storage plugin.
I think we should query on drill like select * from dfs.<storagePlugin>.tableName
Can you check once.?
I'd like to know what is my RAC cluster name using SQL query. I've found out that it can be retrieved using Oracle tool cemutlo -n or just ocrdump (see http://www.br8dba.com/tag/how-to-display-oracle-cluster-name/). However, it's not possible in this case, because on target environment, I can only execute SQL queries and I don't have access to DBMS installation directory.
I've found out (here https://community.oracle.com/thread/2510788?tstart=0) that it can be done using some unusual queries:
SELECT a.ID, a.CLUSTER_ID FROM TABLE(DBMS_DATA_MINING.GET_MODEL_DETAILS_OC('CLUS_OC_1_15',NULL,NULL,1,0,0)) a
select * from table(dbms_data_mining.get_model_details_km('CLUS_KM_1_25'))
However, they don't work on my environment and I'm unable to create new model.
Most preferably, I'd just read this from some kind of v$/gv$ tables - but I can't find it there. I guess that's because cluster is far below DBMS.
Finally, I found out that there is no way to do that :(.
We created a temporary table (in memory) through spark.
When we sftp to the server and use beeline, we can query on the this temporary table like "select * from Table1" without issue.
However, when we use GUI tool with corresponding driver on local machine (the connection string is "jdbc:spark://servername:port/default" ), we have trouble. We can see the temporary table Table1 by using "show tables;" in the GUI tool. However, when we try to use "select * from Table1" in the tool, It shows an error "[Simba]JSQLEngine The table "Table1" could not be found., SQL state: HY000, Query: select * from Table1. [SQL State=HY000, DB Errorcode=500051]". Note that we are using the trial version of the Simba JDBC driver for testing.
Also, I tried hive-jdbc driver from cloudra using connection string "jdbc:hive2://servername:port/default". It is the same issue. Please help. Thanks a lot.
It turns out that some of the drivers requires a "limit" clause after the select. Once I add that, it retrieved data.
I have the linked server set up in SQL Server 2008. But I could not run any query against the linked server.
I tried to run this simple command but it's not working
SELECT * FROM MYSERVER..ALANH.TEMP_UPDATE1
This is the error I got when I run the above command.
Msg 7399, Level 16, State 1, Line 1
The OLE DB provider "OraOLEDB.Oracle" for linked server "MYSERVER" reported an error. The provider did not give any information about the error.
Msg 7312, Level 16, State 1, Line 1
Invalid use of schema or catalog for OLE DB provider "OraOLEDB.Oracle" for linked server "MYSERVER". A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog or schema.
Could anyone help me to connect to the OracleLinkedServer? Thanks very much.
you can be that way too:
**SELECT * FROM OPENQUERY(MYSERVER, 'SELECT * FROM ALANH.TEMP_UPDATE1')**
You can write the query like this:
select * FROM [MYSERVER]..[ALANH].[TEMP_UPDATE1]
Important: In this case, the fully qualified table name must be written in upper case.
You might try the fix from this article.
Also, this could be a problem with naming. From an MS KB article
If you receive these error messages, a table may be missing in the
Oracle schema or you may not have permissions on that table. Verify
that the schema name has been typed by using uppercase. The
alphabetical case of the table and of the columns should be as
specified in the Oracle system tables.
On the Oracle side, a table or a column that is created without double
quotation marks is stored in uppercase. If the table or the column is
enclosed in double quotation marks, the table or the column is stored
as is.
First make sure the tnsping utility works from client server, then use the below string in linked server database source setup
host[:port]/service_name
Check this link for more details :
http://www.oracledistilled.com/oracle-database/oracle-net/using-easy-connect-ezconnect-naming-method-to-connect-to-oracle-databases/
Try something like this:
SELECT * FROM ALL_TABLES#"SOME.SERVER.NAME";
In this case I'm selecting ALL_TABLES from a linked server called SOME.SERVER.NAME.
Richard's post above was critical.
I am using v12 ODP.NET odbc drivers and had to ensure that "Zero Level Only" was NOT checked and that the names supplied for table and schema were the correct case. All of the schemas and tables I access are uppercase only.
Use the query below to determine what the correct table name is, though you will have to supply the schema name in the correct case for the query to work. Try all uppercase, try all lowercase, try mixed case, or better yet get the actual name from the dba (I've heard that only table/schema names that are "" quoted will be allowed mixed case, otherwise in oracle it's all uppercase.)
sp_tables_ex #table_server=InsertLinkedServerHere, #table_schema=InsertSchemaNameHere