Link to home
Start Free TrialLog in
Avatar of hrki1991
hrki1991

asked on

How can I connect Mobile Ce 5.0 app with Oracle database???

I made windows mobile app in visual studio 2005 and don't know how to connect with oracle database. I was made console app and successfully connect  with oracle db. I was using Oracle.DataAccess and System.Data.OleDb connection.But I can't use that in windows mobile app. There's only sql.client and such staff, there's nothing that I can use for connection to oracle database.

Please can you tell me what should I use to connect to oracle database.I'm also try to copy SystemData.dll and Oracle....dll to my app properties but assambley don't recognized it.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Never created a mobile app so this may be way off base.

You might try the new .Net Managed Client for Oracle:
http://www.oracle.com/technetwork/issue-archive/2014/14-mar/o24odp-2147205.html

It is 100% .Net code and there isn't a need for any Oracle Client install.  I'm using it for .Net web apps and am pretty happy with it.
Avatar of hrki1991

ASKER

I tried that too. But it's imposible to add that reference in my PocketPc. I can manipulate witha that in windows app form and console, but not in pocket pc. :(
Capture.PNG
Not knowing anything about Windows CE makes things difficult.

Can you not compile it on a regular Windows box and deploy it to the CE machine?

I just copy the Oracle DLL into the bin folder of the app and can copy the app around all day.  Again, I deal with .Net web apps.
Thanks for your help anyway. I'll resolve my problem next week, or I'll try :) .

I have one more problem. I'm connected thru vpn, and my oracle sql developer to database.User generated image
 Everythin working ok. But when I used string

string ConnectionString = "Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS= (PROTOCOL = TCP)(HOST =<HOSTNAME(IP ADRESS)>)(PORT = 1521)))(CONNECT_DATA = (SERVER =<SID>)(SERVICE_NAME =<SID>)));Password=<PASS>;User ID=<USER>;"

Open in new window


there's always error: System.Data.OracleClient.OracleException: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

I'm using similar and exactly string code to connect to database I created, on this computer, both codes working. But when I try connect to that base there's always error.


My vpn are set, and I can access to that database thru oracle sql developer. I can't find my mistake, becouse I'm only junior developer, extra junior in c# and oracle database

P.S. When I'm not connect to vpn, my console app work longer, and then send me error for connection time out(logical) but when I'm connected he show me error message very fast, message from above
When I try tnsping to that IP i get this

Used HOSTNAME adapter to resolve the alias
Attempting to contact (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTO
COL=TCP)(HOST=xxx.xxx.xxx.xxx)(PORT=1521)))
OK (700 msec)
I also edti my tnsnames.ora file...but error is still there...
I'll try to bring in some more Experts.

>>and then send me error for connection time out

If it is an ORA-12170, 99.99% of the time it is a firewall issue.  Something is blocking the high level ports.

>>ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

I set up my .Net connect strings in my web.config.  I also still use the tnsnames.ora connection syntax instead of EZConnect.

Here is my connection information from one of my web.configs.  Starting in 11g, the passwords are case sensitive so I use double quotes around it:
<add key="ConnectionString" value='User Id=scott;Password="tiger";Data Source=ORCL;Max Pool Size=300' />
How is even possible that I can't coonnect to 1 of 3 databases...only diferece is that db have IP in hostname, it isn't localhost like usualy.

And how is even possible that I can acces that db from my oracle sql developer, but can't from code in c# ???
>>that I can acces that db from my oracle sql developer, but can't from code in c# ???

Easy.  SQL Developer may or may not use the tnsnames.ora file.  An installed Oracle client isn't required for SQL Developer.  It can use the JDBC Thin connection.

>>only diferece is that db have IP in hostname, it isn't localhost like usualy.

Networking/firewall?

I ALWAYS use IP address in my Oracle config files.  Weird things can and DO happen if you use hostname.
I've requested that this question be closed as follows:

Accepted answer: 0 points for hrki1991's comment #a40929492

for the following reason:

l
Please post the solution so others that might have this issue know what to do.
I don't have solution yet. :(

things that I does for now are that I set up my odbc driver. Now I can connect to oracle database with my oracle client(odbc)

To do that, and reason for ORA-12514: TNS:listener does not currently know of service requested in connect descriptor is that everyone should setup:
---Control Panel->System->Advance system seting->Advanced->Enviroment Variables->and there on sytem variables create new with name(TNS_ADMINISTRATOR) with path to your file with tnsnames.ora tnsnames.ora.bak and sqlnet.ora. In tnsnames.ora you define your service name etc. . I don't know if tnsnames.ora.bak is necessary but for me it's working fine(driver in odbc in control panel).

Now I can connect to oracle db thru Visual Studio data connection and odbc and pretty much everything in this world but not with only one thing that I need. When I try connect via OdbcConnection in my code there still error

User generated image
I forgot to write.

I can connect with this string
String c = "Provider=MSDAORA;Data Source=xxx;User ID=xxx;Password=xxx;Unicode=True";
OleDbConnection conn = new OleDbConnection(c);

my ODBC WORKING!!!!, I tried it in control panel, but don't working in my code!!!!
>>create new with name(TNS_ADMINISTRATOR)

The correct variable name is TNS_ADMIN not TNS_ADMINISTRATOR.

>>Provider=MSDAORA

That is using the deprecated Microsoft access provider.  That only sits on top of the Oracle Client which is why it was deprecated.  You really shouldn't use it and go with native Oracle drivers.

>>I don't know if tnsnames.ora.bak is necessary but for me it's working fine

Not necessary.  Something or someone created a backup file.

>>When I try connect via OdbcConnection in my code there still error

Make sure the Bitness of everything matches.  64Bit Windows has two ODBC administrator tools.

https://support.microsoft.com/en-us/kb/942976

If the app is 32Bit, you need the 32Bit Oracle client installed and your DSN needs to be set up with the 32Bit ODBC admin tool.
>>If the app is 32Bit, you need the 32Bit Oracle client installed and your DSN needs to be set up with the 32Bit ODBC admin tool.

I olso think that's the problem. I have 64 bit PC, 64 bit driver and 32 bit VIsual Studio. In VS you can chose if you want debug with x64 or x86.

But I'm also install 32bit VS on my 32 bit virtual machine, with 32 bit driver, everything 32 bit and there's still same mistake.

I'm sorry for TNS_ADMINISTRATOR, I was so tired yesterday that didn't notice spelling mistake
You have tried many things with many variations.

Let's pick one and get that working.  No more trying several things at once.  It is confusing both of us.

I'll let you decide.  What once thing do you want to connect to what?

Once you've decided that:
What setup do you currently have?
What is the error you are receiving?
Yes, we should go back to begin. I must make app on windows mobile, it would be app for scanning product. That app should comunicate with oracle database via wi-fi on regular daily base.

My mistake is that I choose windows mobile form for developing that app. My thinking is that is tooooo complicate to develope such app in this form. They don't support odbc etc.

I am ready to hear solutions what type of app should I use for that. Some web app, for windows mobile????

I'm using vs 2008 becouse that is old windows mobile device/pocket pc with .net framework max 3.5


I'm new in all this and for me pocket pc and win mobile app 6.5 are similar. But i should make app which would work on almost every windows mobile device(scaners etc. Not mobiles)
From a security standpoint:

I would NEVER let an app like this talk directly to the database.
I would never let anything talk directly to my database using WiFi.

For security, you want the database as far away from open network connections as you can get it.

This typically involves middleware like a web service.  The end app makes a web service call.  The web service talks to the database.


All that said:
I cannot tell you what development platform you should use.  I know Oracle and some .Net web forms along with some native c.

I cannot say what you need to use to develop a scanning application for Windows Mobile devices.

>> They don't support odbc etc.

I wouldn't use ODBC.  I prefer native drivers.

All that said:
If Windows Mobile supports .Net 3.5, of course I would try to use that because I am familiar with .Net.

If you are going to write code using .Net to talk to an Oracle database, you use ODP.Net as the data provider.

I can help get a 3.5 .Net app talking to a database server.  If you would like, I might even be able to provide a simple console app with the Oracle 12 Managed Driver.

Now, will that work on Windows Mobile?  I have no idea?


I know nothing about Windows mobile and what software will actually run on it.

>>But i should make app which would work on almost every windows mobile device

Cannot help at all here.
>>I can help get a 3.5 .Net app talking to a database server.  If you would like, I might even be able to provide a simple console app with the Oracle 12 Managed Driver.

Thank for help but isn't problem console app. I connected my console app to db.

It's problem win mobile app that f shit haven't a half solution that console app have


>>I wouldn't use ODBC.  I prefer native drivers.

I checked ODP.NET and here is everything that downloading of that have. Still odbc :) .


Oracle Developer Tools for Visual Studio 12.1.0.2.0
              Oracle Data Provider for .NET 4 12.1.0.2.0
              Oracle Data Provider for .NET 2.0 12.1.0.2.0
              Oracle Providers for ASP.NET 4 12.1.0.2.0
              Oracle Providers for ASP.NET 2.0 12.1.0.2.0
              Oracle Database Extensions for .NET 4 12.1.0.2.0 -- for upgrade only
              Oracle Database Extensions for .NET 2.0 12.1.0.2.0 -- for upgrade only
              Oracle Provider for OLE DB 12.1.0.2.0
              Oracle Services for Microsoft Transaction Server 12.1.0.2.0
              Oracle ODBC Driver 12.1.0.2.0
              Oracle SQL*Plus 12.1.0.2.0
              Oracle Instant Client 12.1.0.2.0

Hm, I must decide what type of app should I use. Question: isn't web app available on every device
SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The idea with web service is good, but then I need one pc for server. That pc would be connected to db, and proced query. Then my console app would writing answers in file. Then that file would be sent on web service.

With my app on windows mobile  I would easy connect to my web service and download file, read from file, do things, write them to another file and then send that file to web service

Is that good theory from me???

The main is that I trying to bypass web service becouse of that onother PC.Only thing becouse I try to make direct access to database on my computer from my windows device is that I don't want that another PC in that hole story.

slightwv thank for your help, should we move this debate to private message???
>>When you say web app, do you mean an app available from a web browser, like an Intranet site?

No I think app that only use browser
>>No I think app that only use browser

I am confused.  Didn't you just agree with me but say "No"?  Web apps execute inside a browser?
yes, Web apps execute inside a browser

but that you can't connect to that app from another device, only from device where is installed
>> but that you can't connect to that app from another device,

Understood.  I don't think I ever suggest them for a solution to your problem.  I only stated that I use .Net for web apps.


Personally, I would forget about direct connectivity from the end user device to the database.  I really doubt you will find an Oracle driver that will allow the direct connect from old Windows Mobile/CE/??? days.

I would write an app that talks directly to a middleware server possibly a web service call.  Let that middleware talk to the database.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I find solution on my own