|
vanikanc wrote: Our production and development databases are on the same server, due to the complexity of the system. is there a way, that I could not have the production server active, when I open the database server? I do not want to accidently connect to this.
Obviously the best solution is to use two different servers.
That precludes other problems as well such as run away queries that cause CPU overload, or timeouts due to long running processes.
Myself I test against the database server which runs on my development box.
But as noted by others very careful use of users and permissions would entirely preclude overlap.
|
|
|
|
|
Hello!
Im trying to set up a Continuous Query Notification between our oracle database and my c# service, but can´t seem to get it to work. This is the method I have for making the connection:
private void SubscribeToTable(string tableName)
{
Log.Write("Add listener: " + tableName);
OracleConnection con = DataBase.GetOpenConnection();
OracleDependency dependency = new OracleDependency();
dependency.QueryBasedNotification = false;
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "Select * from " + tableName;
dependency.OnChange += new OnChangeEventHandler(dependency_OnChange);
dependency.AddCommandDependency(cmd);
cmd.Notification.IsNotifiedOnce = false;
cmd.AddRowid = true;
cmd.ExecuteNonQuery();
con.Close();
con.Dispose();
}
And when I run this I get a row in user_change_notification_regs with these values:
42 4 net8:
and this is the callback event:
static void dependency_OnChange(object sender, OracleNotificationEventArgs eventArgs)
{
Log.Write("Table has been Changed");
Log.Write(eventArgs.Source.ToString());
Log.Write(eventArgs.Info.ToString());
Log.Write(eventArgs.Source.ToString());
Log.Write(eventArgs.Type.ToString());
}
My problem is the callback-event never runs. Has anyone else had this problem?
|
|
|
|
|
Hello,
Have you solved this issue?
I am having a similar problem. I used a OCI sample code from ORACLE site. My OCI client was able to register the subscription. However, the subscription was removed from USER_CHANGE_NOTIFICATION_REGS as soon as I updated the table that is registered for subscription. And, my client callback function never got called.
Btw, I used oracle client 11.2.0.1.0 and my db is running 11.2.0.1.0. The sample code was compiled on Linux Centos 5.5.
I checked my user privilege and it has CHANGE_NOTIFICATION. I also check "job_queue_processes" and "dml_locks", both of them have non-zero values.
|
|
|
|
|
Hello!
Sadly I never solved it. My subscription was also removed eventhough I set it up to stay (cmd.Notification.IsNotifiedOnce = false;), and I can see with network sniffer that something is sent to my computer from databasecomputer, but my application never registers the callback. I also tried with samplecode from oracle
(http://www.oracle.com/technetwork/issue-archive/win06odp-099708.html[^] and
http://www.devart.com/dotconnect/oracle/docs/Devart.Data.Oracle~Devart.Data.Oracle.OracleDependency.html[^])
but I experienced same problem with that.
I used oracle client 11.2.0.2.0 and my db is running 11.2.0.1.0.
I´ve shelved this issue for a while but figured I'd give it another go in a few weeks. If you or anyone else solve this issue I would very much appreciate a reply here, and I will of course do the same.
/regards
modified on Thursday, February 10, 2011 3:53 AM
|
|
|
|
|
Thanks for the reply.
If I solve this issue, I will post it here.
|
|
|
|
|
Hi,
May I know what Oracle edition that you have?
Is it Enterprise or Standard edition?
Mine is standard edition. I am trying to find out if publish/subscribe is supported in standard edition.
|
|
|
|
|
Hello,
I managed to get my subscription working. Here is what I have done on my test environment.
My client uses oracle-instant-client 11.2.0.1. My db server is running Oracle 11.2.0.1 release. Both client and server are on Centos OS. Previously, I have client on Centos and server on Solaris.
I have done quite few tests with combination of different client, server and their OS. I found that the Oracle version and the OS platform contributed to the issue that I had.
As a preliminary quick test, I also ran my client on the same box where my db server was running. In my case, this worked fine.
Hopefully, this will help.
Cheers,
sw
|
|
|
|
|
Hello,
we have created a job to automatically run re-indexing on some of the indexes, on a weekly basis. The outcome, is that some of the indexes are taking a longer time the second time around. We have collected data for 2 weeks now and running some analysis. Is there something like re-indexing too often not a good idea? They indexes are used quite often, so the plan for once a week re-indexing worked out.
thanks!
|
|
|
|
|
Let's take a step back and see what is motivating you to re-index ? Re-indexing a table which does not change much (insert,update,delete) is a waste of time.
Maybe you should consider using a threshold, like "fragmentation" to determine when you should re-index. Something similar to disk defragmenter; it analyzes your disk, then recommends you to either defrag or not defrag.
Look at this article ...
http://www.sql-server-performance.com/articles/per/index_fragmentation_p1.aspx[^]
|
|
|
|
|
How to row lock in SQL Server 2005. I execute a sql for row locking and that is
SELECT *
FROM authors
WITH (HOLDLOCK, ROWLOCK)
WHERE au_id = '274-80-9391'
it work fine but in this case row is lock for update not for selection. I just want to know how to lock a row as a result another user can not see that row when issue a SQL in SQL Server. please guide me. thanks
tbhattacharjee
|
|
|
|
|
Bad news there, I'm afraid. You can't rowlock an row for a select in SQL Server 2005 so that others can't see it. Even the xlock hint won't cut it for you because it works as a page lock rather than a row lock in SQL Server 2005 and, if SQL Server determines that the underlying rows haven't changed, it will allow the read of the data.
|
|
|
|
|
|
Dear All,
Am using Access database 2007. i have a table called "Entities" and a form for this table. on the form i placed a button, so that when clicked it inserts a record (2 string fields) in the "entities" table which are Entity_Name and Entity_Location.
am using: DoCmd.RunSQL "insert into entities (Entity_Name,Entity_Location) values (v,c);" . where v and c are two strings with predefined values.
Problem: When i switch to form view and click on the button, a window pop up promoting me to provide v and c ?? Its not taking the values i provided inside the button_click() .
any help ??
0 will always beats the 1.
|
|
|
|
|
You made v and c parameter of the query.
DoCmd.RunSQL "insert into entities (Entity_Name,Entity_Location) values ('" & v & "', '" & c & "');"
Cheers
To other readers : Yes I know about SQL injection attacks
If you can read this, you don't have Papyrus installed
|
|
|
|
|
Am I extracting the blob file correctly?
Private Function decryption()
'This is function is the same as encryption with just a few changes'
'loading the xml document'
Dim key As Byte()
Dim IV As Byte()
'The hardcoded password goes here'
'This is a section just in case you want to a password to your encrypted files'
key = keyencryption(LoginForm.Password_TextBox.Text)
IV = IVCreation(LoginForm.Password_TextBox.Text)
'if there is an error in the application. A error message will be displayed'
Try
'checking to make sure the text box isn't null'
If (Decrypt_TextBox.Text = "") Then
MessageBox.Show("Need to put in the file location or select file in grid for decryption")
Else
'declaring string for file'
Dim filename As String
'Getting the file name that is selected'
filename = getFilename()
'Starting to abstract the data from the database'
database.ConnectionString = "Data Source = FileVault.db3;"
database.Open()
Dim command As SQLite.SQLiteCommand
Dim sqlstatement As String
command = database.CreateCommand
'The following will get the bytes of the file'
Dim filesize As Integer
sqlstatement = "SELECT FileSize From Vault WHERE FileName=@file;"
command.CommandText = sqlstatement
command.Parameters.AddWithValue("@file", filename)
Dim reader As SQLite.SQLiteDataReader
reader = command.ExecuteReader
filesize = reader.GetValue(0)
reader.Close()
MessageBox.Show(filesize)
Dim data(filesize) As Byte
'The following should get the data'
sqlstatement = "SELECT FileData FROM Vault WHERE FileName=@file;"
command.CommandText = sqlstatement
command.Parameters.AddWithValue("@file", filename)
Dim buf() As Byte
'This gets the file from the database'
reader = command.ExecuteReader
'The following should get the file back to its original form'
buf = reader.GetValue(0)
'This is go into the Safe and retrieve file'
Dim datawrite As New System.IO.FileStream("Safe", IO.FileMode.Open, IO.FileAccess.ReadWrite)
datawrite.SetLength(0)
datawrite.Write(buf, 0, buf.Length)
datawrite.Close()
reader.Close()
Dim fileinput As New System.IO.FileStream("Safe", IO.FileMode.Open, IO.FileAccess.ReadWrite)
'specific file output location wiht proper extension'
Dim fileoutput As New System.IO.FileStream(Decrypt_TextBox.Text & "\" & filename, IO.FileMode.OpenOrCreate, IO.FileAccess.Write)
'The next line makes sure that the file is empty'
'Declaring variables for encryption'
Dim buffer(4096) As Byte 'Holds the bytes for processing
Dim BytesProcessed As Double 'running count for bytes that are processed'
Dim filelength As Double = fileinput.Length() 'Length of file coming in where intEnd will be greater than intStart'
Dim bytesinblock As Integer 'current bytes in block'
Dim crypto As CryptoStream
'Declaring crypto service provider'
Dim scRijndael As New System.Security.Cryptography.RijndaelManaged
'setting up progress bars
Encrypt_ProgressBar.Value = 0
Encrypt_ProgressBar.Maximum = 100
crypto = New CryptoStream(fileoutput, scRijndael.CreateDecryptor(key, IV), CryptoStreamMode.Write)
While (fileinput.Read(buffer, 0, 4096) > 0)
'reading the file'
bytesinblock = buffer.Length
'writing the file to cryptoStream'
crypto.Write(buffer, 0, bytesinblock)
'updating bytes processed'
BytesProcessed = BytesProcessed + CLng(bytesinblock)
'equation for updating bytes in block'
Decrypt_ProgressBar.Value = CInt((BytesProcessed / filelength) * 100)
End While
crypto.Close()
fileinput.SetLength(0)
fileoutput.Close()
fileinput.Close()
MessageBox.Show("File is done decrypting")
Decrypt_ProgressBar.Step = 0
Decrypt_ProgressBar.Value = 0
Decrypt_TextBox.Text = ""
End If
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
Return 1
I have no clue what I'm doing wrong here. It keeps saying that the file length is invalid for all lengths. I think its a problem with extracting from the database. The database type is Blob in SQLite. This is the only thing I need to complete to have this program done. Can anyone help?
|
|
|
|
|
Does anyone know what I'm doing wrong?
|
|
|
|
|
crain1981 wrote: It keeps saying that the file length is invalid
where? in which line?
crain1981 wrote: for all lengths
what does that mean?
|
|
|
|
|
No matter the file length it gives me this error. It does this at crypto.close(). I've googled around and still is...
|
|
|
|
|
I've also taken out the encryption and found out that the problem still exists without encryption.
|
|
|
|
|
A few statements:
1. I don't know why you are storing the file size; you sure don't need it to store or retrieve the file data.
2. If the crypto code is unhappy about the file size or file data, then the size or data are probably wrong and the problem is NOT in encryption.
3. As long as you fail to store and retrieve binary data, it makes no sense to complicate things with encryption/decryption.
First create methods that deal with arbitrary blobs; then add some methods that handles encryption. So start with a text file, think of it as binary data, store it in a blob, retrieve the blob, store it in a new file, and compare both files. And don't mix separate functions into a single method.
4. Don't create a bunch of code, and then discover it doesn't work; you are wasting your time. Write a small bit of code, and check it works absolutely fine. Then add some, test, fix, and repeat.
5. This has been going on since medio December; all it takes is four methods, each less than 20 lines of code.
6. Suggestion: if you need only one field, use ExecuteScalar.
|
|
|
|
|
1) I figured that out already
2) Pin pointed that problem
3) Never dealt with databases before
4) NEVER did that and have constantly repeated testing... I'm always encountering one error.
5) SMDH... I ain't even going to respond there.... this is different direction than before.
6) Thanks for the suggestion...
With little experience inserting into the database and no clue on how to extract the file is where my problem is.
|
|
|
|
|
Dear all,
I'm trying to do a project on birds and saving information such as the scientific classification and naming. I want to save images of birds in the database so I can display them later in forms or reports when the user does a query about a bird. For some birds I have more than one image so I want to include all images.
My question is how I can do that, I mean how can I store the images in oracle?
I'm using Oracle 9i. So far I have created a table to store the birds and their classification and tried to google about storing the images but no luck yet
Could you please help me with that..
I have a quite little background in oracle 9i :$
Thanks folks
|
|
|
|
|
noora-m wrote: tried to google about storing the images but no luck
I do wonder what you used as the serch criteria, I find pleanty of info with the following oracle 9i store images
If there are to be mode than 1 images per bird then you need a separate table for the images with a FK to the birds table.
BirdsTable
BirdID (PK)
BirdName
ImageTable
ImageID (PK)
BirdID (FK)
BlobField
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
All of a sudden we are experiencing poor performance on our DB server, something that would like 5 seconds is now taking 25 minutes are not completing the query. Checked the sql server logs, nothing.
Only difference is we have started to re-index all our indexes. We started this on Monday, and have schedules set up so that we have a few done every day. Does this hamper the performance? This is the first time the indexes are being re-indexed. Any ideas as where to look for SQL performance?
Thanks!
|
|
|
|
|
vanikanc wrote: Any ideas as where to look for SQL performance
SQL Profiler. Look in your start menu.
|
|
|
|