• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Database on MySQL Server

 
kashinath lagdive
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NullPointerException is a problem with Java and not MySQL. Can we see some more code? How do you get your Connection?
 
Scott Selikoff
author
Saloon Keeper
Posts: 4007
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"ksl lagdive"

Please refer to the JavaRanch naming policy and update your name appropriately.
 
Campbell Ritchie
Sheriff
Posts: 48381
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48381
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by kashinath lagdive:
thank you . . . code is working properly.
Well done
[ July 21, 2008: Message edited by: Campbell Ritchie ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic