SQL Server linked server error message - oracle

I have a SQL Server 2005 database server set up with a linked server to an Oracle database.
When I try to run a delete or update query, I get the following error message:
Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server
The same code was working a couple hours ago while I was testing it, but suddenly it's stopped working. Has anyone seen this before and know a way to fix it/troubleshoot further?
The same queries executed in SQL Developer directly in the DB work fine. (I know it's something with the linked server, but I'm not sure what)
Any pointers would be appreciated.

Use EXEC('query') in following way:
Suppose, your previous query look like this:
UPDATE [MyOraLinkedServer]..[XYZ].[TABLE]SET [DAT_COL] = cast (getdate() as smalldatetime)
Change the above query with following query:
declare #NewValue smalldatetimeset
#NewValue = cast(getdate() as smalldatetime)
exec( 'update XYZ.TABLE set DAT_COL = ?', #NewValue ) at MyOraLinkedServer
NOTE:To make this possible you have to enable RPC on the linked server
In this way, it may solve your problem......

Related

SSIS error with Oracle - Exception deserialzing the package "Value does not fall within the expected range"

I am taking an existing SQL Server 2016 SSIS package and trying to add an Execute SQL Task. I'm suspicious that the task itself isn't the problem, but just in case, I'll explain it.
It is a simple task to query the count in a table, using an existing OLE connection. I create a user variable, set the ResultSet to Single Row, and put in my statement: "SELECT COUNT(fld) FROM MY_TABLE" It shows no errors, but when I try to execute it, I get the error in the title. I can change it to a BEGIN SELECT COUNT(fld) FROM MY_TABLE; END; or add a GO on the 2nd line - it makes no difference. I can set the ResultSet to None, and it makes no difference. I can create a new OLE Connection and use that, and it makes no difference.
I'm pretty sure it has to do with the Oracle driver, because nothing in the paragraph above makes any sense. I can test the connection and it works, however, and when I use the existing connection, it is parameterized for the project.
So what next? Reinstall the Oracle drivers? Or is there anything less drastic?
I started a new project, make a new OLE connection, a new Execute SQL task, and call an Oracle procedure. It works just fine. It's just trying to edit an existing project that doesn't work. Sometimes.
Oh, I'm also using Visual Studio 2019.

DoCmd.OpenQuery("Actionable Query") "Property Not Found"

I have a code that executes DoCmd.OpenQuery Command and it that has been executing fine from last 3 years.
However, all of a sudden it has started failing with Error Message "Property Not Found". It randomly fails for anyone query from set of 5 queries. Further, it displays a message "Operation not allowed this time" if I try to execute the statement again.
These are Action Queries (Inserting data into SQL Server Linked Table),
within this query data is being inserted into SQL Server Linked table from SmartSheet Linked Table. I am surprised to see DoCmd.OpenQuery executes fine at one instance and fails at same statement at other instance. For your information I got the same error message when I tried to executed DoCmd.RunSQL.
Nothing has changed in ACCESS or in SQL Server.
E.g. Query
INSERT INTO dbo_SQL_Server_LinkedTable
SELECT Quarter,Site,Category, 'Commit',Comments
FROM Dbo_SmartSheet_LinkedTable;
Also, Just to mention that same set up works fine on Office 2016 32 bit. I cannot use this because Client Machine does not have Office 2016.
Thank you,
Irfan Khan

Error while runneing select query in sql developer

I am using Oracle SQL Developer version 4.1.0.19.
So this can be a very simple issue but I cannot seem to find the solution anywhere as I have just started using SQL Developer.
I type in this query
create table Student(Stu_id INTEGER,Stu_name VARCHAR(60),Stu_email VARCHAR(60))
select * from Student
And when I Run the SELECT query, I get an error something like this:
Method oracle/jdbc/driver/T4CCallableStatement.isClosed()Z is abstract
I have no idea as to why this is happening , this may be very stupid but I cannot seem to find a solution.
BTW I am using Oracle 11g version.
How did you install SQL Developer? Can you download the zip off of OTN and extract it to a fresh directory and try running it from there?
Your error message indicates something VERY bad is wrong with one of the drivers. Which makes me wonder if you messed with one of the JARs or are attempting to use an old Oracle Client with a THICK connection.

Trouble setting currentSchema for DB2 on Glassfish

I've been working to move an application from MySQL to DB2, and am currently running into trouble with currentSchema on deployment.
The query:
SELECT count(*) FROM SomeTable WHERE BooleanColumn=1
will give me an error ( SQLCODE=-204) which means the object doesn't exist.
If instead I issue the query like this:
SELECT count(*) FROM SCHEMA.SomeTable WHERE BooleanColumn=1
Everything works as I would expect.
It seems like I should be able to set this to default to a schema somewhere, and at this point I have focused on the JDBC connection pool in Glassfish. It seems like I would usually be able to build a JDBC URL something like "jdbc:db2://SERVER_NAME:PORT/DATABASE:currentSchema=SCHEMA_NAME;", and currentSchema would take care of my needs, but I don't know how to do that in the admin control for Glassfish. I obviously don't know a lot about Glassfish - it is very likely I am looking in the wrong place.
I have the "Additional Properties" portion configured something like this:
Blah. I guess I'm too new to embed pictures...this link is this:
http://i.stack.imgur.com/IqUQd.jpg
Any help in getting this setup would be great...I don't want to have to hunt down every table reference and preface it with the schema name.
You can issue this statement in the same connection:
SET SCHEMA = my_schema;
By default, DB2 uses your username as the schema.

Logon failed, Crystal Reports 9, VB6 , sql server, sqlncli

i'm trying to build a setup package for a legacy vb6 software. the software itself connects to a sql server via sqlncli (native client). i've packaged all the dependencies and deploy them to a new machine running winxp and office2003.
now, from the target machine i can connect to the database (ms sqlserver 2005) that is running somewhere else using tcp/ip. the legacy software connects to the db just fine and i can manipulate data. but when i try to open a crystal report, things get messy:
i get an error saying "Run-time error '-2147189176(80047e48): Logon failed.
Details: 01000:[Microsoft][ODBC SQL Server Driver][DBNETLIB]ConnectionOpen (Connect())"
since the reports where designed on a different system, different db and what not ... there is a loop before calling the report that resets the db-information for every table :
For i= 1 To numTables
Set crTable = crTables.Item(i)
crTable.SetLogOnInfo dbServer, dbName, dbLogin, dbPasswd
Next
the ConnectBufferString reads "Connection String=DRIVER=SQL Server;;User ID=user;;Password=;;Database=MY_DB;;Server=192.168.1.3\SQLEXPRESS;;UseDSNProperties=-1"
there doesn't seem to be a way to explicitly set the provider to SQLNCLI, at least i don't see any.
when running the software on my dev-system everything works like it's supposed to.
i hope you guys can help me out with this.
just so we don't have to argue about this : i also think both these technologies (vb6 and cr9) are outdated, but switching is not an option here.
You need to wipe the tables and change the configuration of access to the database, see the example below.
In the first line of code I put an example if necessary to change the connection driver, in my case the report was pointing to a PostgreSQL database and programativamente needed change to connect to a SQL SERVER.
myReportObject.Database.Tables(1).DllName = "crdb_ado.dll" 'Connect to SQL with OLEDB
For Index = 1 To myReportObject.Database.Tables.Count
With myReportObject.Database.Tables(Index)
.ConnectionProperties.DeleteAll
.ConnectionProperties.Add "Provider", "SQLOLEDB"
.ConnectionProperties.Add "Data Source", mySqlIP
.ConnectionProperties.Add "Initial Catalog", myDB
.ConnectionProperties.Add "User ID", usr_id
.ConnectionProperties.Add "Password", pass
.ConnectionProperties.Add "Integrated Security", 0
End With
Next
I know you said in your comment that you've got around this already, but I figured I'd throw this out there. :)
You may try using
Provider = SQLNCLI
instead of,
DRIVER = SQL Server
to see if that makes a difference.
Take a look at the following link. Scroll down on the page until you see the "SQL Native Client 9.0 OLE DB provider" section. They show examples of connections strings using the SQL Server Native Client.
http://www.connectionstrings.com/sql-server-2005
Hope this helps.

Resources