PPC: Connect to DB on Unix machine; and File Transfer

G

Guest

Hi All,

I am developing a Smart Device Application in C#.NET. The database I am
using for the application is MySql. The application should retrieve data from
the server, insert it into SQLServer CE, and later upload it back to the
Server. The database server resides in a UNIX machine.

I am having two issues in the application. The first one is regarding the
connection. I am not able to connect to the database server. Details are
given below.

I downloaded the MySql driver for Pocket PC from the site,
http://www.crlab.com/ and I was able to connect to the test databases
residing in our company's LAN, as well as our company's database server.
These two databases are installed in Windows machine. But, I am not able to
connect to the database that resides in the Unix server, in Germany, where
as, now I am writing from India.

The connection string I provided in the application is as follows:

public static string strmySqlConn = "User
Id=Dummy_User;Password=Dummy_Password;Host=xxx.xx.xx.xx;Database=DB_Name;Port=3307";

The default port for MySql server is 3306, where as the client has provided
that the database is installed in port 3307.
I am able to 'ping' to the IP Address of their database server, which means
it is public IP. But, I am not able to connect to the server through
application. What can be the reason? If the database is behind the firewall,
will that create any problem?

I downloaded ODBC driver for windows from the site,
http://dev.mysql.com/downloads/connector/odbc/3.51.html
I created a windows application and tried to connect using ODBC Connection.
That also didnt give any result. I was not able to connect. Meanwhile, I was
able to connect to the database in our LAN as well as our Company's database
server. So, what can be the reason for the same not connecting to the live
server? Is it beacause, the server is running on Unix or is it because the
database is behind the firewall? If it is behind the firewall, what should be
done?

So also, .NET Compact framework doesnot support System.Data.Odbc. So, Odbc
conneciton is not possible for Pocket PC application. How can I connect to
the database? Will I be able to connect using the MySql driver provided by
Corelab? Please help me to find the solution.

The next issue in front of me is regarding the uploading of files. Details:

I have to upload files(audio/video) from the Pocket PC to Desktop PC through
the application. My application is having an option of Synchronizing data
from the Pocket PC to Desktop PC. When the user click the same, I have to
move files from PPC to Desktop. My database table is not having any BLOB type
field, so i have to physically move the files from PPC to Desktop PC. And
also the server runs on UNIX. Please help me out in finding the solution for
moving files from PPC to Desktop PC.


Thanks
Sarun
 
G

Ginny Caughey [MVP]

Sarun,

I don't have any experience with MySql, so I can't answer your specific
question unfortunately. But have you considered using Web Services as a
solution? That should work with any database and any OS that supports Web
Services.

As for moving files between the desktop and device programmaticly, there is
the Remote API (Rapi) which you can use from a desktop app to do things on
the device. There is a managed code Rapi class on www.opennetcf.org.

Ginny Caughey
..NET Compact Framework MVP
 
G

Guest

Ginny Caughey.

Thanks for replying.

Still I will be having issues with the same. I have to create Webservice
which is pointing to Unix. If it was Windows, and is to be developed in .NET,
that was not a problem. But creating Webservice pointing to Unix is what I
havent done earlier.

And reagarding RAPI, that also, should be developed for Unix machine. If at
all, it was Windows application, how can I invoke a particular desktop
application from a mobile application? Since, the application I am developing
has to send files from the PPC to Desktop PC on click of a button in the PPC.
 
G

Ginny Caughey [MVP]

Sarun,

I didn't understand that your desktop machine is running Unix. Ok, how about
using sockets? There are sample socket samples on MSDN that you could
probably adapt. Or you might find some Unix socket samples that you could
adapt.

Ginny
 
D

dassyms

hello Cauchey,
I am also facing problems using asynchronous sockets.
my smart device appln.(wince.net 4.2 powered device) also pointing to
UNIX & having a oracle database server.
my desktopPC is WinXP Professional.
my device is intermec CK30.
i couldnt even connect to the UNIX server.iam using TCP SOCKETS.WITH
active sync 3.8,VS.NET2003.
the msdn sample(non-blocking sample) didnt help me to establish a
connection.?
or as Sarun has followed the webservices path, should i also go through
the same & using web services pointing
UNIX SERVER & in turn oracle DB.but i dont have that kid of requirement
as mentioned by sarun. (file transfer from smart device to DESKTOP PC).
i am simply storing
some data inside the sqlserverCE.


any help regarding this client-socket code?
THNX IN advance.
DAS

Das Dexterity
 
G

Ginny Caughey [MVP]

Generally using a web service will be easier than using sockets. It sounds
from your description that you had problems connecting your desktop app to
Oracle. I wouldn't expect your device app to be able to connect directly to
Oracle unless Oracle has released a .NET Compact Framework wrapper for this
that I am not aware of.

Ginny Caughey
..NET Compact Framework MVP
 
D

dassyms

Hi Ginny Caughey,

Thanx for the reply.Sorry for NOT to elaborate my issue.

I may have (not sure) to use Asynchronous sockets
to talk to the UNIX Server & from UNIX,
the IPC(message queues)mechanism will read my data.

Pro*C will in turn read that message queus & update the oracle DB in
unix server (i am not worried abt that part).

here, i "just" have to communicate with UNIX server using asynchronous
sockets model.(if i use web services?how is it possible?).
so iam NOT directly updating the oracle DB in the unix.
my concern is to send some 10 KB of data to UNIX server.
and when it receives this data it will send acknowledemgent/info.to
smart device (WINECE.NET 4.2/VB.NET) client.
though we tried some samples(am a .net CF beginner)
& couldnt able to connect.
thats were iam looking for running-sample code
we have tried with beginsend(), beginreceive()
but when i debugs it.(i put it in the try.. catch) it simply goes
through the connect() of the socket object

((the objclientsocket.connect(New
IPEndPoint(ipaddress.parse("199.122.44.144")56)
& nothing happens. it didint show any errors..

where i was wrong?
or should i go back to synchronous model?

or web services is the only alternative, while talking to another OS,
from a WINCE.net smart device client??

kindly point me to right direction..
regds




















Das Dexterity
 
G

Ginny Caughey [MVP]

Sorry but I don't have any experience working with CE devices and Unix, and
I haven't worked with Unix for many years. Certainly it would be possible
since Unix supports sockets and web services, but I don't have any sample
code for you. I'd suggest looking on Google or in newsgroups that support
Unix developers.

Ginny
 
G

Guest

Hi Ginny, Das and others,

My problem for connecting to Unix server got solved to some extent. The
client sent us a stunnel file. Its a preconfigurated file for accessing the
MySql server in Unix machine. Just go through http://www.stunnel.org/

After running the stunnel from my machine, I created a new connection in my
MySql Client by giving the host name as 127.0.0.1, and, username and password
as that of the live server. Then changed the host in the connection string of
the application to ip address of my local machine. Now, I am able to connect
to the database and download the data from the server. But, I think if the
user wants to synchronize the data, he needs to connect to a machine inside
the LAN of the company. He may not be able to connect it from outside the
company LAN.

Das, I think you can just try something like this. ie, retrieve the data
from the Oracle database to Windows machine. Once the data is downloaded to
Windows machine, its not a problem, rt??

Again, my second problem, ie, file transfer has not yet been solved. Anyone
has the solution for the same?
 
D

dassyms

Hi Sarun,
thnx for info,abt stunnel.

as quoted by W.G. Ryan eMVP

as Web Services and CF development - Casey Chesnut at
www.brains-n-brawn.com
probably has the coolest samples of doing some pretty complex stuff (the
whole site is cool - not just the PDA stuff). Similarly, you'll
definitely
want to check out the SDF at www.opennetcf.org which is the best CF
reference on the web. The web servcies will be located on a web server
somewhere - that's up to you but if you want to plug into a few samples
I
think Casey has some exposed and if not - the GOogle API is a great one
to
use.

hope this will help a little bit...

Das Dexterity
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top