(Please remember to honor your company's IT policies before installing new software!) • • • •. Jive will not function with this version of Internet Explorer. Please consider upgrading to a more recent version of Internet Explorer, or trying another browser such as Firefox, Safari, or Google Chrome. In order to provide the best platform for continued innovation, Jive no longer supports Internet Explorer 7. Set default program for dwg files mac. Attention, Internet Explorer User Announcement: Jive has discontinued support for Internet Explorer 7 and below.
Ranch Hand
Dj Program For Mac
A JDBC (Java Database Connectivity) program comprises the following steps: Allocate a Connection object, for connecting to the database server. Allocate a Statement object, under the Connection object created, for holding a SQL command. Breaking: PriorityQueue example program to order the elements in this queue, or null if this queue is sorted according to the natural ordering of its elements use Comparator() method.| Comments Off on PriorityQueue example program to order the elements in this queue, or null if this queue is sorted according to the natural ordering of its elements use Comparator() method.
Sample Jdbc Connectivity Program For Mac Using Eclipse Lunarposted 4 years ago
I am new to both Eclipse and the Mac, have a MacBook Pro with OS X 10.10 Yosemite. Had been developing a project using Java and PostgreSQL on a Dell Win 7 with NetBeans. Due to several reasons I decided to bite the bullet and move to a Mac 1) to make some changes and additions to the present project and 2) to develop a related project under Eclipse. (Other folks who might further develop these project are working with Eclipse; thus, I felt I should work in only one SDK - Eclipse to make things simpler for myself and others in the future.)
I installed NetBeans 8.0.2 SDK on the Mac. The identical program developed under NetBeans works both on the Win 7 and on the Mac. However, when I moved the code for the present project into Eclipse (Luna 4.4.1) there are several errors, indicated in my bracketed comments below. The problem I am requesting help on is connection to the PostgreSQL database via Eclipse, which is properly installed on the Mac. Connectivity is successful under NetBeans on the Mac but not under Eclipse on the Mac. The following sections of code are in BOTH NetBeans and Eclipse versions. public static void sign_on() { Class driverClass = loadDriver('org.postgresql.Driver'); if (driverClass null) { return; } System.out.println('Connection successful”); con = connectURL(“jdbc:postgresql://localhost/pg1', 'postgres', 'ginkat8a'); if (Globals.con != null) { try { DatabaseMetaData dmd = Globals.con.getMetaData(); System.out.print('Connected to '); System.out.print(dmd.getDatabaseProductName()); String dbversion = dmd.getDatabaseProductVersion(); System.out.println(', version ' + dbversion); System.out.println('driver: ' + dmd.getDriverName() + ', version ' + dmd.getDriverVersion()); } catch (SQLException e) { System.err.println('Error 3: ' + 'DatbaseMetaData failed(SQLExcception: ' + e.getMessage()); JOptionPane.showMessageDialog(null, 'DatbaseMetaData failed(SQLExcception: ' + e.getMessage(), //BODY OF MESSAGE 'Error 3: cannot obtain metadata about database', // ABOVE IS BANNER JOptionPane.ERROR_MESSAGE); System.exit(1); } } // END OF if (Globals.con != null) public static Class loadDriver(String driverName) { try { return (Class.forName(driverName)); } catch (ClassNotFoundException e) { System.err.println('Error 1: Can't load driver 1: ' + e.getMessage()); JOptionPane.showMessageDialog(null, 'ClassNotFoundException ' + e.getMessage(), 'Error 1: Can't load driver',//BANNER JOptionPane.ERROR_MESSAGE); return (null); } catch (Exception e) { System.err.println('Error 2: Can't load driver 2: ' + e.toString()); JOptionPane.showMessageDialog(null, 'Error 2: Can't load driver', //BODY OF MESSAGE 'ClassNotFoundException ' + e.getMessage(),//BANNER JOptionPane.ERROR_MESSAGE); return (null); // System.exit(1); } [Output of Eclipse version:] Point 1 at beginning in Main of MainProgram.java Point 3A after initComponents AND BEFORE addActionListeners Point 3 after initComponents ]Error 1: Can't load driver 1: org.postgresql.Driver Point 4 Am in MainProgram after return from Globals.sign_on() [Output of NetBeans version:] Point 1 at beginning in Main of MainProgram.java Point 3A after initComponents AND BEFORE addActionListeners Point 3 after initComponents Connection successful have just set up con in globals.java Connected to PostgreSQL, version 9.4.1 driver: PostgreSQL Native Driver, version PostgreSQL 9.2 JDBC4.1 (build 1004) Point 4 Am in MainProgram after return from Globals.sign_on() [ and then it goes on to successfully retrieve rows from the PostgreSQL database.] I think it is a JDBC problem, as I can't figure out the PostgreSQL instructions. I do not know how to set up the CLASSPATH on the Mac. (Am having trouble converting myself over to the Mac - too many years of Windows.) Do not know where to put the CLASSPATH. I downloaded the following: postgresql-jdbc-9.4-1200.src.tar postgresql-9.4-1200.jdbc41.jar postgresql-9.4-1200.jdbc4.jar postgresql-9.2-1004.jdbc41.jar postgresql-9.2-1004.jdbc41.jar Help would be greatly appreciated.
Bartender
posted 4 years ago
Hi, welcome to the ranch!
If you're going to post code, can you please UseCodeTags ? It makes it so much easier to read, and also doesn't lose your formatting. >Error 1: Can't load driver 1: org.postgresql.Driver >I do not know how to set up the CLASSPATH on the Mac. Looks like you have successfully diagnosed the issue yourself. The database driver is not available for the java class at runtime, so it throws that error. Seeing as you are in Eclipse, the easiest solution would be to add that database driver jar file to the project's build path. You can find it in project properties 'Java Build Path' - the 'Libraries' tab. Alternatively, right click the project and select: Build Path --> Add External Libraries. Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |