- This topic has 5 replies, 3 voices, and was last updated 14 years, 5 months ago by support-shalini.
-
AuthorPosts
-
RiadhMemberhi,
my question is about using the preconfigured connection ( with database browser )
in my java code , how i mention the connection and use the JDBC objects to interrogate my databaseplease give me an example with my eclipse IDE( i am novice in using Myeclipse IDE)
support-joyMemberriadhben,
I would recommend you go through MyEclipse tutorials and white papers here – http://www.myeclipseide.com/module-htmlpages-display-pid-7.html
Here is the link to MyEclipse Database tutorials – http://www.myeclipseide.com/documentation/quickstarts/dbtools/
RiadhMemberThank you for your answer,
before working with persistance ( hibernate or JPA), i like to test a simple Java application with JDBC ( with all steps) ,
the problem is how i can use an preconfigured object ( in this example the database connection) in Java code
for example when i create a connection class that declare the driver Manager and create a connection, statement ……..
i defined the connection with the database explorer with name”Oracle”, how i can mention the connection in code.the tutorial explain how to modify the structure of data base and querying it with SQL files , i like to know how i can interrogate the database with SQL code integrated in java
if you know a better practice to manage the connection with database , you can explain it.thank you for help.
support-shaliniMemberriadhben,
I would recommend you to go through the following links on how to use JDBC to connect and query database –
1. http://www.jdbc-tutorial.com/
2. http://www.kitebird.com/articles/jdbc.htmlHope that helps.
RiadhMemberthank you “shalini”,
i know all steps of connection with JDBC , but my question is about the utility of using database browser,
i declared my database with database browser (mention the JDBC driver, the name of database, number of the port…) ,after how i can use thes objects , it can be considered as a global variable?
for example , i declare a connection with name “oracle”in java code , i shoud declare a new connection object : Connection con = DriverManager.getconnection(“”);
or i use the connection declared with dtabasebrowser? how?
support-shaliniMemberriadhben,
The Driver details given in the DB browser cannot be used directly in the JAVA code. They help you to manipulate the database details directly from the IDE. At the same time, when configuring persistence details of projects using JPA/Hibernate, the connection and the tables can be used directly from the DB browser.
Please go through the following links –
1. DB tools – http://www.myeclipseide.com/documentation/quickstarts/db_overview/
2. Using DB browser for Hibernate Rev Engg – http://www.myeclipseide.com/documentation/quickstarts/hibernate/#5-4
Let me know if that helps. -
AuthorPosts