Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
General JDBC questions, and how to connect via PHP, ASP
Old 08-13-2008, 03:00 PM Re: General JDBC questions, and how to connect via PHP, ASP
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
Quote:
Originally Posted by jpmad4it View Post
@Willcode4beer: Sorry to be a pain, Would these architectures also be possible:

Combining Ruby on Rails with IBM WebSphere Application Server, using JRuby to deploy web apps, using JDBC Type 4 to connect to the database via TCP/IP.

Can I run Ruby on Rails and use JRuby to set up a JDBC type 4 connection to the database, and to deploy web apps?

What other application servers can ruby run on?
[/font]
That's a very interesting idea.

I'm haven't seen it run on Websphere but since, Ruby on Rails is able to run on JRuby with either Glassfish or Tomcat (I have seen both of these), I would think it could run on Websphere as well. It's just a J2EE server.

refs:
http://weblogs.java.net/blog/arungup..._jruby_on.html
http://wiki.jruby.org/wiki/Walkthroughs_and_Tutorials
http://wiki.jruby.org/wiki/JRuby_on_Rails_in_GlassFish
http://wiki.jruby.org/wiki/Jruby_on_Rails_on_Tomcat
http://wiki.jruby.org/wiki/JRuby_on_Rails_on_WebSphere
http://wiki.jruby.org/wiki/JRuby_on_...n_BEA_Weblogic

this is about Jetty but, the JNDI information should still be relevant:
http://wiki.jruby.org/wiki/Rails_wit..._JNDI_on_Jetty

hope that helps
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-14-2008, 03:03 AM Re: General JDBC questions, and how to connect via PHP, ASP
Average Talker

Posts: 20
Trades: 0
Quote:
Originally Posted by willcode4beer View Post
That's a very interesting idea.

I'm haven't seen it run on Websphere but since, Ruby on Rails is able to run on JRuby with either Glassfish or Tomcat (I have seen both of these), I would think it could run on Websphere as well. It's just a J2EE server.

refs:
http://weblogs.java.net/blog/arungup..._jruby_on.html
http://wiki.jruby.org/wiki/Walkthroughs_and_Tutorials
http://wiki.jruby.org/wiki/JRuby_on_Rails_in_GlassFish
http://wiki.jruby.org/wiki/Jruby_on_Rails_on_Tomcat
http://wiki.jruby.org/wiki/JRuby_on_Rails_on_WebSphere
http://wiki.jruby.org/wiki/JRuby_on_...n_BEA_Weblogic

this is about Jetty but, the JNDI information should still be relevant:
http://wiki.jruby.org/wiki/Rails_wit..._JNDI_on_Jetty

hope that helps
Thanks fot the refs. I found a link for ibm's site too:

http://www.ibm.com/developerworks/we...illington.html

Looks promising. This may be a good alternative to PHP. I will include it as part of my evaluation.
jpmad4it is offline
Reply With Quote
View Public Profile
 
Old 08-14-2008, 01:41 PM Re: General JDBC questions, and how to connect via PHP, ASP
Average Talker

Posts: 20
Trades: 0
@willcodeforbeer

Can you give me a few tips on this diagram:



Sorry its messy, I have just thrown it together as I am off out soon.

Do you see the part where the Java VM is. Well I got confused with that. I know that the Java VM runs in the JDK or JRE, but where does the J2EE platform come into the whole thing? Do I even need it for this architecture?

Also, are tomcat and glassfish J2EE servers themselves, like websphere? If not, what is the difference?

I only ask because the PHP-Java bridge can run on Tomcat, and I just wondered if Tomcat would actually go in the place of the J2EE server in this diagram, within which the JDK and JVM are located?

any help would be fantastic
jpmad4it is offline
Reply With Quote
View Public Profile
 
Old 08-18-2008, 10:42 AM Re: General JDBC questions, and how to connect via PHP, ASP
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
Quote:
Originally Posted by jpmad4it View Post
Do you see the part where the Java VM is. Well I got confused with that. I know that the Java VM runs in the JDK or JRE, but where does the J2EE platform come into the whole thing? Do I even need it for this architecture?
The Java VM and the JRE are the same thing.
Java VM (or JVM) = Java Virtual Machine
JRE = Java Runtime Environment
JDK = Java Development Kit
In essence the JDK is a set of libraries running in the JRE (compilers and things)
Most J2EE servers need to run on a JDK so they can compile JSP's (Java Server Pages)
Quote:
Originally Posted by jpmad4it View Post
Also, are tomcat and glassfish J2EE servers themselves, like websphere? If not, what is the difference?
Yes they are. The only difference, Glassfish and Websphere both support EJB's (enterprise java beans) and Tomcat doesn't. You won't need EJB's for your project so, that doesn't matter.
Glassfish is the open source version of Sun Microsystem's J2EE Server.
Quote:
Originally Posted by jpmad4it View Post
I only ask because the PHP-Java bridge can run on Tomcat, and I just wondered if Tomcat would actually go in the place of the J2EE server in this diagram, within which the JDK and JVM are located?
Tomcat absolutely could (so could Jetty for that matter). The reason I suggested it was price. Because of the cost of WebSphere and the poor quality of support offered by IBM, funds would be better spent training existing personnel on Tomcat. Though the documentation is good enough you probably won't need it.

Hope that Helps
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 08-18-2008, 11:57 AM Re: General JDBC questions, and how to connect via PHP, ASP
Average Talker

Posts: 20
Trades: 0
Quote:
Originally Posted by willcode4beer View Post
The Java VM and the JRE are the same thing.
Java VM (or JVM) = Java Virtual Machine
JRE = Java Runtime Environment
JDK = Java Development Kit
In essence the JDK is a set of libraries running in the JRE (compilers and things)
Most J2EE servers need to run on a JDK so they can compile JSP's (Java Server Pages)

Yes they are. The only difference, Glassfish and Websphere both support EJB's (enterprise java beans) and Tomcat doesn't. You won't need EJB's for your project so, that doesn't matter.
Glassfish is the open source version of Sun Microsystem's J2EE Server.

Tomcat absolutely could (so could Jetty for that matter). The reason I suggested it was price. Because of the cost of WebSphere and the poor quality of support offered by IBM, funds would be better spent training existing personnel on Tomcat. Though the documentation is good enough you probably won't need it.

Hope that Helps
wicked thats cleared it up thanks.

How much does WebSphere by the way?? Is it just a set price for the software?
jpmad4it is offline
Reply With Quote
View Public Profile
 
Old 08-18-2008, 05:43 PM Re: General JDBC questions, and how to connect via PHP, ASP
willcode4beer's Avatar
Super Moderator

Posts: 1,533
Name: Paul Davis
Location: San Francisco
Trades: 1
Quote:
Originally Posted by jpmad4it View Post
Combining Ruby on Rails with IBM WebSphere Application Server, using JRuby to deploy web apps, using JDBC Type 4 to connect to the database via TCP/IP.

Can I run Ruby on Rails and use JRuby to set up a JDBC type 4 connection to the database, and to deploy web apps?
These are both the same question. Answer, yes
Quote:
Originally Posted by jpmad4it View Post
What other application servers can ruby run on?
beyond the list from the jRuby site, I don't know. But, it seems like quite a few are listed there.
__________________

Please login or register to view this content. Registration is FREE

willcode4beer is offline
Reply With Quote
View Public Profile
 
Old 08-20-2008, 01:57 PM Re: General JDBC questions, and how to connect via PHP, ASP
Average Talker

Posts: 20
Trades: 0
@WillCode4Beer. hi again

Below I've added the final architectures for the following solutions:
  • TYPO3, PHP-Java Bridge OR ODBC-JDBC Bridge,, MySQL Database with Optional Cache Facility, J2EE / Java EE 5 Platform (JDK, JRE, JVM), JDBC Driver Type 4 and TCP/IP.
  • Images 1 and 2
  • TYPO3, PHP, MySQL Database with Optional Cache Facility, ODBC Driver, CA-CIS, CAICCI, VTAM and TCP/IP.
  • Image 3
  • IBM WebSphere Application Server (J2EE / Java EE 5 – JDK, JRE, JVM), JSP, JDBC Driver Type 4, Optional MySQL Database Cache Facility and TCP/IP.
  • Image 4
I just want to make sure that I have the Java, J2EE parts correct. For example, do the J2EE servers get installed on a Windows Environment as I have shown in Image 1 and Image 4, or is the application server its actual own server as shown in image 2?

Image 1







Image 2








Image 3








Image 4

Last edited by jpmad4it; 08-20-2008 at 01:59 PM..
jpmad4it is offline
Reply With Quote
View Public Profile
 
Old 01-30-2009, 03:14 AM Re: General JDBC questions, and how to connect via PHP, ASP
Average Talker

Posts: 20
Trades: 0
EDIT: I should make it clear that PHP is the main language to be used, there will be no ASP.

Instead of starting a new thread I thought I should continue here.

I got sidetracked off the technical part of this project with a lot of paperwork for a few months, but I have recently been looking into this again.

What was first said in this thread about hibernate and REST makes some sense now.

I have my webserver (linux) setup, along with Tomcat, Apache HTTP server, mod_proxy, PHP, Java, openEJB (EJB for tomcat) and MySQL.

I have been implementing this system for a while, and trying to get my head around all the technical parts.

For testing, I have setup a JNDI connection (using MySQL connector / J) to a MySQL database using JSP - which works fine. My problem now comes in trying to connect PHP to the MySQL DB via JNDI. This is where the PHP-Java Bridge originally came into things - it would allow PHP to access JNDI. However, like "willcodeforbeer" said, it may be better to use a different approach.

What I have been looking at is similar to the method which mentioned hibernate and REST. What I have learnt (I think) is that PHP can access EJBs within Tomcat using SOAP (via WSDL). So if I could create an EJB that contained the config for the connection to my database (JNDI), I could then call that using PHP and SOAP and use MySQL within PHP to carry out the queries.

I have been having trouble getting this to work though.

I have been talking to the technical guys who created openEJB, and we agreed that it would be best to try and access a simple EJB web service using PHP, and then move onto the database stuff later. They said that openEJB uses Apache CXF and so I dont need Apache SOAP installed - just the PHP SOAP extension or NuSOAP. They have given me a simple Calculator web service which is deployed into Tomcat as an EJB:


Code:
package org.superbiz.ws; import javax.ejb.Stateless; import javax.jws.WebService; @Stateless @WebService(portName = "CalculatorPort", serviceName = "CalculatorWebService", targetNamespace = "http://superbiz.org/wsdl") public class Calculator { public int sum(int add1, int add2) { return add1 + add2; } public int multiply(int mul1, int mul2) { return mul1 * mul2; } }
This is compiled into the Calculator.class and can be accessed from www.mysite.com:8080/Calculator.

The WSDL file can be accessed through:

www.mysite.com:8080/Calculator?wsdl

Now my question is: can I access this web service using php and WSDL? I have been reading up and I've seen that PHP can do apparently do this. So far, I have this code:

PHP Code:
<?php
$client 
= new SoapClient("http://www.mysite.com/Calculator?wsdl");
var_dump($client->__getTypes());
?>
The code gives this output:

array(4) { [0]=> string(41) "struct multiply { int arg0; int arg1; }" [1]=> string(40) "struct multiplyResponse { int return; }" [2]=> string(36) "struct sum { int arg0; int arg1; }" [3]=> string(35) "struct sumResponse { int return; }" }

I guess that this shows that I can call the web service as WSDL from PHP - doesn't it? So in theory I should be able to call a DB connection set up as a web service in Java?

Is this the most appropriate way to work towards getting a connection to the DB established? Or would people recommend the method mentioned which uses hibernate and REST, or anything else?

Any help would be fantastic.

regards
Jp

Last edited by jpmad4it; 01-30-2009 at 03:27 AM..
jpmad4it is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to General JDBC questions, and how to connect via PHP, ASP

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.00865 seconds with 12 queries