Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

inventory databasing

Thread view: 
lalalala - 26 May 2006 16:38 GMT
Hi i took a introductory course in java and ive been programming ever
since. Ive been trying to create a database prgm for my company, and i
heard that access was going to be the simplest and most accesable way
to do it. Ive been trying to connect the java to the access database
that i created but i keep getting an error.
Can anyone check my code and see if i did something wrong, or perhaps
give me some insight on where i may be going wrong.
Here is the code:

private Connection conn01 = null;
public void connect(){

        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }

        String databaseName = "invent";
       String url          = "jdbc:odbc:" + databaseName;
       String loginName    = "Admin";
       String password     = "lace";

       try {
            conn01 = DriverManager.getConnection(url, loginName, password);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

AND IM RECEIVING THIS ERROR

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3074)
    at
sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at allm.test.DBaccess.connect(DBaccess.java:29)
    at allm.test.test.main(test.java:15)
java.lang.NullPointerException
    at allm.test.DBaccess.isExist(DBaccess.java:60)
    at allm.test.test.main(test.java:19)
Exception in thread "main"

any form of help is greatly appreciated.
I'm sitting in my office with writers block.
Thank you
Nadav
IchBin - 26 May 2006 17:48 GMT
> Hi i took a introductory course in java and ive been programming ever
> since. Ive been trying to create a database prgm for my company, and i
[quoted text clipped - 49 lines]
> Thank you
> Nadav

That looks like you have not defined the Data source to the "ODBC Data
source Administrator".

Personally, I would not code against a Ms Access Database. Since you
have a choice I would use say HSQLDB. This can be found at

http://hsqldb.org

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.