aspose file tools*
The moose likes JDBC and the fly likes Database on MySQL Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Database on MySQL Server" Watch "Database on MySQL Server" New topic
Author

Database on MySQL Server

kashinath lagdive
Greenhorn

Joined: Jul 13, 2008
Posts: 2
Dear Friends,
I have following SQL code for database:

"Statement stmt=con.createStatement();
boolean b=stmt.execute("CREATE TABLE user(emailid VARCHAR(30) NOT NULL, password VARCHAR(12), PRIMARY KEY(emailid))");"

which is not executing on my mysql server database. giving exception like this :
"org.apache.jasper.JasperException
root cause :
java.lang.NullPointerException"

How can i create table in my MySql database on remote server.
Connection is getting establised properly.How can i eliminate this Exception.Code is successfully running on my local machine and Localhost database server.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

NullPointerException is a problem with Java and not MySQL. Can we see some more code? How do you get your Connection?
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3697
    
    5

"ksl lagdive"

Please refer to the JavaRanch naming policy and update your name appropriately.


My Blog: Down Home Country Coding with Scott Selikoff
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
The message says the root cause is a NullPointerException (NPE).
Some people say the NPE is the commonest and most annoying mistake in Java. This is obviously discussed often on JavaRanch. The first thing to do is to get more details (as David has told you). Find where that occurs and put lots of informative code in the catch block, including exc.printStackTrace(); (where "exc" is what you wrote in the () after catch). Follow the stack trace back to where you might have something which is null.

Do a search and you get useful old posts like this, this, this, and there will be lots more. Read those threads; what you are interested in is not what happened, but how we suggested they sort out their NPEs. You need to do the same.
kashinath lagdive
Greenhorn

Joined: Jul 13, 2008
Posts: 2
thank you very much sir,
Just there is minor mistake in my code in my connection
object, exception gets resolved successfully.
code is working properly.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
Originally posted by kashinath lagdive:
thank you . . . code is working properly.
Well done
[ July 21, 2008: Message edited by: Campbell Ritchie ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Database on MySQL Server
 
Similar Threads
Which OSS database servers support Unicode ?
Mapping ENUM('0', '1') or CHAR(0) for Boolean
Problem With Creating Table
Basic instructions for setting up/running mySQL
How to restrict user against marking same event in multiple times