Missing javax classes in Android - java

I need to import a JDBC driver into my project, but it uses a handful of classes Android doesn't provide by default, such as javax.naming.* . I've tried to import those as an external library, but they in turn reference multiple other libraries (com.sun.naming.*,com.sun.jndi and so on) as well, rendering this approach impossible to succeed.
Question: what is the best way to approach this problem?
Thank you.

There is no best way for solving your problem. Unfortunately, JDBC is not used with Android, so the best way is not use it. There are many other database solutions to work with.
IMHO, I certainly would not recommend it. Why? Because JDBC is designed for high-bandwidth, low-latency, highly-reliable network connections. For example, desktop to database server, Web application server to database server and so on. Mobile devices offer little of these, and none of them consistently.
Hope it helps.

Related

Oracle Forms 10g - communicating with hardware devices

Before Oracle Forms 10g, or WebForms, as the call it, functionality to communicate with hardware devices was done via ActiveX / OCX controls. As I undertand it, you now have to migrate this kind of functionality to either Pluggable Java Component's (PJCs) or use WebUtil to be able to call dll's on clients.
The problem is that information on this seems pretty scarce and based on this alone, it's difficult to choose a good way to communicate with a hardware decive such as a scanner or a photo cam. Has anyone done this and could indicate a either a tutorial, an example of such sort?
You should use a PJC to accomplish this.
There is a good site with examples from françois degrelle
here and it also contains the code how to implement it.
If you use PJC then you are in java on the client side. So at that moment you can do anything you can do in java. Also communicate with devices.
You can also use jacob (JAva-COM Bridge), but I don't know this is suited for you.
But if it is here is the main site about jacob with lots of explanation what you can do with it.

Difference between java.sql and mysql.jdbc

I've only learned Java last quarter of 2010. I can say the knowledge I gained as of now are not enough and there's a lot of improvement. I still do studying while developing but most of my code is snippet from other current working application. I guess my way of studying the language affect the way I know it. Instead of learning the basic first, I jump up to advanced features that affect how I understand it. (I did advanced to fulfill my previous project tasks.)
I often connect to my MySql database using import java.sql.connection etc. I'm using Eclipse IDE then when I create an instance of Connection/PreparedStatement and I haven't imported the packages. Eclipse will show related Packages that's where mysql.jdbc.* I've encountered.
All though I did some research about it still its not too clear for me. The difference of those to packages.
Does it have pros and cons?
Does it have a big significance difference with performance and security?
Does it use in different way?
Is there more things to know?
I know someone here can enlighten me more about this.
To quote from the javadoc for com.mysql.jdbc.Connection:
This interface contains methods that are considered the "vendor extension" to the JDBC API for MySQL's implementation of java.sql.Connection.
So, that class at least builds on top of JDBC to add more features. But it's still JDBC at heart - you're using this class when you use pure JDBC, you just don't see it.
I would say that if you can build your app using only the standard JDBC interfaces, do so. If you absolutely need MySQL-specific API features, then use the MySQL interfaces. I work with Oracle mostly, and in all the years i've been doing it, i've never had to fall back to any Oracle-specific interfaces; there's a huge amount you can do with JDBC.
To address your points:
The pro is more features; the con is less standardisation
I would not expect any difference with performance and security, since the two packages use the same classes under the hood (AIUI)
The usage should not be fundamentally different; the MySQL package should add on to the JDBC package
There is more to know in the MySQL package, because you need to know about JDBC to use it anyway
To put it simply: Java (J2SE/J2EE) provides java.sql.* as the standard way to connect to a database. The issue is that these classes do not know really know how to connect to each specific database in the model, they are oriented to the programmer.
To connecto to each database, you need to put in its Driver. The Oracle driver will know how to connect to the Oracle database, the mysql driver will know how to connect to MySQL. java.sql. will know how to use each Driver, so by just using it you do not need to know the internals of each Driver.

Where to begin with a Java project

I've tried searching for similar questions here and I don't think I've found anything that matches what I'm looking for. I would like to know where to start in developing a (most likely) database-driven Java application that could keep track of customers, invoices, and quotes for my dad's auto shop. There will be a couple computers in the shop that will need access to it.
I was thinking of having a server in there to handle the database and let whatever machines need to access it use a client app.
Almost all of my experience is in a LAMP environment but I have been trying to learn as much as I can about Java and feel pretty comfortable playing with it in Netbeans or Eclipse.
I'm not asking anyone to tell me how to make it or anything. I would just like to know where to start learning. Is MySQL a good match with Java or should I use something else? I've been wanting to learn Java and I figured this would be a good project to learn on but everything I read seems to give only bits and pieces of what I want to know.
Java and MySQL work well together. Here are some things I would recommend to get started:
JDBC (Java Database Connector) - use it to connect to MySQL
Swing programming - used to create the GUI front end that users will interact with. While NetBeans has a drag and drop GUI builder interface, actually understanding what's going on under the hood is very important.
GlazedLists is a great project for showing dynamic content in table format, such that you can easily filter, sort, etc. Given you will probably have table views of customers, etc., I would look into this
If I were you I would definitely set the bar a little bit lower and try some easier projects to start with (ones that do not require database connectivity, for instance). Once you're a little more advanced with Java, then I'd start work integrating a MySQL table with your app.
I think that most of the answers to this question will prove useful as a starting point
You'll never find a complete subject list to learn java or any other tecnology, I suggest that you should start by writing down the requirements for the project and start "trying/failing" at what you want to do. Bits and Pieces are a very good way to learn.
You could try building different test applications, to get the feel of java, and slowly start using all parts needed to build your application. Common concepts used in small database-driven Java applications are:
JDBC, a java database connector
A client/server architecture (needed if multiple clients need to keep their data synchronized)
Synchronization
A swing GUI
A learning path that worked for me was:
Build a command-line driven java application
Build a test application with a graphical user interface (GUI).
Build a test application with a client/server architecture, but with only one client
Build a test application with a client/server architecture, connect multiple clients and keep them synchronized.
Build a java application with a JDBC database connector, set up a MySQL server and connect the server in your client/server architecture to it.
You can search for each of the concepts on the internet. It should be easy to find tutorials that will teach you how to use them.
MySQL should work well with Java.
In any case, if you use JDBC (a generic API to access SQL databases, part of the standard Java library), you should be quite independent of what underlying database you are using (apart from vendor-specific SQL extensions).

is anybody have experience of using J/XFS?

i have to use j/XFS implementations with my java application. and i dont have any idea of what j/xfs is? on google also i found only one small 15page document. so can anybody give me some links?
To add a few comments, the idea behind the J/XFS is to make you application independen of specific financial device (printers, check readers etc).
Also check out www.dynasty.es, they have a commercial platform based on J/XFS with huge number of drivers and administrative tools. (I'm not affiliated with them, but they seem to be the only company I know that offer such products).

Where can I find an AS400 to Java interface?

Does anyone have links and resources to connect to an AS400 from Java?
I remember years ago, somebody told me about a connector that simulates KeyStrokes from the keyboard and other "purest" approach that connected directly.
On the web I have found a lot of links, but I cannot find a complete product to do this (I am probably not using the right keywords).
EDIT
Thanks for the answers:
What we are looking for is a way to access the data inside the AS400 and/or the screens it uses and expose them for other new applications re-use. Either as a webservice of some sort, or directly through Java ( and java will expose the operations using webservices )
Thanks in advance.
EDIT
As per MicSim post, I've also found this link:
http://www.ibm.com/developerworks/library/ws-as400/index.html
What you are looking for is probably the Toolbox for Java™ & JTOpen from IBM. There is also an AS400 class in the toolbox for performing specific AS400 tasks. You can look here and here for more details. Just googled it and hope it's helpful.
IBM's 5250 screen-scraping technology was "WebFacing" - I would post a link but you're probably better off Googling it, since IBM's documentation is so scattered. There are other technologies available too but: Screen-scraping was never anyone's favourite since typically you end up with something which, although it looks more up-to-date, actually is harder to use than a green screen and no more functional. The 5250 is probably the single best data entry platform I've ever used - web forms in a browser are one of the worst.
As mentioned, jt400 is the way to go for most other things. In particular:
JDBC - for all things SQL. If you do it right and address your files as though they really are tables, it's a way to get away from the 400 entirely.
Record-level access - write Java programs using a similar database API to RPGLE (all those chains, setlls that 400 programmers love)
Call programs, system commands, manage resources (data queues, data areas, prints / spools, jobs etc etc)
Good luck
If you just want to run Java on the AS/400 (or iSeries, or System i, or whatever IBM's marketing department has decided to call it this month), that's a supported language. You can access the pseudo-DB2 database directly. Or are you after some other form of integration?
This obviously depends on what you want to do, however if you want to simulate keystrokes across a network connection to an AS400 process then Expect4j may be the library you are looking for.
This is generally a really nasty hack though and there are frequently better ways to achieve your goals. What are you trying to do?
The expect4J library can be found here. Expect was originally a unix command that allowed you to specify a string that you are expecting to see and then a string of characters to return. It was frequently used for automating logins etc and for screen-scraping applications.
Even better is the TN5250j Console, which can be used to extract data from the AS/400.
jacada makes tools to do what your looking for
http://www.jacada.com/

Categories

Resources