Access an Oracle database with NetBeans 5.5 beta2

I just discovered that NetBeans can allows a user to access databases to view, edit, and execute commands. It looks pretty cool for an IDE. If you prefer to use command line, use sqlplus or command line tool for the database. If you use Windows operating system and Oracle database, TOAD could be another option. If you are using NetBeans and prefer to stay within the IDE, you can use its database features.

To get started, here are my notes on connecting to an existing Oracle database:

1. Click on Runtime tab on the panel on the upper left side.

2. Expand Databases node

3. Right click on Drivers and choose New Driver

4. Click Add

5. Choose file from your local file system and click Open
6. Click Ok to accept the default config

7. Right click on database and choose New Connection

8. Seect Oracle driver

9. Change <HOST> with proper host name. Change <PORT> with proper port number. And change <SID> with the proper SID value.

10. Enter a user name and password for the database.

11. Click OK

12. You should see an extra node that shows the connection you established. Expand the code and browse around. Right click on a node and see what tasks you can do.

This little discovery certainly was a pleasant surprise.

126 thoughts on “Access an Oracle database with NetBeans 5.5 beta2

  1. hello what should i have selected class 12 from here but
    unable to connect what should i put under host name and port number so that it get connected

  2. The host name and port number should be for your database server. If you installed Oracle on localhost, you can just specify the correct host name for localhost (or just “localhost”) and the port that the database server is listening.

  3. I have generally found that columns of type Oracle type Date always appear as a Date rather than a timestamp. Therefore the time part if always missing, which is a problem if a table has a column of times!

    Do you find the same thing? Or are you seeing times as well?

  4. I am assuming you are referring to java.sql.Date. It is a child of java.util.Date and inherits methods existis in the parent. Depending on what you need to do with the data, you can try to call getTime() or use java.text.SimpleDateFormat to extract full timestamp information.

  5. No. What I was referring to was what happens in the NetBeans database explorer. This is a user interface and not a programmatic one. You enter a SQL query and then you see in the explorer a table of results. These results do not in my experience show times, only dates.

    I was wondering if you saw the same thing in the database explorer?

  6. hi,
    ur netbeans info on “Access to oracle db using nb5.5beta” was very helpful. I establishd a succesful connction to oracle db and were able to modify what i wanted to. Here is my doubt: I wanted to populate my jList with data from a column in oracle Table named “task1”. What is the procedure for connecting oracle table to my Javaprogram?? thanks in advance!!

  7. I don’t speak Portuguese. So, I had to use an online translator for the last part of the error message. If I understood correctly, it means resource not supported. Are you using matching driver and database version? Are you trying to connect to a very new/old version of Oracle or even a different database? Did you tried to restart the IDE and try to connect again?

  8. I really need to know how I can connect to an Oracle database using Netbeans 5.5 as well as how to configure the necessary drivers

  9. I’m using NetBeans 5.5 against Oracle through jdbc drivers classes12 and ojdbc14 (Oracle’s newest version for jdk 1.4). The single problem that I haven’t been able to solve in the Database Explorer is accessing Procedures. Access to Tables and Views seem to work fine. All attempts to expand the Procedures folder result in consumption of the cpu for about 10 minutes with no other visible results. This has been the case no matter what level of authorization I use for the connection, even schema owner as sysdba.

  10. hi,
    i am having a problem to access the tables (that i made on oracle) through netbeans. how can i view/ show the table using netbeans…

  11. Hi Charmie, Can you be a little more specific and share additional details about the issue you observed. Did you refresh your view into oracle in netbeans? Did you check if the tables actually get created in oracle by using oracle’s own management tools such as sqlplus?

  12. hi master
    sir i am use netbeans 6

    sir how i connect my jsp project with oracle 10g and mysql

    please give me step of configration

    and whic jar or zip file i use and where the jar and zip file i search

    please give me full idea



  13. how do i connect a GUI netbeans application to an oracle database??..please help me on this as soon as possible..your assistance will be highly appreciated

  14. somebody obtained to establish a connection with a database oracle, using netbeans 5.5?
    all time that I try to expand the item “tables” is presented me the error message: Unable you refresh children, connections is broken.
    Already I followed the all “how-to” I found and I did not have success;

  15. fahim,
    That’s worth another blog entry on it’s own. If I ever get a chance to do that, I’ll be happy to share.

    Does restart Netbeans help?

  16. Hello,
    i am trying to access Oracle database through Netbeans IDE 5.5. I followed the steps provided on this webpage to do so, but I am getting the following error:

    Unable to add connection,cannot establish a connection to jdbc:oracle:thin:@localhost:5560:orcl using oracle.jdbc.driver.OracleDriver (Io exception: Bad packet type)

    Can u plzz help me with this…

  17. I followed the above steps to connect to oracle database 10g with netbeans 5.5 .I am unable to connect .Also plz tell me what is SID number.Please guide me on this

  18. SID = System Identifier. SID is essentially the name of the Oracle instance you are running. This information is specific to your environment and only you or your Oracle DBA can specify this value.

  19. dear Dave,
    not even restarting the machine, I obtained success in to expand the item “tables”
    i’m using NetBeans IDE 5.5 ( 200612070100 )
    Windows XP versão 5.1 in X86
    Java 1.6.0_01

    p.s. after to connect, is possible to execute a command SQL without problems


  20. Hi Castro,

    Great to know that you have successfully opened table item. Please do try execute SQL command. I’ve done simple select statements within NetBeans. So, I would expect that shouldn’t cause problems. Then again, considering how many people expressed difficulties o this blog, I am not certain if you will not experience any more issues. So, save often and share your experiences.



  21. hi, i am using netbeans 5.5 against oracle 10g.
    my problem is that i am not able to create connection. an any one help me.

  22. I have an interesting problem. I am long time NB user and understand most of the Connection issues.
    I am trying to view Table details (schema) and getting “unable to explore……..:not enough privileges error”.

    But on SQLPlus prompt, I can use the same user and schema and still can do desc .

    What privileges NB needs to view table schema?

  23. Hi Mandar,

    You certainly has an interesting problem. I do not know the internals of NetBeans to explain what privileges it needs. Perhaps you can try one of the NetBeans’ mailing lists.

    Before you write your question, you might want to try latest release of NetBeans if you didn’t already done so and make sure you have the matching driver version for your database.

    Hope this helps

  24. Hi,

    Good article. I was successful using the driver to connect to the Oracle database and see the node.

    My problem is when I click on a folder under that connection node to see the contents. If I click on Tables for example, I get
    and hourglass with the message “Please wait…”.

    Even after a long time, I don’t see anything else happening.
    The hourglass stays there and I’m not able to see the tables
    in that db schema.



  25. Hi Rudi,

    Sounds like NetBeans is waiting to get connected. You might want to check the following:
    1. Your connection configuration, such as user name, password, hostname, etc.
    2. Is the server running? Is the listener running? Can your machine connect to the server directly?
    3. Did you use the right JDBC driver?
    4. Was there any network traffic between NetBeans and the server when you attempted to connect? (For Solaris/Linux, I use snoop/tcpdump)

    Hope this helps

  26. Hi Dave,

    Thank you for your reply and suggestions. Yes, the database server and listeners are running and I can connect from sqlplus and Toad.

    Actually I found the problem. It has to do with point 3 on your suggestions. The driver for Oracle 8.1.7 called driver supports up to jdk 1.3, but I’m using jdk 1.6.

    I downloaded the latest Oracle jdbc driver for 10.2.0. The file is called ojdbc14.jar. It works fine now, it connected and allowed me to see the tables and objects.

    Now I’m trying to figure out if file produced in NetBeans can run with IIS instead of Tomcat of if something needs to be installed in IIS for the files to work. Any helps is appreciated.



  27. Assuming you are using Java (although NetBeans also support c/c++ and Ruby), I don’t know if IIS supports Java EE web applications or not. I assume no. You can’t run Tomcat or glassfish or one of the Java EE containers on the Server?

  28. i success fully configure database in my NetBeans , i would like to know how to use that connection in my servlet or javabean , how can use that datasource in my code

  29. I used NetBean’s wizard to create new Entity class from Database, which will trigger creation of Persistence Unit that will utilize the database configuration you just created. This should lead to automatic creation of Java objects that maps to your database.

  30. i configured oracle database in NetBeans tool , pls help me to write to code to get Connection obj

  31. Hi,
    I use NetBeans 5.5, Oracle 9. The connection with db ok, but i can only see views, functions but not the tables. If I try to see the tables I get “unable to refresh children connection is broken”.
    Can you help me?

  32. Hi Natalie,

    Here are a few follow-up questions. Hope they are helpful.
    Have you tried NetBeans 5.5.1?
    Did you use the driver that came with Oracle 9 installation/distribution?
    Does the user has permission to view the table when you login using a different tool such as sqlplus?

    To get better idea about the issue you are facing, you might want to check out /.netbeans/5.5/var/log/messages.log and see if there is anything interesting right at the point or before your connection error.

  33. Hi Dave,

    Here are my answers.
    I use NetBeans 5.5.1.
    I use the newest ojdbc14.jar (Oracle Database 10g Release 2 (
    I have Connection to db, can execute all statements.
    The only problem I can not see the tables in runtime.

    My problem is, I try to create Persistence -> Entety Class from Database and have no tables in the list. So it is not possible.

    Here is the log:
    INFORMATIONAL *********** Exception occurred ************ at 12:12 PM on Aug 14, 2007
    org.netbeans.api.db.explorer.DatabaseException: Nicht unterstützte Funktion
    at org.netbeans.modules.db.explorer.infos.TableListNodeInfo.initChildren(
    at org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo.getChildren(
    [catch] at org.netbeans.modules.db.explorer.DatabaseNodeChildren$
    at org.openide.util.RequestProcessor$
    at org.openide.util.RequestProcessor$
    Caused by: java.sql.SQLException: Nicht unterstützte Funktion
    at oracle.jdbc.dbaccess.DBError.throwSqlException(
    at oracle.jdbc.dbaccess.DBError.throwSqlException(
    at oracle.jdbc.dbaccess.DBError.throwSqlException(
    at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(
    at oracle.jdbc.OracleDatabaseMetaData.getDatabaseMajorVersion(
    at org.netbeans.lib.ddl.adaptors.DefaultAdaptor.getDatabaseMajorVersion(
    at org.netbeans.modules.db.explorer.infos.TableListNodeInfo.initChildren(

  34. Hi Natalie,

    Thanks for sharing further details about the error you observed. Looks like this is a known issue. See here, and here.

    Maybe Michael Oatley’s solution from the second link might give you an inspiration. If that still doesn’t work for you, maybe you can email Jim Davidson, he appears to be very active on nbusers alias and he responded to this exact question earlier. His email is on the first link above. If he doesn’t respond to you in a reasonable time, try

    Hope this helps! And if you make any progress, please let me know. Thanks.

  35. En Oracle 10, en lugar del, es el ojdbc14.jar, que se encuentra en:


  36. hi i m sumati .name of mi data base is election.i want to modify the content of mi data base file i.e Election-details through jsp file .cn u help me by sending coding for the jsp file .i m working on struts and mi IDE is my ecllipse

  37. Hi sumati,

    There are tutorials on JPA/Hibernate or other persistence frameworks that will do what you want. If you really want, you can also use JDBC. Here is a tutorial that might match what you are asking for.

    Hope this helps.

  38. Brilliant, didn’t know i could do this and saved me installing other stuff to try and connect.

    Set up:
    Netbeans 5.5 on Windows XP
    Oracle 10g XE ( on Ubuntu 7.04 Feisty Fawn

    I think that Oracle version is right.

    I did however have some problems with the drives on the Oracle site so i navigated to my install and found a /jdbc folder hidden away with the driver i needed. I copied the driver from my Linux box to my Windows box, added the .jar to the libraries and walla.

    Thanks Dave 😀

  39. Please help me how to connect database with netbeans
    Databaseis oracle
    i tried but always an IO error occurs and also error like
    oracle.jdbc driver does not exist;

  40. hi,
    i am getting an error when i am using netbeans5.5 with oracle8i version. The error is [microsoft][odbc oracle driver]driver not capable. please let me know whats this error.
    thanks in advance

  41. Hello,

    To Srinivas and dave. sine you have successfuly installed newer driver and hooked up from your NetBeans to Oracle DBs, could you please summarize detail steps or procedures, let’s know where can I download these newer driver from? (I am using 9i Database)? How to setup connection on NetBeans? Do I need to install both class12 and class14 or other stuff?



  42. Hi

    Great Article. I am trying to connect through netbeans as a different user than the table owner. The user that I am using has select , insert, update and delete against the tables in the owner schema. Netbeans gives me a permissions error. It seems like it requires to be able to have permissions against the Oracle metadata. I granted SELECT_CATALOG_ROLE but this did not work. When I grant the DBA role it works fine, but I cannot leave this grant in place for obvious reasons. Do you know what specific grants that are required? Any help is appreciated

  43. Hi Tyler,

    When looking around a bit, I found the following statement:
    “Otherwise, when prompted, type the password. The user must have global create user privileges or the insert privilege for the mysql database, such as the root user.”

    So, I would expect Netbeans most likely also need the same pivilege from Oracle. Hope this helps.

  44. hi,
    i am trying to access Oracle 10g Express Edition through Netbeans IDE 6.0 followed the steps provided on this webpage to do so, but I am getting the following error:

    Unable to add connection,cannot establish a connection to jdbc:oracle:thin:@localhost:5560:orcl using oracle.jdbc.driver.OracleDriver (Io exception: Got minus one from a read call)

    Can u plzz help me with this…

  45. i have Oracle 10g and Netbeans IDE 6.0 followed the steps provided on this webpage to do so, but I am getting the following error:

    Unable to add connection,cannot establish a connection to jdbc:oracle:thin:@localhost:8081:27 using oracle.jdbc.driver.OracleDriver (Io exception: Got minus one fron a read call)

    Can u plzz help me with this…

  46. Hi Pallavi and Neha,

    I don’t have anything to add beyond what I shared in the blog entry. If you were able to resolve the issue, please feel free to share your note. Thanks,

  47. Hi Dave, I came across your blog when i am looking for some information on how to connect to a oracle db using net beans. As you said , do we need to have the Oracle or oracle client to connect to a remote oracle db as i dont find in my system. I have JDK1.6 and Netbeans6.0.. appreciate your help in this regard


  48. Hi Nimmi,

    If you have access to the database server, you should be able to find the file there. If not, check with your DBA to find the file for you. You probably can find the file if you have Oracle client installed. I have not tried that option before.

  49. Unable to add Connection ,Cannot establish aconnection to jdbc:oracle:thin:@localhost:2030:DB using Oracle.jdbc.driver.OracleDriver(IOEXPECTION :THE NETWORK ADAPTER ERRAOR COULD NOT ESTABLISH THE CONNECTION:


  50. Hi Rajmohan,

    Did you start Oracle database? Is the listener running? Is the listener running on port 2030? Is “DB” the value of your database’s SID?

    By the way, you might want to use the latest version of NetBeans.

    Hope this helps.

  51. problems with connecting to Oracle DB in NetBeans
    Hi, guys,
    I have a problem when trying to connect to Oracle DB in NetBeans. I’ve downloaded the Oracle Jar files like ocrs12.jar, ojdbc14.jar, ojdbc14dms.jar, orai18n.jar, and also I have built a new driver where I’ve added those four Jar files.
    The problem is when I try to use this Oracle driver with the URL ‘jdbc: oracle:thin:@//localhost:1527/sample’, I always get a error message saying ‘unable to get a connection,cannot establish a connection to jdbc: oracle:thin:@//localhost:1527/sample using oracle.jdbc.driver.OracleDriver(Io exception:The Network Adapter cannot establish the connection)’!!
    Can anyone tell me what the problem is? Did I miss some Jar files or was the URL pattern incorrect? Please help, it’s urgent!!!!!!!!! Many many thanks

  52. Hi rajmohan,

    Looks like there is a space between “jdbc:” and “oracle”. Please make sure it doesn’t exist in your environment. “//localhost” also doesn’t look right to me. I would try “localhost” or “”. You should also try to change “1527/sample” to “1527:sample”. Hope this helps.

  53. how to connect the database in netbeans 5.5 for establishing connections betwen servlets and HTML wherein the backend is MS-access

  54. SIr ,
    i having a problem, i want to create a table using User Interface (GUI) supported by netbeans where data should come from service window provided by netbeans, by making use of table properties of Jtable(ie binding data from database which is already coonected using jdbc-odbc connection and appears on service window.)

  55. i not able to bind data into table ,which is already
    connected to databse using odbc connection and also appears on service window . i have solution to do so by manually creating (by coding),but interested in doing using jtable GUI properties.

  56. what is this exception means? and how to correct it.
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver


  57. Hi icc4nkk,

    Looks like you didn’t load the JDBC driver. Makes sure you do copy the library file into the right lib directory, add a reference in the server’s classpath before restart the server. Hope this helps.

  58. Hi……I am facing problem in connecting my oracle database table with net beans.. i just could not make the connection in netbeans… I am facing problem in defining the path or location of my database tables in oracle… plz anyone can help me in this regard…or give me tutorial which can show connectivity between oracle database tables and netbeans GUI..I hope you people will help me out…As I am new to boht database and java programming

  59. Hi!
    I’m using NetBeans 6.5 and I’m having some troubles to connect.
    The steps I’ve made:
    – Create the connection pool in Glassfish, nothing special, just standard parameters (Based on javax.sql.DataSource and including URL, Username and Password).
    – Create the JDBC resource associated with that connection pool,let’s say jdbc/test.

    Now in NetBeans I register the driver:
    – New driver -> Find the ojdbc14.jar and from the options that I can choose it shows: oracle.jdbc.OracleDriver and oracle.jdbc.driver.OracleDriver.
    If i choose without .driver I got the thin drivers (the ones i want) and if i chosse the one with the other one I got the OCI drivers. So I choose the first option oracle.jdbc.OracleDriver
    – Then I go to my project and click New -> Entity Classes from Database and from Datasource I select jdbc/test and it shows the following error message:

    Unable to find the driver oracle.jdbc.driver.OracleDriver. Please register this driver in the Databases.

    I can fix it if while registering the ojdbc14.jar I select the second option (oracle.jdbc.driver.OracleDriver) but with this option I need to specity the connection to use OCI instead of the desired thin driver.

    I hope you’ll understand and help me somehow

  60. Hi, i’m trying to connect to remote database 9i and 10g through Netbeans 6.1 Database Application. Everything works fine with my local XE Database (driver url: jdbc:oracle:thin:@localhost:1521:XE, Oracle driver ojdbc6.jar), but when I switch to the Oracle 9i or to the 10g on a remote server, and when I change to in the URL of the persistence.xml file, the netbeans application will hang for several minutes without any error message. So what can I do? Thanks.

  61. Hi, Thanks alot for the info….this helps alot.
    for some of the previous comments I hav the answer which worked for me.
    For Netbeans 6.1 use “ojdbc14_g.jar”
    not “ojdbc14.jar”

  62. Please help me. How I can edit, modify, retrieve database procedures and triggers using Netbeans. Database is on another m/c and configured to access from my system

  63. I am on Netbeans6, Oracle Apps database Downloaded ojdbc14.jar and created the connection successfully. Now although I can query a table in the execute window, I dont see it in the browser, and also when I tried creating a Java DB Application. This issue is not just for this table, but multiple other tables.
    What I am missing?

    Any help will be greatly appreciated!

  64. Correction: the table I mentioned is actually a synonym in the schema that the DB connection is linked to (APPS). How do I see synonyms in the browser and when I create a DB Application through the wizard?


  65. Can u please give a sample complete code for connecting to a remote oracle database using netbeans ASAP.
    My code has no errors but it does not show any output.
    Pls reply soon

  66. yeah… if we’re using NETBEAN 6.5 and within the JSP pages
    want to connect to ORACLE…
    is there any kind of … examples of it written…?

    so i could analyze it faster…

    😦 hiks

  67. hi,
    i am using netbeans 6.0.1 and Oracle 9i.
    I have successfully connected to database through netbeans.
    but after 2/3 times i m not able to log in. it shows “Connecting to database,Please wait” but nothing happens.
    I tried in 2 computer but same problem encountered.
    I using host string as …… @localhost:1521:[SID NAME]
    this is working perfecly on one computer but in other two computers problem encountered….
    all machine are stand alone.

    Thanks in advance

    1. Hi Santhosh,

      Where did the class12.jar is located?.I’m using NetBeans 6.1 and oracle 9i,I’m trying create a database connection,but I’m sure where this class12.jar is present.Is 1521 is the default port for oracle connection?

      Thanks in Advance,


  68. hi,
    i am able to make connection with oracle 9i on netbeans,it is showing all the tables and is allowing me to write sql commands,but for a jsp page which is making connection with oracle 9i i am getting a error message as: oracle.jdbc.driver.OracleDriver not found. i have added oracle.ojdbc14.jar file in my lib folder.
    Thanx in advance!!

  69. hi I’m getting I/O exception called “the Network Adapter could not Establish the connection ”

    What is the Issue??????????

  70. import java.sql.*;

    class SimpleOraJava {
    public static void main(String args[]) throws SQLException {

    new oracle.jdbc.driver.OracleDriver()

    String serverName = “Ruchi”;
    int port = 2030;
    String user = “scott”;
    String password = “tiger”;
    String SID = “ruchitha”;
    String URL = “jdbc:oracle:thin:@” + serverName + “:” + port + “:” + SID;
    Connection conn = DriverManager.getConnection(URL, user, password);
    Statement stat = conn.createStatement();
    ResultSet rs = stat.executeQuery(SQL);

    while ( {
    rs.getInt(1) +
    “\t” +

    hi I’m getting I/O exception called “the Network Adapter could not Establish the connection ” when try to connect DB

    What is the Issue??????????

    Plzzzzzz Help me???????????

  71. Wow very nice tutorial. Im a postgresql fan! but im planning to use also oracle db express. thank’s for the info! very nice… One Act of random kindness per day can change the world… eeheheh

  72. good morning..
    I’ve installed my oracle 9i and create the database in it and the other computer i installed net beans as an client aplication and want to connect that two comp by peer to peer.would you eplain me how to connect to oracle database server using netbeans as an aplications.
    Thank you…

  73. i found that there’re lots kind of database. For Netbeans we have My SQL, Oracle… What kind i should choose? I want to create database with Oracle, but there’s some problem happened. Can u tell me about it( video is good for me) . Thanks a lot.

  74. Some genuinely nice and useful information on this web site, as well I conceive the layout has got superb features.

  75. What a great post, really like a lot, just something so was looking for, thank you very much for the info and for sharing your time writing this

  76. I’d really like to thanks a lot for the actual work you in some recoverable format this post. I want exactly the same best work from you in the future likewise.

  77. A very useful and helpful site with great articles for everyone and for me too. I discovered your website from a link posted on a forum. I will Come here regularly because i like your site.

  78. I was suggested this web site by way of my cousin. I’m no longer positive whether or not this put up is written by him as no one else recognize such distinct approximately my trouble. You’re amazing! Thanks!

  79. This is a excellent blog, will you be involved in doing an interview about just how you created it? If so e-mail me!

  80. I guess you have made many really interesting points. Not as well many ppl would actually think about it the direction you just did. I am really impressed that there is so much about this subject that has been uncovered and you made it so nicely, with so considerably class. Top-notch one, man! Very special things right here.

  81. i am able to make connection with oracle 9i on netbeans,it is showing all the tables and is allowing me to write sql commands,but for a jsp page which is making connection with oracle 9i i am getting a error message as: oracle.jdbc.driver.OracleDriver not found. i have added oracle.ojdbc14.jar file in my lib folder.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s