can you please give the steps how to make simple program of jdbc on mac .
I have eclipse on my mac .so I need steps what to do next so that can able to make program of jdbc ?
I do lot of RND but they provide for windows.But I also download Mysql from this link
http://dev.mysql.com/downloads/file.php?id=450342
and download workbench from this link
http://dev.mysql.com/downloads/file.php?id=412161
Then can you please may I right ?
or what next I have to do to make jdbc program ?
Install and start MySql.
Download the MySql JDBC driver. Try here: http://dev.mysql.com/downloads/connector/j/. Extract all the files and add the jar to your eclipse project.
Now you can start coding. Look up the docs for DriverManager, Statement and ResultSet.
There is not much difference at all in using a Mac than other platforms for working with JDBC.
JDK
You need an implementation of Java, a "JDK". See my answer to another question about installing Java 7 and Java 8 on a Mac, including links for downloading a JDK. Before doing the database stuff, be sure this works in the Terminal.app program: java -version
JDBC Driver
You need a JDBC driver specific to your particular database engine.
H2 Database
I suggest trying the H2 database rather than MySQL, only because it may be a gentler easier way to get started. H2 is pure Java, rather simple in terms of installing and administrating, and free-of-cost. H2 comes with its own JDBC driver. The H2 web site has a quick-start page and a tutorial page. It is not written explicitly for Mac OS X, but you should be able to "translate" as needed.
Oracle Tutorial
Then follow the JDBC tutorial provided by Oracle.
Also: StackOverflow is for specific questions on programming, not general or wide-ranging discussion.
Related
I am working on an app in NetBeans for a class and need the GUI to be able to communicate to a database that I created in Microsoft SQL Server Management Studio. The GUI need to be able to take user information and import it to the database. It also needs to be able to retrieve information from the database for review and editing purposes. I have never used the database before, but was able to teach myself the basics. I am having trouble finding out how to connect the GUI to my database though. Is there an easy way to connect the two? I don't mind learning myself, in fact that would be preferable, but any links or suggestions would be very much appreciated.
There is a tutorial here for connecting to a MySQL database:
https://netbeans.org/kb/docs/ide/mysql.html
Almost everything will be the same with Microsoft, except you will need a different JDBC driver. You might want to practice with MySQL first since it is free. The MySQL driver comes with Netbeans but the Microsoft Driver will need to be downloaded separately. I believe you can get at the following, but I haven't tried it.
https://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx
You add drivers to Netbeans by going to the Services Tab, Right-click on Databases -> New Connection and click the Add button in the dialog.
You will also need to add the driver to each projects libraries.
The general JDBC tutorial is here:
https://docs.oracle.com/javase/tutorial/jdbc/
which covers the common interface between databases.
It is not necessary but it can be useful and or easier to do beans binding between Gui and database.
See this tutorial:
https://netbeans.org/kb/docs/java/gui-binding.html
I am creating a piece of software using Java and Eclipse. The software is to be freestanding and not require an internet connection.
The main use of the program requires access to database. I am used to developing for Android where there is an inbuilt MySQL database in every device. Is there a similar thing with Java. I have looked everywhere and have seen references to this kind of thing but have not seen any clear answers. I know there is JDBC, but this seems to be a method of controlling the database rather than creating it.
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
The version of Java I am using is java.runtime.version=1.7.0_40-b43
and I am using Eclipse Kepler Service Release 2
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
First, Android includes SQLite (not mysql). Second, No. No there is not. You could use Derby or SQLite or H2 (or any other pure Java database). As pure Java databases they don't require external installation (but they can be installed externally) and can be run directly in Eclipse.
Would SQLite work for your purposes?
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
It's not pre-installed, but seems like it might be a good fit otherwise:
http://wiki.eclipse.org/Connecting_to_SQLite
In the IT class room I constantly hear chat about the derby database not being built for netbeans. I write code in java and becuase I am learning to implement databases and I have the oppurtunity to be taught sql code. My question is, is the derby database not meant for netbeans and if not why why? So far it works fine for me. Our education system is a bit out of order so I like to be well informed about things.(You don't have to worry about making sense about the last statement).I use the database for recording details in shop and company scenarios so far. So answer could relate to this.
The Java DB(Derby) database is Oracle's supported distribution of Apache Derby. Java DB(Derby) is a fully transactional, secure, standards-based database server, written entirely in Java, and fully supports SQL, JDBC API, and Java EE technology. The Java DB database is packaged with the GlassFish application server, and is included in JDK 8(except Mac OS X) as well.
There is a whole official NetBeans IDE Tutorial about Working with the Java DB(Derby) Database. Whoever has suggested you those incorrect details,he might not have got to work with Derby Database OR might be a fan of Oracle/MySQL,etc. databases! But,I and all the commentators post suggest you to move frankly with Derby database as there is no such problem!
Also,I am leaving you the official tutorial's link---> Official NetBeans IDE Tutorial on Java DB(Derby) Database
I'm trying to figure out how to use MySQL with Java EE 6. I'd like to work with it locally on my machine so I can get some experience. Is it possible to do this? I've seen this MySQL Connector and I expected it to be like a class or something, but it's a lot more than that and I'm not sure about how to implement it. Can anyone offer any advice on where to get started? I did find one article that wasn't as detailed as I'd hoped, but it was from 2004 anyways, so it's no longer relevant.
The JDBC Database Access trail in the official Java documentation describes how you access databases from Java. The JDBC Basics Getting Started page says that the tutorial has been tested with MySQL.
You will need to install the MySQL JDBC driver (I presume that's what you've linked to above) and have it on your classpath in order for the database connection to work. But other than having it on your classpath, you shouldn't need to interact with any MySQL-specific classes from your code.
So basically you are using EasyPHP to stand up a MySQL instance on Windows? Seems like a little bit of overkill but in any case here is what you can do:
Download and install Jboss 7 (Full profile).
Run JBoss (/bin/standalone.bat>
Download MySQL connector for Java
Unzip, then copy the MySQL connector Jar to /standalone/deployments
Login to JBoss admin console (http://localhost:8080)
Browse to Connector/Datasources and define a new datasource pointing to your MySQL DB
Thats it for setting up a server environment. Now you can do all your JEE6 goodness in your favorite IDE and deploy the code to your Jboss server. Or you can skip all that and use the baked in goodies in NetBeans. A good tutorial can be followed here.
I am new to JDBC. I would like to know what I should install in my machine before starting off with JDBC. It would be most appreciated if you can also give me links to find them.
read the tutorial first.
http://download.oracle.com/javase/tutorial/jdbc/index.html
Besides a working database, all you need is the JDK and the database-specific JDBC driver. You'll need to find and download the driver for the database you're going to use.
If you want to learn JDBC and don't care about a specific database, I can recommend HSQLDB, which is a lightweight DB that you can run on your machine or even from your process.
And I agree with qrtt1's advice - the best place to start is Sun/Oracle's JDBC tutorial.
Read "Before you Begin" in this JDBC Tutorial; for use with any JDBC Database, including Oracle, PostgreSQL, MySQL, etc.
Pretty much all you need is:
JDK 1.6 or greater installed and ready to go.
A text editor.
A JDBC Database Driver contained in products such as MySQL or PostgreSQL