We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOther Libraries › Database access using ADO
Page Index Toggle Pages: 1
Database access using ADO (Read 3227 times)
Database access using ADO
Apr 29th, 2008, 12:39am
 
I am very new to Processing, I stumbled upon it just the other day and I am intrigued. I work for a large Architecture/Engineering firm and I typically use VBA scripts with Bentley Microstation to generate geometry. I have been looking for something Java-like for use in visualizing data from our structural analysis programs. I am able to export results from our analysis packages to Access Databases. I am familiar with ADO interaction with the database for importing and parsing data. I was wondering if it is possible to utilize ADO to access and import data into processing applets. Any help would be greatly appreciated.
Re: Database access using ADO
Reply #1 - May 2nd, 2008, 4:57pm
 
In Java, you can access Access databases (and many others) via JDBC.

Try to goole JDBC and you should find what you want.

If you need more help, I can upload a script example of a JDBC connection to an Access database.
Re: Database access using ADO
Reply #2 - Sep 26th, 2008, 12:55am
 
Hi, i am also very interested in the connection of ADO (I am also using MicroStation Generative Components) to Processing. It would be very appreciated if you could upload a script example of a JDBC connection to an Access database. looking forward to further discussion on this issue. Cheers!
Re: Database access using ADO
Reply #3 - Jun 8th, 2009, 6:06am
 
If someone has some examples on this, it would be greatly appreciated.  I'm trying to follow Ben's example in his book, which uses MYSQL, but it's not working for MS ACCESS.  Searching on the web, it states to use "sun.jdbc.odbc.JdbcOdbcDriver" but I get "java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver".  So I guess I don't have this library installed.  Anyone know where to get this library and how connect via ADO?
Re: Database access using ADO
Reply #4 - Jun 8th, 2009, 8:03am
 
That class lives in rt.jar which is shipped in every JRE, so you should have it!

On my Windows XP machine, if I type: Code:
sun.jdbc.odbc.JdbcOdbcDriver jod = new sun.jdbc.odbc.JdbcOdbcDriver(); 



in the PDE and run that, I have no errors. Idem if I do instead: Code:
import sun.jdbc.odbc.JdbcOdbcDriver;
JdbcOdbcDriver jod = new JdbcOdbcDriver();


Perhaps you forgot the import statement?
Re: Database access using ADO
Reply #5 - Jun 8th, 2009, 8:15am
 
I was only importing java.sql.*, but I tried to import as you stated "import sun.jdbc.odbc.JdbcOdbcDriver;" but it says that the package sun.jdbc does not exist.    I also tried "com.sun.jdbc..." but no go.  I'm running a MacBook, so I would think this would all be installed.
Re: Database access using ADO
Reply #6 - Jun 8th, 2009, 8:57am
 
Here is my problem... maybe it can be solved another way.  I want something portable.  I currently have my data in MS Access and created some nice forms, but also use Oracle to hold data.  My plan was to "link" MS Access to Oracle when needed.  I didn't want to hard code an Oracle or MySQL connection as I won't always have access to a "running" database.  Taking a look at Java DB and SQLite.. maybe these would work?  Access would be preferred but I'd also like it to be portable.
Re: Database access using ADO
Reply #7 - Jun 8th, 2009, 9:06am
 
You are using Access on a MacBook! I know MS Office is (was) available on Macs, but still the idea is... exotic!

Knowing that Java on Macs is made by Apple, I don't know if they took the trouble to implement this Sun-specific API. You can find the rt.jar in your JRE (in the lib folder), open it with an archive explorer and see if there is the sun/jdbc/odbc folders in it, with the JdbcOdbcDriver.class file.

A quick search shown that ODBC is supported on Mac (see Mac ODBC Help for example) but maybe you need to find a driver yourself.
Re: Database access using ADO
Reply #8 - Jun 8th, 2009, 10:52am
 
I copied an rt.jar file over from a windows box, since mac doesn't have one (uses classes.jar and ui.jar), but the duplication of classes made everything ambiguous.  Not sure how to copy those specific packages out of the jar file.

I don't have Access installed on my Mac (it's not part of Office for Mac), but this is what is currently being used on other machines.  I just happen to be developing on the Mac.

Re: Database access using ADO
Reply #9 - Jun 9th, 2009, 3:53am
 
Quote:
I copied an rt.jar file over from a windows box
Bad idea, I think... Smiley It is likely that in the end, the ODBC layer relies on native code (machine code depending on system).

I still don't understand how you work. Do you try to get data from a .mdb file or remotely from some Access installation?

In all cases, you are not taking the easy path, I fear... Wink
Re: Database access using ADO
Reply #10 - Jun 9th, 2009, 4:13am
 
I had created a portable local access database last year that people use to enter data (uses the forms built into Access).  Flash forward and now I'm working with Processing on my Mac to build an app to visualize the data.  I was hoping to create a direct ADO/DAO type connection into Access that could be platform independent, but would still allow people on their windows boxes to open up the Access forms and enter in new data.  I also like the import capability of Access.

I have another person that is using Oracle as a back end for the data.  So I'm trying to figure out the best way to allow people to import data, work with different database types (Access can do linked tables), be portable, and platform independent.  Not an easy task...  Undecided
Page Index Toggle Pages: 1