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.
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
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
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.
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?
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.
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.
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 »