Oracle ODBC, VB6, ADO, extended ascii
Dim lcn as ADODB.Connection
Dim sql as string
Dim s as string
' assume connection done here
s = chr(149) 'bullet
'value field is varchar2(64)
sql = "update dbo.text set value = '" & s & "'
With Microsoft ODBC for Oracle this works fine.
With Oracle ODBC 8.01.63:
value = chr(191) upside down question mark.
This appears to be the case for all ascii characters 128-256.
Note that:
sql = "update dbo.text set value = Chr(149)"
produces the desired result.
Any suggestions or ideas?
one more line of code:
lcn.execute (sql)
of course.
null
Similar Messages
-
Unable to read recordsets in oracle through VB6/ADO 2.0
Problem: Not able to access/read partiular field of any table(in Oracle) through vb6/ADO.
Note the "insert into" SQL statement is working and through SQL worksheet in Oracle 8.0 , version 1.5.0 (which I am using) I am able to read all the records but whenever I try to read it through the VB6 by the command - "recordset!field name" , the following error is generated.
Error:
Run time error:- 2147417848(80010108)
method 'xxxx' of object 'yyyy' failed
Environment:
Windows NT 4.0 Oracle 8, version 1.5.0
Visual Basic 6.0
ADO 2.0 object library
oracle ODBC driver version: 8.00.0400
I enclose below the lines of code.
Dim AccDb As New ADODB.Connection
Dim AccountGroup As New ADODB.Recordset
Dim AccountSetup As New ADODB.Recordset
Dim Mgrp As String
Global Const CntString = "DSN=DATAB;UID=INTERNAL;PWD=ORACLE;"
Mgrp = ""
AccDb.ConnectionString = CntString
AccDb.Open
AccountGroup.Open "Account_Group", AccDb, adOpenStatic, , adCmdTable
AccountSetup.Open "Account_Setup", AccDb, adOpenStatic, , adCmdTable
AccDb.BeginTrans
If Fld_AccGroup <> "" Then
StrCriteria = "Accid =" & Fld_AccGroup & ""
AccountGroup.Find StrCriteria
If Not AccountGroup.EOF Then
Grp = FillText(AccountGroup!Acc_Group) ' filltext is a user defined function
End If
Mgrp = Trim(Grp)
LGrp = Right$(Str$(1000 + Val(AccountSetup!Last_Grp)), 3)
Else
LGrp = Right$(Str$(1000 + Val(AccountSetup!Last_Grp)), 2)
End If
Grp = Trim(Grp) + LGrp
'Sql = "Execute sp_InsertAccountGroup '" & Grp & "','" & Fld_AccName & "','" & Fld_PlBl & "'"
Sql = "Execute sp_InsertAccountGroup "
AccDb.Execute (Sql)
AccDb.CommitTrans
AccountSetup.Close: Set AccountSetup = Nothing
AccountGroup.Close: Set AccountGroup = Nothing
AccDb.Close: Set AccDb = Nothing
Exit Sub
SaveErr:
AccDb.RollbackTrans
For Each Errloop In Errors
With Errloop
StrError = _
"Error #" & .Number & vbCr
StrError = StrError & _
" " & .Description & vbCr
StrError = StrError & _
" (Source: " & .Source & ")" & vbCr
End With
MsgBox StrError, vbCritical, MsgTtl
Next
AccDb.RollbackTrans
Resume Next
null<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Sandip Tusnial ([email protected]):
Problem: Not able to access/read partiular field of any table(in Oracle) through vb6/ADO.
Note the "insert into" SQL statement is working and through SQL worksheet in Oracle 8.0 , version 1.5.0 (which I am using) I am able to read all the records but whenever I try to read it through the VB6 by the command - "recordset!field name" , the following error is generated.
Error:
Run time error:- 2147417848(80010108)
method 'xxxx' of object 'yyyy' failed
Environment:
Windows NT 4.0 Oracle 8, version 1.5.0
Visual Basic 6.0
ADO 2.0 object library
oracle ODBC driver version: 8.00.0400
I enclose below the lines of code.
Dim AccDb As New ADODB.Connection
Dim AccountGroup As New ADODB.Recordset
Dim AccountSetup As New ADODB.Recordset
Dim Mgrp As String
Global Const CntString = "DSN=DATAB;UID=INTERNAL;PWD=ORACLE;"
Mgrp = ""
AccDb.ConnectionString = CntString
AccDb.Open
AccountGroup.Open "Account_Group", AccDb, adOpenStatic, , adCmdTable
AccountSetup.Open "Account_Setup", AccDb, adOpenStatic, , adCmdTable
AccDb.BeginTrans
If Fld_AccGroup <> "" Then
StrCriteria = "Accid =" & Fld_AccGroup & ""
AccountGroup.Find StrCriteria
If Not AccountGroup.EOF Then
Grp = FillText(AccountGroup!Acc_Group) ' filltext is a user defined function
End If
Mgrp = Trim(Grp)
LGrp = Right$(Str$(1000 + Val(AccountSetup!Last_Grp)), 3)
Else
LGrp = Right$(Str$(1000 + Val(AccountSetup!Last_Grp)), 2)
End If
Grp = Trim(Grp) + LGrp
'Sql = "Execute sp_InsertAccountGroup '" & Grp & "','" & Fld_AccName & "','" & Fld_PlBl & "'"
Sql = "Execute sp_InsertAccountGroup "
AccDb.Execute (Sql)
AccDb.CommitTrans
AccountSetup.Close: Set AccountSetup = Nothing
AccountGroup.Close: Set AccountGroup = Nothing
AccDb.Close: Set AccDb = Nothing
Exit Sub
SaveErr:
AccDb.RollbackTrans
For Each Errloop In Errors
With Errloop
StrError = _
"Error #" & .Number & vbCr
StrError = StrError & _
" " & .Description & vbCr
StrError = StrError & _
" (Source: " & .Source & ")" & vbCr
End With
MsgBox StrError, vbCritical, MsgTtl
Next
AccDb.RollbackTrans
Resume Next
<HR></BLOCKQUOTE>
null -
SQL Developer, UTF8 Oracle DB, extended ascii characters appear as blocks
I have this value stored on the database:
(Gestion Económica o Facturaci
Notice the second word has an extended ascii character in it. When I use SQL Developer on my windows machine to view the data, I get a box in place of the o, kinda like this:
(Gestion Econ�mica o Facturaci
If I log on to the AIX server where the oracle database in question is and run sqlplus from there, I see things properly. I also managed to regedit oracle home to get sql plus on my windows machine to display this properly. I still cannot get sql developer to work though...
Details about sql developer:
font: arial Unicode MS
environment encoding: UTF-8
NLS Lang: American
NLS Territory: America
windows regional options:
English (United States)
Location: United States
Database NLS settings:
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT mm/dd/yyyy hh24:mi:ss
NLS_DATE_LANGUAGE AMERICAN
NLS_CHARACTERSET UTF8
NLS_SORT BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
Any ideas on how I can fix this. I'd rather NOT log onto the server to run queries.... thanks in advance for your thoughts!
Edited by: user10939448 on Jan 31, 2012 1:51 PMuser10939448 wrote:
This problem is quite strange in that when I've been able to manually set American_america.utf8, things work.Sorry to say, but it seems you may have an incorrect setup.
In general, you should set char set part of NLS_LANG to let Oracle know the code page used by the client. With win-1252, NLS_LANG should include .WE8MSWIN1252.
The display from sqlplus was "lying", due to incorrectly stored data coupled by incorrect nls_lang setting (char set part). The pass-through or gigo scenario can be dangerous this way. Search the Globalization forum for the term 'pass-through' for previous discussions on the theme.
The setting on AIX servers may be incorrect as well, but it depends how you use it (e.g. for database export or data load with utf-8 encoded files it may be correct).
The output of the query you recommended looks odd to me:
(Gestion Econ�mica o Facturaci Typ=1 Len=30 CharacterSet=UTF8:
28,47,65,73,74,69,6f,6e,20,45,63,6f,6e,f3,6d,69,63,61,20,6f,20,46,61,63,74,75,72,61,63,69;This is the telling part. The 0xF3 is not legal in UTF8. Actually, the code units for ó, U+00F3 Latin small letter o with acute, are C3 B3. So instead of f3 you should have expected c3,b3 from the dump output.
>
So it looks like what's under the covers is correct, but I'm still not seeing the correct character in sql developer.The opposite is true. Data is incorrectly stored and SQL Developer is correctly showing you this. Sqlplus is not the best tool in Unicode environments, SQL Developer is better.
>
ACP according to my windows registry is 1252. OEMCP is 437Also, if you use database clients in console mode (such as sqlplus), NLS_LANG should include .US8PC437 to properly indicate that code page in use is 437. -
Problem with oracle rdb + vb6 + new odbc driver 3.x
dear all
i have a problem with the new odbc-driver 3.x for oracle rdb and vb6
connection to the database and the query are ok, there are not errors,
but the resultset is not right, because the fieldnames are allways called coloum1, coloum2,... anstead of the original fieldnames.
further the values of the fields are wrong, there allways appears onle the first sign of then value the should be (result "A" instead of "Andy",... )
thanks for helpmy platform is: Windows 2003 server R2 Enterprise x64 Edition Service Pack 2
My application run to 32 bit
the ODBC Data Source Administrator run from C:\Windows\system32\odbcad32.exe
If I double-click on C:\Windows\system32\odbcad32.exe I can see only "Oracle in OraDb10g_home"
In C:\Windows\SysWOW64\odbcad32.exe
If I double-click on C:\Windows\SysWOW64\odbcad32.exe and "select a driver for which I want to setup a datasource" I can see many driver ODBC and if I try to add the "Oracle ODBC for Oracle" I get this error:
The setup routines for the "Oracle ODBC for Oracle" ODBC driver could not be load due the system error code 193.
Could not load the setup or translator library.
Have someone any idea?? -
Oracle ODBC error when inserting "end" or "begin"
I think I may have found a bug in the Oracle ODBC driver....
I am using version 8.01.73.00 of the Oracle ODBC driver, and my VB application is trying to insert a record into a table using ADO. All works fine, until the user tries to enter the word "end", or "begin" into any of the text (CLOB) fields. The following code shows how I am doing an insert:
Dim cmd As ADODB.Command
Set cmd = New ADODB.Command
cmd.ActiveConnection = "DSN=Envoy;uid=Envoy;pwd=significance;"
cmd.CommandText = "Insert into Mon_Reading (Creation_User, Creation_Date, Reading_Date, Param_ID, Mon_ID, Value, ApplicableYN, Site_ID, Prev_MEter_Value, MeterResetYN, UOM_ID, LimitsApplicableYN, Lower, Upper, Limit_UOM_ID, ApprovedYN, Comments ) Values ('Matttt', '01-jan-2002', '01-jan-2003', 1, 1, 1., 'Y', 1, 0, 'N', 1, 'N', 0, 0, 0, 'Y', ' end ');"
cmd.CommandType = adCmdText
cmd.Execute , , adExecuteNoRecords
As you can see, the text " end " is being added to the comments field, a CLOB data field. When executed, this causes an Oracle ORA-0911 error (invalid character), and the insert fails.
Heres the weird thing - if you change the word "end" to anything else apart from "begin" - it will work!!! Also, it only fails if you wrap the "end" in spaces?!!?!! Users that reported this were entering comments like "this is the end of June" - this would have caused the error. If you copy teh failed SQL and paste it into SQLPlus, it executes OK.
I can only presume this is an Oracle bug. Anyone else have an ideas? What can I do as a workaround?First thought would be to grab the updated 8.1.7.x ODBC driver (8.1.7.7 IIRC). Perhaps this problem has already been solved.
Justin -
Oracle ODBC driver and TIMESTAMP with timezone
Does anyone know if it is possible to return data from a "TIMESTAMP WITH TIMEZONE" column using the Oracle ODBC driver and an ADO Recordset?
I am using the Oracle driver version 10.2.0.2 and TIMESTAMP fields work fine.
I can call Recordset->Open() with a query like "SELECT * FROM TABLE" when the table contains a column of type timestamp with timezone but when I execute a statement to see if there are results as in
if (!(srcRecsetPtr->BOF && srcRecsetPtr->EndOfFile))
my application throws an unhandled exception and exits. The exception is not a COM exception and I'm not sure how to get back additional information if that's possible.
The only information I've been able to find in searching TechNet and MetaLink is that a workaround is to wrap the columns in a TO_CHAR or TO_DATE conversion first but that's not a good solution for my problem since I am executing user specified SQL which may join multiple tables.
I've found one other note that says the documentation should be corrected and that these fields are NOT supported period (Bug #4011640).
I've experimented with the Bind Timestamp as Date option in the ODBC connection and with various ALTER SESSION settings to attempt to change the NLS_TIMESTAMP_TZ_FORMAT but I have been unable to get past the problem.
Any ideas are greatly appreciated.
Thanks,
TroyHi Justin
Thanks for your help.
I tried what you mentioned and I could connect myself via SQL*Plus without passing a password and a login, Extern authentification seems to work and my user seems to be right configurated.
But he problem goes on via ODBC. When I test connection in the ODBC Data Source Administrator of Windows XP, test fails and seems to forbid connection without userID and password. When I try to connect via ODBC in my program the same problem appears : "Unable to connect SQLSTATE=28000 [Oracle][ODBC][ORA]Ora-01017: Invalid username/password;logon denied" I could not connect in this way.. What's wrong ? -
Oracle ODBC and DAO extremely slow
Hi
I'm using Microsoft DAO 3.6 with an Oracle ODBC connection (version 9.2) in an VB6 application.
Opening an updateable dynaset is extremely slow, I have measured the performance with Oracle ODBC, Microsoft Oracle ODBC and Microsoft SQL-Server ODBC as follows:
Oracle ODBC: 1952 ms
MS Oracle ODBC: 360 ms
MS SQL-Server ODBC: 40 ms (connection to a MS SQL-Server)
If I use the SQLpassthrough option the result is about 10 ms in all 3 cases, but the dynaset is readonly !
The testing program is as follows:
Option Explicit
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Sub Form_Load()
Dim wsdata As DAO.Workspace
Dim db As DAO.Database
Dim dbconn As String
Dim rs As DAO.Recordset
Dim start As Long
dbconn = "ODBC;DSN=AdhocitORA;UID=adhocit;PWD=adhocit;"
Set wsdata = DBEngine.Workspaces(0)
Set db = wsdata.OpenDatabase("", False, False, dbconn)
start = timeGetTime
Set rs = db.OpenRecordset("Select * from Afdeling", dbOpenDynaset)
rs.MoveLast
rs.MoveFirst
rs.Close
Set rs = Nothing
MsgBox "Time " & timeGetTime - start
End Sub
Is there any setting in the Oracle ODBC, that need to be adjusted ??
ErlingWhy are you doing a moveLast followed by a moveFirst? That's going to force Oracle to retrieve all the records in the recordset. If there are a lot of records, you'll probably see a benefit if you increase the prefetch in the Oracle ODBC DSN configuration.
Justin -
Memory Leak - Oracle 9.2 ADO/OLE DB Select Distinct
I'm using ADO (MDAC 2.8) and Oracle OLE DB (9.2.0.1.0) to access an Oracle 9.2.0.1.0 database. All queries run fine, but when I issue a query with the distinct keyword (e.g. Select distinct...), the application leaks memory. The memory leak does not occur when issuing the same query to MS SQL Server 2000. I also installed the latest 9.2.0.2.0 Oracle OLE DB update, but it didn't fix the problem.
The same problem appears to have been fixed with Oracle ODBC drivers. "Fixed memory leak when using �select distinct�. (Bug2685365)"
http://otn.oracle.com/software/tech/windows/odbc/htdocs/whatsnew.htm
I've also seen the same problem reported on DBForums.com.
"...select distinct query made through ADO causes a memory leak in that object... This issue is known by Oracle and I think that there may be a patch available for Oracle 9."
http://dbforums.com/arch/210/2003/3/733498
This is a critical problem for the product we are developing.
Is there a fix available for this problem?
BobThanks, I looked for the update yesterday, but all Oracle had posted was the update for 9.2.0.2.0.
Luckily, as of this morning there is a new update available from Oracle, 9.2.0.4.0. I installed it and it fixed the memory leak with OLE DB and Select Distinct queries.
The installer for 9.2.0.4.0 is a bit rough. It doesn't stop the Distributed Transaction Coordinator or Oracle MT Service on your computer, so you must stop them before installing. Also, you can't install all the products at once and must install the Oracle uninstaller first. -
Oracle ODBC BLOB examples.
We are currently writing a VB application to harvest data from an Access 2000 database, which is to large to convert to 97 and use migration workbench, and stuff it into an Oracle 8 database, which already has the table structures from the Access dataabase created in it. We are running into a problem in transfering OLE objects in Access to BLOBs in Oracle. Can anyone give some insight / code examples?
Thanks,
Matt ShoultzWhen you get a chance, can you post the ADO version, or a link to it?
thanks.
Chris
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Justin Cave ([email protected]):
Unfortunately, I've never dealt with OLE objects in Access. I'm more than happy to help with BLOB's, though.
I'm posting a document below that covers reading & writing BLOB's with RDO under VB. Unfortunately, it's a little long, so I hope it doesn't get mangled too badly. If there's interest in an ADO version, let me know that as well and I'll post it on another thread.
If folks would like me to e-mail them a copy of this document, drop me a line. Expect it to take me at least a few days to reply to these requests, though.
PURPOSE
The code below should demonstrate how to read from and write to Oracle
8 BLOB datatypes.
SCOPE & APPLICATION
Experienced Visual Basic Developers.
RELATED DOCUMENTS
None.
The code below this demonstrates how to create a Visual Basic project
to read from and write to BLOB datatypes. It was written and tested using Visual
Basic 5 and RDO 2. The Oracle 8.0.5.2 ODBC driver was also used and an
Oracle 8.0.5 database.
Disclaimer:
This sample is provided for educational purposes only. It is NOT supported by
Oracle World Wide Technical Support. The sample has been tested and appears to
work as intended. However, you should always test in YOUR environment before
relying on it.
'Form Image Description
'~~~~~~~~~~~~~~~~~~~~~~
'The form needs 1 OLE control (OLE1) and 1 small text box (text 1) default value '1'
'it also needs 4 command buttons (AddNew,LoadFrom,LoadFromFile,SaveToDB)
'ODBC Datasource
'~~~~~~~~~~~~~~~
'Configure an 8.0.5.2 Oracle ODBC Driver Datasource named 'V805'
'Code required to generate database objects.
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'drop table tblTestBlob;
'CREATE TABLE tblTestBlob
' DATA_ID NUMBER(5,0),
' DATA_BlobData BLOB,
' DATA_MemoData CLOB
'INSERT INTO TBLTESTBLOB VALUES (1,EMPTY_BLOB(), EMPTY_CLOB());
Option Explicit
Dim en As rdoEnvironment
Dim Qd As rdoQuery
Dim Cn As rdoConnection
Dim Rs As rdoResultset
Dim SQL As String
Dim DataFile As Integer, Fl As Long, Chunks As Integer
Dim Fragment As Integer, Chunk() As Byte, I As Integer
Const ChunkSize As Integer = 16384
Dim fileName As String
Private Sub PipeToFile(sFileName)
Dim iFile As Integer
iFile = FreeFile
Open sFileName For Binary As iFile
Me.OLE1.SaveToFile iFile
DoEvents
Close iFile
End Sub
Private Sub AddNew_Click()
Dim sSQL As String
sSQL = "Select * from TBLTESTBLOB"
On Error GoTo errorhandler
Set Rs = Cn.OpenResultset(sSQL, rdOpenKeyset, rdConcurValues)
If Rs Is Nothing Or Rs.Updatable = False Then
MsgBox "Cant open or write to result set"
Exit Sub
End If
Rs.AddNew
Rs("DATA_ID") = Val(Me.Text1)
Rs("DATA_BLOBDATA").AppendChunk Null
Rs("DATA_MEMODATA").AppendChunk Null
Rs.Update
Rs.Close
Set Rs = Nothing
Exit Sub
errorhandler:
MsgBox "Add new click"
MsgBox Err.Number
MsgBox Err.Description
End Sub
Private Sub Form_Load()
On Error GoTo errorhandler
Set Cn = New rdoConnection
Cn.CursorDriver = rdUseOdbc
Cn.Connect = ";dsn=" & "V805" & ";uid=" & "scott" & ";pwd=" & "tiger"
Cn.EstablishConnection
Exit Sub
errorhandler:
MsgBox "Form Load"
MsgBox Err.Number
MsgBox Err.Description
End Sub
Private Function GetBLOBLength() As Long
Dim sSQL As String
Dim oResult As RDO.rdoResultset
On Error GoTo errorhandler
sSQL = "SELECT DBMS_LOB.GETLENGTH(DATA_BLOBDATA) FROM TBLTESTBLOB WHERE DATA_ID=" & Text1
Set oResult = Cn.OpenResultset(sSQL, rdOpenStatic)
GetBLOBLength = Val("" & oResult.rdoColumns(0).Value)
oResult.Close
Set oResult = Nothing
Exit Function
errorhandler:
MsgBox "Get BLOB Length"
MsgBox Err.Number
MsgBox Err.Description
End Function
Private Sub LoadFrom_Click()
Dim iNumBlocks As Integer
Dim lColSize As Long
Dim lBlockSize As Long
Dim byteData() As Byte
Dim lOffSet As Long
Dim iDestFileNum As Integer
Dim lLeftOver As Long
Dim iCount As Integer
Dim sSQL As String
On Error GoTo errorhandler
sSQL = "Select * from TBLTESTBLOB WHERE DATA_ID=" & Val(Text1)
Set Rs = Cn.OpenResultset(sSQL, rdOpenKeyset, rdConcurValues)
If Rs Is Nothing Or Rs.Updatable = False Then
MsgBox "Cant open or write to result set"
Exit Sub
End If
If Not Rs.EOF Then
lColSize = GetBLOBLength()
If lColSize <> 0 Then
iDestFileNum = FreeFile
Open "c:\TEST.DAT" For Binary As iDestFileNum
lBlockSize = 10000
iNumBlocks = lColSize \ lBlockSize
lLeftOver = lColSize Mod lBlockSize
For iCount = 1 To iNumBlocks
ReDim byteData(lBlockSize)
byteData() = Rs("DATA_BLOBDATA").GetChunk(lBlockSize) 'note offset not used by RDO (?)
Put iDestFileNum, , byteData()
lOffSet = lOffSet + lBlockSize 'note offset not used by RDO (?)
Next iCount
ReDim byteData(lLeftOver)
byteData() = Rs("DATA_BLOBDATA").GetChunk(lLeftOver) 'note offset not used by RDO (?)
Put iDestFileNum, , byteData()
Close iDestFileNum
iDestFileNum = FreeFile
Open "c:\TEST.DAT" For Binary As iDestFileNum
Me.OLE1.ReadFromFile iDestFileNum
Close iDestFileNum
End If
End If
Rs.Close
Set Rs = Nothing
Exit Sub
errorhandler:
MsgBox "Load From click"
MsgBox Err.Number
MsgBox Err.Description
End Sub
Private Sub LoadFromFile_Click()
' Locates a file and sets the Filename to this file.
On Error GoTo errorhandler
With CommonDialog1
.Filter = "*.*"
.ShowOpen
fileName = .fileName
End With
FileName_Change
Exit Sub
errorhandler:
MsgBox "Load from file"
MsgBox Err.Number
MsgBox Err.Description
End Sub
Private Sub SaveToDB_Click()
Dim sSQL As String
Dim sTempName As String
On Error GoTo errorhandler
sTempName = "c:\TEST.DAT"
Kill sTempName
PipeToFile sTempName
sSQL = "Select DATA_ID, DATA_BLOBDATA from TBLTESTBLOB WHERE DATA_ID=" & Val(Text1)
'sSQL = "Select DATA_Field1, DATA_IMAGE from TBLBIGDATA WHERE DATA_FIELD1=" & Val(Text1)
Set Rs = Cn.OpenResultset(sSQL, rdOpenKeyset, rdConcurValues)
If Rs Is Nothing Or Rs.Updatable = False Then
MsgBox "Cant open or write to result set"
Exit Sub
End If
If Not Rs.EOF Then
Rs.Edit
End If
DataFile = 1
Open sTempName For Binary Access Read As DataFile
Fl = LOF(DataFile) ' Length of data in file
If Fl = 0 Then
Close DataFile
Exit Sub
End If
Chunks = Fl \ ChunkSize
Fragment = Fl Mod ChunkSize
Rs("DATA_BLOBDATA").AppendChunk Null
ReDim Chunk(Fragment)
Get DataFile, , Chunk()
Rs("DATA_BLOBDATA").AppendChunk Chunk()
ReDim Chunk(ChunkSize)
For I = 1 To Chunks
Get DataFile, , Chunk()
Rs("DATA_BLOBDATA").AppendChunk Chunk()
Next I
Close DataFile
Rs.Update
Rs.Close
Set Rs = Nothing
MsgBox "Finish"
Exit Sub
errorhandler:
MsgBox "Save to DB"
MsgBox Err.Number
MsgBox Err.Description
End Sub
Private Sub FileName_Change()
On Error GoTo errorhandler
Me.OLE1.CreateEmbed fileName
Exit Sub
errorhandler:
MsgBox "File Name Change"
MsgBox Err.Number
MsgBox Err.Description
End Sub
Justin Cave
ODBC Development<HR></BLOCKQUOTE>
null -
Contains query fails for extended ascii characters
I have an Oracle 9.2 instance whose characterset is WE8MSWIN1252. I'm using the same characterset on my client. If I have a LONG column that contains extended-ascii characters (the example I'm using has the Euro character 'â¬', but I've seen the same problem with other characters), and I'm using the Intermedia service to index that column, then this select statement returns no records even though it should find several:
select id from table1 where (contains(long_col,'â¬',1) > 0);
However, the same select statement looking for something else, like 'e', works just fine.
What am I doing wrong? I can do a "like" query against a VARCHAR2 column with a Euro character, and it works correctly. I can do a "dbms_lob.instr" query against a CLOB column with a Euro character, and it also works. It's just the "contains" query against a LONG column that fails.There are a number of limitations in using Long datatypes. If you check the SQL Reference you will see: "Oracle Corporation strongly recommends that you convert LONG columns to LOB columns as soon as possible. Creation of new LONG columns is scheduled for desupport.
LOB columns are subject to far fewer restrictions than LONG columns. Further, LOB functionality is enhanced in every release, whereas LONG functionality has been static for several releases." -
Extended ASCII changing to UNICODE in Oracle9i?
Hello,
We're just getting to verifying support for our applications against Oracle9i database. Historically, we've been supporting Oracle8 and Oracle8i, and they work just peachy.
On some of our tables, we have a varchar column that is 255 characters long. We often import data that is exactly 255 chars in length. With 9i, if the data is 255 chars long, and contains any extended ASCII chars (such as degree symbol or plus/minus symbol, both of which we use), that row will fail to be imported. My personal impression is that it is being converted to UNICODE, which of course means that it becomes a two-byte character, and that means that this 255 char string is now 256 chars (bytes, actually, but you know what I mean), and can't be loaded into a varchar(255).
We are willing to change our schema, but cannot do so until our next release. We need to get this release working on 9i, without changing the schema.
Is it possible to import (using sqlldr) extended ASCII characters without changing them into Unicode characters?
I have tried changing my NLS_LANG settings to US7ASCII (which is definitely wrong, it changes the extended chars into zeros) and I have tried WE8MSWIN1252, which does preserve the symbols, but does not preserve the ASCII encoding...
I have tested the application against a changed schema ( just extended the varchar(255) to varchar(265)), so I know it works, but we've alreacy frozen this release, so I can't include the new schema...
I am totally open to any suggestion that does not involve schema changes...
Thank you,
WilliamMy previous post is not really relevant to your problem.
What character sets are you using in Oracle 8, Oracle 8i
and Oracle 9i?
For example:
SQL> select * from nls_database_parameters
2 where parameter = any('NLS_CHARACTERSET','NLS_NCHAR_CHARACTERSET');
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P15
NLS_NCHAR_CHARACTERSET AL16UTF16
According to Oracle's documentation,
up to three character set conversions may be required for data definition language
(DDL) during an export/import operation:
1. Export writes export files using the character set specified in the NLS_LANG
environment variable for the user session. A character set conversion is
performed if the value of NLS_LANG differs from the database character set.
2. If the export file's character set is different than the import user session
character set, then Import converts the character set to its user session character
set. Import can only perform this conversion for single-byte character sets. This
means that for multibyte character sets, the import file's character set must be
identical to the export file's character set.
3. A final character set conversion may be performed if the target database's
character set is different from the character set used by the import user session.
To minimize data loss due to character set conversions, ensure that the export
database, the export user session, the import user session, and the import database
all use the same character set. -
Using Oracle ODBC Gateway connecting to a remote Oracle database
Oracle 11gR2
RHEL 6.4
Has anyone use the Oracle ODBC Gateway to connect to another Oracle database? Any issues with that configuration? Where do I get the ODBC drivers for Linux?
(I know, "why not use a dblink?" -- well that would be against company security policies)Hi,
From the Oracle point of view we support using DG4ODBC for Oracle to Oracle connections. However, we have not actually tested it as DG4ODBC is primarily designed for access to non-Oracle databases.
How DG4ODBC will work between Oracle databases depends on the ODBC driver and what that supports. You will need an ODBC Oracle driver which you can get from various suppliers including Oracle but also vendors such as DataDirect, Easysoft etc. You could try a Google search.
You say you do not want to use database links but that is how DG4ODBC is used, You cannot do -
sqlplus user/password@dg4odbc_oracle
Once Dg4ODBC is setup and configured as in this note - if you are using Linux 64-bit -
How to Configure DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX Itanium) to Connect to Non-Oracle Databases Post Install (Doc ID 561033.1)
then in the Oracle database you create a database link and select from tables in the other Oracle database -
select * from table@dg4odbc_db_link ;
Regards,
Mike -
Problem with Oracle ODBC Driver on Windows 7
Hi,
Please help with this problem I have with a Windows 7 machine. I have installed Oracle Client 11g on my Windows 7 machine but when I want to create an ODBC Data Source, I cant find any driver for oracle. How can I resolve this issue? I need the data source for an application to work and I cant figure out what is happening. Someone please help!There's a dedicated Oracle ODBC forum:
ODBC
As this forum deals with connections from Oracle to foreign data stores it would be better to close this thread and post it again in the ODBC forum. -
How do I install just the Oracle ODBC drivers on a Windows NT workstation?
I want to access a remote Oracle database on my network via ODBC
from Visual Foxpro. When I try to set up the ODBC data source,
I'm told it doesn't exist. I downloaded the ODBC driver
(ora8175.exe) from Oracle, but I cannot get it to run.
I am new to Oracle, so any assistance you can provide will be
greatly appreciated. (I am very familiar with VFP).
Thanks,
JeffYou have to install the Oracle client in order to be able to use
the Oracle ODBC driver. The ODBC driver relies on, among other
things, the network communication libraries of the Oracle client.
If you're willing to pay for an ODBC driver, Merant (now
DataDirect I believe) has an ODBC driver that doesn't require
the Oracle client to be present. I've not used it, so I can't
recommend it, but it's an option.
Justin -
Oracle ODBC - Internal Error - unable to initialize NLS during driver load
I'm having some trouble with my ODBC connections which I hope someone can please help me with!
About 6 weeks ago all was working as normal.
As far as I know there have been no updates to the ORacle DB, the Windows XP operating system or the ODBC Drivers.
Today when I opened access and visual case 2 to connect to Oracle I was at first greeted with a:
unable to connect SQLState=IM004 SQL_HANDLE_ENV
error. ODBC also kept crashing.
I restarted the computer and was confronted with a different error:
odbc SQLSTate 08004 ORA 12154 TNS could not resolve the connect identifier specified
I was able to fix this error by setting the environment variable TNS_ADMIN in windows xp environment variables. I'm extremely confused about how this happened though as it was working and I don't think anything has changed.
I was then able to connect to the database via Microsoft Access but when I opened Visual Case 2 and tried to make an update, I was confronted with the following error:
Oracle ODBC Driver - internal error - unable to initialize NLS during driver load
I looked in the registry at:
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient10g_home1
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraClient10g_home2
HKEY_LOCAL_MACHINE\SOFTWARE\Oracle\KEY_OraDb10g_home1
and NLS_LANG was set to "AMERICAN_AMERICA.WE8MSWIN1252" in all 3 places.
(Though KEY_OraClient10g_home2 only had 4 entries as opposed to KEY_OraClient10g_home1's 13 entries)...
Since I made those changes I can no longer connect through Access.
I just receive a ODBC - connection to 'xxx' failed
Advice greatly appreciated!!!!
Edited by: user11150264 on Aug 25, 2009 10:21 PMActually it sort of does...
I switched the ODBC connection to use instant client and now it's all working again.
The biggest mystery is what changed to make it suddenly stop working the old way...
Maybe you are looking for
-
How to restore library from a CD backup
Hi, My PB 12" HD just decide to die last week. So I had to change it, and get my pictures back from a DVD backup I had. The backup is a little bit older that what I had in mind, but it is still better than nothing! The problem I have is that I do not
-
Can't install the configuration profile
Hi, I have upgraded the ipad2 to iOS 5 and created a configuration profile, when I connect the iPad through USB, I can see the install button but when I click on it, nothing happens, it seems as if I missed something! Even when I try sending it as at
-
Hi all, Can anybody list out the methods(or types) of reports in oracle apps 11i, ie oracle reports,sql.. thks
-
Hi I created standby redologs and change lgwr async mode. (max performance) How can I know wheter the standby redologs are used or not? I want to make sure that db is using standby redologs rather than archive transfer..
-
Macbook forgot all passwords in keychain, date & time...be worried?
So I started up my macbook this morning, and, like the title says, it forgot all the passwords in my keychain (wireless, email, etc.) and it had Dec. 20, 2000 as the date. I fixed everything and nothing else seems out of place (Dashboard, files, all