Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: JDBC driver in Xcode?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JDBC driver in Xcode?



Thanks for the confirmation and test code.  Evidently java lied about the error, which turned out not to be the driver at all, but a malformed URL.  Prepending my URL with "jdbc:mysql://" took care of the problem.


----- Original Message ----
> From: Ralph Martin <email@hidden>
> To: dave d <email@hidden>
> Cc: Ralph Martin <email@hidden>
> Sent: Wednesday, June 17, 2009 3:57:18 AM
> Subject: Re: JDBC driver in Xcode?
>
> This works for me with the mysql-connector-java-5.1.7-bin.jar file in
> /Library/Java/Extensions folder:
>
>        try {
>             Class.forName("com.mysql.jdbc.Driver");
>         } catch (java.lang.ClassNotFoundException e) {
>             System.err.println("MYSQL JDBC Driver Not Loaded.");
>             System.err.print("ClassNotFoundException: ");
>             System.err.println(e.getMessage());
>             System.exit(1);
>         }
>
>         try {
>             System.out.println("Trying to connect...");
>
>             String url = "jdbc:mysql://localhost/thedatabase";
>             java.sql.Connection con =
> DriverManager.getConnection(url,"username","password");
>
>
> Best wishes
>
> Ralph
> --
> Prof Ralph Martin           Phone: +44(0)29 2087 5536
> School of Computer Science  Fax:   +44(0)29 2087 4598
> Cardiff University          Email: mailto:email@hidden
> 5 The Parade, Roath         WWW:   http://ralph.cs.cf.ac.uk/
> Cardiff, CF24 3AA, UK       VOIP:  sip:email@hidden




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >JDBC driver in Xcode? (From: dave d <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.