wood burning stoves 2.0
The moose likes JDBC and Relational Databases and the fly likes mySQL INTEGER == LONG in Java and ....??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "mySQL INTEGER == LONG in Java and ....???" Watch "mySQL INTEGER == LONG in Java and ....???" New topic

mySQL INTEGER == LONG in Java and ....???

Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
I have a program that creates a table as follows:

Notice that this is using MySQL and that Cups and Entry are INTEGERS and Customer is a VARCHAR. But when I run the following snippet from another program:

It doesn't print that Entry is of type int. I get an error
stating that my driver
What are the equivalent conversions from MySQL to Java? I am able to retreive the data and work with it, but when it tries to find its class equivalent, I get an error.
Thanks for your attention to my problem.
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
The DatabaseMetaData interface provides a getTypeInfo() method. This returns a result set that includes every type name recognized by the connection and the equivalent java.sql.Types constant that it maps to. With a switch statement, you can equate this to the appropriate java.sql.Types name.

Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets

Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
Brian Snyder
Ranch Hand

Joined: Feb 03, 2001
Posts: 142
Thanks Phil for your response. My question was, however, why doesn't getColumnClassName work correctly??
I agree. Here's the link: http://aspose.com/file-tools
subject: mySQL INTEGER == LONG in Java and ....???
jQuery in Action, 3rd edition