• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Database on MySQL Server

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"ksl lagdive"

Please refer to the JavaRanch naming policy and update your name appropriately.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic