participate


Java EE SDK - Sun application server 8 and MySQL [Locked]
This topic is locked
<<   Back to Forum  |   Give us Feedback
This topic has 68 replies on 5 pages.    1 | 2 | 3 | 4 | 5 | Next »
Harold20
Posts:4
Registered: 9/30/04
Sun application server 8 and MySQL   
Oct 15, 2004 6:31 AM

 
Hello,

I'm new to J2EE. I'm trying to let a CMP entity bean use MySQL as database. I'm suprised about the amount of information which can be found. Using google and this forum I'm almost certain nobody uses MySQL and Sun application server 8.

Could somebody please help me getting this to work. I'm searching for a step by step instruction based on application server 8. So coding, configuring the .ear and configuring the application server.

Any information is much apreciated.
 
lancea
Posts:812
Registered: 8/18/97
Re: Sun application server 8 and MySQL   
Oct 15, 2004 8:12 AM (reply 1 of 68)  (In reply to original post )

 
http://docs.sun.com/source/817-6087/dgjdbc.html will give you the config instructions.

hth
 
sbucareer
Posts:53
Registered: 3/8/04
Re: Sun application server 8 and MySQL   
Oct 15, 2004 8:42 AM (reply 2 of 68)  (In reply to original post )

 
I am having the same problem as well. I am using MS SQL and Oracle server for database but they are both the same. Now, by the way mine is not working yet as I have posted many question with no response. But this will help you in understanding configuration settings around j2ee with databases. If you are using j2ee 1.4, which is what I am using then following this steps. At least if you are up to this steps you will be confident and maybe solve the problem your self and post results back for others to follow.

I will use the GUI. I am familliar with GUI's

Steps
==============
1. Run your Admin Console ----> supply user and password to login
2. In the admin Console, Notice the JDBC expandable link at the left. In fact it is the second link at the navigatioal panel on your left explorer. click on it
3. It will open a new view on the right hand side namely. JDBC Resource and Connection Pools
4. Click on connection pool. Select "New" under Current Pool( some numner)
5. Name enter any name to identify this connection pool. Select Resource Type. I normally use javax.sql.DataSource. Database Vendor see mysql and select it or select your vendor or leave blank if your vendor do not appear. click net
6. Data Source Class Name: enter your class name i.e. for MS access I will enter sun.jdbc.odbc.JdbcOdbcDriver. Find your database driver name and enter here. click next
7. Scroll down to add Properties. I do not understand here myself. But what I do is to look at the working configured ones in the left panel i.e. pestorepool. Edit it and look at the Add Property to get idea
8. Save

9.Go to JDBC Resource at the top of left navigational explorer and click JDBC Resources.
10. Click new.
11. Enter the JNDI Name you will use to identify the connection pool in your application i.e ejb/customer or anything you want . Select the Pool Name you just configured from the list and click save.

12. Go back to Connection Pools navaigational link and select your database you configured.
13. Click ping. If you get errors that means it is not yet working. Post your errors and hope some to help.

This is the stage I have gotten to and no one seem to have a solution yet. Please can someone help us

Thanks

NB
========
Put your drivers jar in %J2EE_HOME%\domains\domain1\lib\ext
Or
Add the directory to you class %CLASS_PATH%

To find your driver i.e search your vendor website or use goole.com to search your vendor

Example I am looking for oracle driver I will search google like this http://www.google.com/search?q=oracele+10g+driver
 
lancea
Posts:812
Registered: 8/18/97
Re: Sun application server 8 and MySQL   
Oct 15, 2004 11:09 AM (reply 3 of 68)  (In reply to #2 )

 
You have to specify either an XADataSource or DataSource

As far as properties, they are the name of the setters on the DataSource

For example if you set the properties

user, password, databasename


The methods setUser(), setPassword(), setDataBasename() will be invoked passing the values you specified for the properties.

Also not we have not tested MS Access.

hth
 
sbucareer
Posts:53
Registered: 3/8/04
Re: Sun application server 8 and MySQL   
Oct 15, 2004 11:19 AM (reply 4 of 68)  (In reply to #3 )

 
Can someone configure access database with j2ee. I have but it give me this error when I try to ping


An error has occurred.
Operation 'pingConnectionPool' failed in 'resources' Config Mbean.

Data Source Class Name : sun.jdbc.odbc.JdbcOdbcDriver
Resource Type: javax.sql.DataSource
 
lancea
Posts:812
Registered: 8/18/97
Re: Sun application server 8 and MySQL   
Oct 15, 2004 11:41 AM (reply 5 of 68)  (In reply to #4 )

 
You need to specify an DataSource and you are not specifying a DataSource. Please check the docs for the odbcjdbc driver and see the name of the DataSource
 
sbucareer
Posts:53
Registered: 3/8/04
Re: Sun application server 8 and MySQL   
Oct 15, 2004 11:53 AM (reply 6 of 68)  (In reply to #5 )

 
Which doc?
 
lancea
Posts:812
Registered: 8/18/97
Re: Sun application server 8 and MySQL   
Oct 15, 2004 12:30 PM (reply 7 of 68)  (In reply to #6 )

 
You need to look at the documentation for the jdbcodbc bridge to findout the name of the DataSource
 
sbucareer
Posts:53
Registered: 3/8/04
Re: Sun application server 8 and MySQL   
Oct 16, 2004 3:05 AM (reply 8 of 68)  (In reply to #7 )

 
lincea could you tell me the DataSource name for jdbcodbc bridge?

5 points have been allocated to this answer. Infact if anyone can help we connection my my access database with j2ee 1.4 on sun application server 8.0 10 points will be awarded.

I have searched to no avail and it is stopping me progressing with ejb tutorials I am learning. I have installed MS SQL 2000 server as well could not get it to work, also I have installed oracle 10g but could not get it to work. I am sticking with MS access for simplicity.

I have created a table called custerRecord and want to access this turples within a web clinet.

I use admin tool to configure the JDBC when I ping the it I get this errors

An error has occurred.
Operation 'pingConnectionPool' failed in 'resources' Config Mbean.

Any help?

Thanks
 
Harold20
Posts:4
Registered: 9/30/04
Re: Sun application server 8 and MySQL   
Oct 17, 2004 8:31 AM (reply 9 of 68)  (In reply to original post )

 
How did this topic get converted from a mysql db to a ms acces db? Anyhow, I got a little bit futher (thanx to sbucareer ). And informatie from mysql (http://dev.mysql.com/doc/connector/j/en/index.html).

First of, download connectorJ en I suppose you can put de connectorJ-verXXX-.jar in the %J2EE_HOME%\domains\domain1\lib\ext dir. I've made a dir c:\connectorJ\ and put the connectorJ-verXXX.jar in my Application servers classpath using the admin console (Application server -> jvm settings -> path settings in Classpath Suffix:).

Second, I created a connection pool also using the admin console, JDBC > Connection Pools.
1) press new
2) in wizard step 1 :
- name: MySQLPOOL
- Resource Type: javax.sql.ConnectionPoolDataSource
- Database Vendor: mysql

3) in wizard step 2:
- Data Source Class Name: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource

4) in wizard step 3:
I've changed nothing exept for the properties.
Add these properties:
- port: (default is 3306)
- serverName (just www.idontknow.com or localhost or 127.0.0.1)
- user (an existing user allowed to connect to your mysql db)
- password (the users password)
- databaseName (the name of the databas you want to connect to)

After setting everything right, i'm able to ping te database succesfully.
See the mysql connectorrJ documentation (see above) to get de specs for a XADatasource or a Datasource.

After this i guess you have to specify a "JDBC Resource" but i didn't do this jet, don't understand why to do this eather.

Questions:
- I'm i correct when i say you have to create a connection pool for every database u want to connect to? Since you have to specify the database in a property field, i'm guessing you cant make a generic connection pool.
- what is the function of the JDBC Resource?
 
lancea
Posts:812
Registered: 8/18/97
Re: Sun application server 8 and MySQL   
Oct 18, 2004 12:21 PM (reply 10 of 68)  (In reply to #9 )

 
Yes, you must create a connection pool and this is where you specify the driver and properties which will be invoked as setters on the DataSource.

The properties that you have to set for a DataSource are unique to each DataSource that you utilize in your connection pool. There are a subset of setters that all DataSources must support and then each vendor provides their own additional setters.

You then mpp the Connection pool to your JDBC Resource which is used by your programs to access your backend database.
 
jaimedp
Posts:1
Registered: 10/19/04
Re: Sun application server 8 and MySQL   
Oct 19, 2004 5:22 PM (reply 11 of 68)  (In reply to #9 )

 
Great!!!

That worked for me. You are great!!

-jaime
 
Suresh_Balachandran
Posts:2
Registered: 9/24/03
Re: Sun application server 8 and MySQL   
Oct 21, 2004 3:12 AM (reply 12 of 68)  (In reply to #11 )

 
hi ,
can any one tell me how to run an CMP configured for MS Access.
 
sbucareer
Posts:53
Registered: 3/8/04
Re: Sun application server 8 and MySQL   
Oct 21, 2004 2:38 PM (reply 13 of 68)  (In reply to #12 )

 
Suresh_Balachandran I don't think anyone knows the answer in this forum. I have been asking the same question for the past two weeks with no concrete answer. All I get is referencies and doc links. How we need if someone know how is tell us in plain englsih HOW TO CONFIGURE MS ACCESS using either JNDI or JDBC IN application server admin console i.e . Tell us what value to put in the parameters for example

Data source class name: com.pointbase.xa.xaDataSource

NOT

Data source class name: the driver.

We don't know the driver that is why we are asking you kind people to help.

Thanks
 
ievans
Posts:329
Registered: 6/20/03
Re: Sun application server 8 and MySQL   
Oct 22, 2004 10:49 AM (reply 14 of 68)  (In reply to #13 )

 
Sun doesn't provide a JDBC driver for MS Access. You can either use the JDBC-ODBC bridge, or a third-party JDBC driver. Because there isn't a single method of connecting to MS Access, we can't give step-by-step instructions for doing this.

The JDBC-ODBC bridge is included with J2SE. See this article for hints on how to set this up:
http://www.javaworld.com/javaworld/javaqa/2000-09/03-qa-0922-access.html

JNDI is not used to connect to data sources. When you set up a JDBC resource, you specify a JNDI name for that resource, and that JNDI name can then be used by other applications.

The Application Server documentation has detailed instructions on setting up JDBC resources and JNDI names.

I don't know how well CMP will work with MS Access, as Access is not a true RDBMS. I suspect you will find it easier to just use another RDBMS rather than try to get your application to work properly with MS Access. Using MS Access with CMP enterprise beans is like putting a moped engine in a Mercedes-Benz.
 
This topic has 68 replies on 5 pages.    1 | 2 | 3 | 4 | 5 | Next »
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 28
  • Guests : 133

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums