How to create MySQL DataSource in WebLogic Server

One cool thing about using an application server is that it allows you to create DataSource outside of your application and it can manage it along with thread pool and transaction manager etc. With WebLogic Server, it comes with quite a few built in JDBC drivers such as Oracle Database and MySQL etc ready for your use. Here I will show you how to create a MySQL DataSource.
 
 
 
 
 
 

  1. Login into http://localhost:7001/console
  2. On the left menu click Services > Data Sources
  3. On the right, click “New” button
  4. Enter Name: mysql_ds ; You may optionally give it an JNDI Name: jdbc/mysql_ds; And then select Database Type: MySQL
  5. Click “Next” button and then accept default with another two “Next” buttons.
  6. Now enter Database Name: test; Host Name: localhost; Database User Name: root; and then the password.
  7. Click “Next” and you may optionally test your connection here.
  8. Click “Next” and you MUST select an sever as target!
  9. Click “Finish”

Now you have a DataSource ready to be used by your application on this server. You may access this by either JNDI lookup, or JPA configuration with entity manager injection.

TIPS: If you do not pick a server Target in step 8, then your applicatoin will NOT able to access this Data Source! So ensure you have done this step as it’s the easy step to miss.
 

Related Whitepaper:

Functional Programming in Java: Harnessing the Power of Java 8 Lambda Expressions

Get ready to program in a whole new way!

Functional Programming in Java will help you quickly get on top of the new, essential Java 8 language features and the functional style that will change and improve your code. This short, targeted book will help you make the paradigm shift from the old imperative way to a less error-prone, more elegant, and concise coding style that’s also a breeze to parallelize. You’ll explore the syntax and semantics of lambda expressions, method and constructor references, and functional interfaces. You’ll design and write applications better using the new standards in Java 8 and the JDK.

Get it Now!  

Leave a Reply


+ seven = 14



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.

Sign up for our Newsletter

20,709 insiders are already enjoying weekly updates and complimentary whitepapers! Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

As an extra bonus, by joining you will get our brand new e-books, published by Java Code Geeks and their JCG partners for your reading pleasure! Enter your info and stay on top of things,

  • Fresh trends
  • Cases and examples
  • Research and insights
  • Two complimentary e-books