You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2002/03/05 13:11:37 UTC

Simper with MySQL

I'm trying to get Simper working with MySQL and I'm getting the following error
when I try to access http://localhost/simper (Tomcat 4.x running on port 80).

<exception>
javax.servlet.ServletException: Exception while Simper.initEverything tried to
invoke user-supplied initializer: java.lang.IllegalStateException: Invalid
sqlType: -1
	at org.netmeme.simper.Simper.initEverything(Simper.java:260)
	at org.netmeme.simper.Simper.doFilter(Simper.java:158)
</exception>

<root_cause>
java.lang.IllegalStateException: Invalid sqlType: -1
	at org.netmeme.simper.Simper.getClassFromSQLType(Simper.java:401)
	at org.netmeme.simper.Simper.registerTable(Simper.java:294)
	at org.netmeme.simper.demo.DemoInit.init(DemoInit.java:41)
	at org.netmeme.simper.Simper.initEverything(Simper.java:258)
	at org.netmeme.simper.Simper.doFilter(Simper.java:158)
</root_cause>

SQL Script I used to load MySQL:
<sql_script>
--
-- SQL commands to generate the simperdemo database
--

CREATE TABLE IF NOT EXISTS authors (
	id int NOT NULL,
	name text,
	email text,
	Constraint authors_pkey Primary Key (id)
);

CREATE TABLE IF NOT EXISTS  books (
	id int NOT NULL,
	id_author integer,
	title text,
	publishdate timestamp,
	Constraint books_pkey Primary Key (id)
);

CREATE TABLE IF NOT EXISTS  next_id_table (
	table_name text,
	next_id int
);

--INSERT INTO next_id_table (table_name, next_id) values ('authors', 0);
	
--INSERT INTO next_id_table (table_name, next_id) values ('books', 0);

	
--
-- Create a foreign key relationship (books.id_author to authors.id)
-- To my knowledge, MySQL does not support referential integrety...

alter table books add constraint fk_books_authors foreign key (id_author)
references authors (id)
</sql_script>

<log_messages>
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - doFilter
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - initEverything
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  -
initClassName=org.netmeme.simper.demo.Demo
Init
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.demo.DemoInit  - init
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerDataSource
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerTable(books)
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name: id,
type: class java.lang.Int
eger
[HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name:
id_author, type: class java.l
ang.Integer
</log_messages>

Any ideas?

Matt

__________________________________________________
Do You Yahoo!?
Try FREE Yahoo! Mail - the world's greatest free email!
http://mail.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Simper with MySQL

Posted by Bryan Field-Elliot <br...@netmeme.org>.
It's LONGVARCHAR (== java.sql.Types value of -1). Two lines of code to
be added to Simper to support this... Will be doing another checking (to
sf) in the short term.

FYI, the "null" type is 0. And just what the heck does that mean? I've
never heard of a column type of null (as opposed to a column which
allows nulls, which is totally different).

Bryan


On Tue, 2002-03-05 at 20:47, Ted Husted wrote:

    It's probably null. I've noticed that different pools handle this
    differently. I believe Resin returns zero instead.
    
    Bryan Field-Elliot wrote:
    > 
    > Yes,
    > 
    > There are two functions with Simper where we do mapping of
    > java.sql.Types to Java classes, and vice versa.
    > 
    > The error you're getting is that the functions mentioned above don't yet
    > understand java.sql.Type of -1. Do you know offhand what type that is?
    > It can be added easily to Simper, I can make the change and commit to
    > sourceforge CVS in a flash.
    > 
    > Bryan
    > 
    > On Tue, 2002-03-05 at 05:11, Matt Raible wrote:
    > 
    >     I'm trying to get Simper working with MySQL and I'm getting the following error
    >     when I try to access http://localhost/simper (Tomcat 4.x running on port 80).
    > 
    >     <exception>
    >     javax.servlet.ServletException: Exception while Simper.initEverything tried to
    >     invoke user-supplied initializer: java.lang.IllegalStateException: Invalid
    >     sqlType: -1
    >         at org.netmeme.simper.Simper.initEverything(Simper.java:260)
    >         at org.netmeme.simper.Simper.doFilter(Simper.java:158)
    >     </exception>
    > 
    >     <root_cause>
    >     java.lang.IllegalStateException: Invalid sqlType: -1
    >         at org.netmeme.simper.Simper.getClassFromSQLType(Simper.java:401)
    >         at org.netmeme.simper.Simper.registerTable(Simper.java:294)
    >         at org.netmeme.simper.demo.DemoInit.init(DemoInit.java:41)
    >         at org.netmeme.simper.Simper.initEverything(Simper.java:258)
    >         at org.netmeme.simper.Simper.doFilter(Simper.java:158)
    >     </root_cause>
    > 
    >     SQL Script I used to load MySQL:
    >     <sql_script>
    >     --
    >     -- SQL commands to generate the simperdemo database
    >     --
    > 
    >     CREATE TABLE IF NOT EXISTS authors (
    >         id int NOT NULL,
    >         name text,
    >         email text,
    >         Constraint authors_pkey Primary Key (id)
    >     );
    > 
    >     CREATE TABLE IF NOT EXISTS  books (
    >         id int NOT NULL,
    >         id_author integer,
    >         title text,
    >         publishdate timestamp,
    >         Constraint books_pkey Primary Key (id)
    >     );
    > 
    >     CREATE TABLE IF NOT EXISTS  next_id_table (
    >         table_name text,
    >         next_id int
    >     );
    > 
    >     --INSERT INTO next_id_table (table_name, next_id) values ('authors', 0);
    > 
    >     --INSERT INTO next_id_table (table_name, next_id) values ('books', 0);
    > 
    > 
    >     --
    >     -- Create a foreign key relationship (books.id_author to authors.id)
    >     -- To my knowledge, MySQL does not support referential integrety...
    > 
    >     alter table books add constraint fk_books_authors foreign key (id_author)
    >     references authors (id)
    >     </sql_script>
    > 
    >     <log_messages>
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - doFilter
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - initEverything
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  -
    >     initClassName=org.netmeme.simper.demo.Demo
    >     Init
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.demo.DemoInit  - init
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerDataSource
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerTable(books)
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name: id,
    >     type: class java.lang.Int
    >     eger
    >     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name:
    >     id_author, type: class java.l
    >     ang.Integer
    >     </log_messages>
    > 
    >     Any ideas?
    > 
    >     Matt
    > 
    >     __________________________________________________
    >     Do You Yahoo!?
    >     Try FREE Yahoo! Mail - the world's greatest free email!
    >     http://mail.yahoo.com/
    > 
    >     --
    >     To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
    >     For additional commands, e-mail: <ma...@jakarta.apache.org>
    > 
    > 
    > 
    
    -- Ted Husted, Husted dot Com, Fairport NY US
    -- Developing Java Web Applications with Struts
    -- Tel: +1 585 737-3463
    -> Web: http://husted.com/about/services
    
    --
    To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
    For additional commands, e-mail: <ma...@jakarta.apache.org>
    
    

Re: Simper with MySQL

Posted by Ted Husted <hu...@apache.org>.
It's probably null. I've noticed that different pools handle this
differently. I believe Resin returns zero instead.

Bryan Field-Elliot wrote:
> 
> Yes,
> 
> There are two functions with Simper where we do mapping of
> java.sql.Types to Java classes, and vice versa.
> 
> The error you're getting is that the functions mentioned above don't yet
> understand java.sql.Type of -1. Do you know offhand what type that is?
> It can be added easily to Simper, I can make the change and commit to
> sourceforge CVS in a flash.
> 
> Bryan
> 
> On Tue, 2002-03-05 at 05:11, Matt Raible wrote:
> 
>     I'm trying to get Simper working with MySQL and I'm getting the following error
>     when I try to access http://localhost/simper (Tomcat 4.x running on port 80).
> 
>     <exception>
>     javax.servlet.ServletException: Exception while Simper.initEverything tried to
>     invoke user-supplied initializer: java.lang.IllegalStateException: Invalid
>     sqlType: -1
>         at org.netmeme.simper.Simper.initEverything(Simper.java:260)
>         at org.netmeme.simper.Simper.doFilter(Simper.java:158)
>     </exception>
> 
>     <root_cause>
>     java.lang.IllegalStateException: Invalid sqlType: -1
>         at org.netmeme.simper.Simper.getClassFromSQLType(Simper.java:401)
>         at org.netmeme.simper.Simper.registerTable(Simper.java:294)
>         at org.netmeme.simper.demo.DemoInit.init(DemoInit.java:41)
>         at org.netmeme.simper.Simper.initEverything(Simper.java:258)
>         at org.netmeme.simper.Simper.doFilter(Simper.java:158)
>     </root_cause>
> 
>     SQL Script I used to load MySQL:
>     <sql_script>
>     --
>     -- SQL commands to generate the simperdemo database
>     --
> 
>     CREATE TABLE IF NOT EXISTS authors (
>         id int NOT NULL,
>         name text,
>         email text,
>         Constraint authors_pkey Primary Key (id)
>     );
> 
>     CREATE TABLE IF NOT EXISTS  books (
>         id int NOT NULL,
>         id_author integer,
>         title text,
>         publishdate timestamp,
>         Constraint books_pkey Primary Key (id)
>     );
> 
>     CREATE TABLE IF NOT EXISTS  next_id_table (
>         table_name text,
>         next_id int
>     );
> 
>     --INSERT INTO next_id_table (table_name, next_id) values ('authors', 0);
> 
>     --INSERT INTO next_id_table (table_name, next_id) values ('books', 0);
> 
> 
>     --
>     -- Create a foreign key relationship (books.id_author to authors.id)
>     -- To my knowledge, MySQL does not support referential integrety...
> 
>     alter table books add constraint fk_books_authors foreign key (id_author)
>     references authors (id)
>     </sql_script>
> 
>     <log_messages>
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - doFilter
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - initEverything
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  -
>     initClassName=org.netmeme.simper.demo.Demo
>     Init
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.demo.DemoInit  - init
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerDataSource
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerTable(books)
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name: id,
>     type: class java.lang.Int
>     eger
>     [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name:
>     id_author, type: class java.l
>     ang.Integer
>     </log_messages>
> 
>     Any ideas?
> 
>     Matt
> 
>     __________________________________________________
>     Do You Yahoo!?
>     Try FREE Yahoo! Mail - the world's greatest free email!
>     http://mail.yahoo.com/
> 
>     --
>     To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>     For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 

-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-> Web: http://husted.com/about/services

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Simper with MySQL

Posted by Bryan Field-Elliot <br...@netmeme.org>.
Yes,

There are two functions with Simper where we do mapping of
java.sql.Types to Java classes, and vice versa.

The error you're getting is that the functions mentioned above don't yet
understand java.sql.Type of -1. Do you know offhand what type that is?
It can be added easily to Simper, I can make the change and commit to
sourceforge CVS in a flash.

Bryan


On Tue, 2002-03-05 at 05:11, Matt Raible wrote:

    I'm trying to get Simper working with MySQL and I'm getting the following error
    when I try to access http://localhost/simper (Tomcat 4.x running on port 80).
    
    <exception>
    javax.servlet.ServletException: Exception while Simper.initEverything tried to
    invoke user-supplied initializer: java.lang.IllegalStateException: Invalid
    sqlType: -1
    	at org.netmeme.simper.Simper.initEverything(Simper.java:260)
    	at org.netmeme.simper.Simper.doFilter(Simper.java:158)
    </exception>
    
    <root_cause>
    java.lang.IllegalStateException: Invalid sqlType: -1
    	at org.netmeme.simper.Simper.getClassFromSQLType(Simper.java:401)
    	at org.netmeme.simper.Simper.registerTable(Simper.java:294)
    	at org.netmeme.simper.demo.DemoInit.init(DemoInit.java:41)
    	at org.netmeme.simper.Simper.initEverything(Simper.java:258)
    	at org.netmeme.simper.Simper.doFilter(Simper.java:158)
    </root_cause>
    
    SQL Script I used to load MySQL:
    <sql_script>
    --
    -- SQL commands to generate the simperdemo database
    --
    
    CREATE TABLE IF NOT EXISTS authors (
    	id int NOT NULL,
    	name text,
    	email text,
    	Constraint authors_pkey Primary Key (id)
    );
    
    CREATE TABLE IF NOT EXISTS  books (
    	id int NOT NULL,
    	id_author integer,
    	title text,
    	publishdate timestamp,
    	Constraint books_pkey Primary Key (id)
    );
    
    CREATE TABLE IF NOT EXISTS  next_id_table (
    	table_name text,
    	next_id int
    );
    
    --INSERT INTO next_id_table (table_name, next_id) values ('authors', 0);
    	
    --INSERT INTO next_id_table (table_name, next_id) values ('books', 0);
    
    	
    --
    -- Create a foreign key relationship (books.id_author to authors.id)
    -- To my knowledge, MySQL does not support referential integrety...
    
    alter table books add constraint fk_books_authors foreign key (id_author)
    references authors (id)
    </sql_script>
    
    <log_messages>
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - doFilter
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - initEverything
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  -
    initClassName=org.netmeme.simper.demo.Demo
    Init
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.demo.DemoInit  - init
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerDataSource
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - registerTable(books)
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name: id,
    type: class java.lang.Int
    eger
    [HttpProcessor[80][1]] DEBUG org.netmeme.simper.Simper  - column name:
    id_author, type: class java.l
    ang.Integer
    </log_messages>
    
    Any ideas?
    
    Matt
    
    __________________________________________________
    Do You Yahoo!?
    Try FREE Yahoo! Mail - the world's greatest free email!
    http://mail.yahoo.com/
    
    --
    To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
    For additional commands, e-mail: <ma...@jakarta.apache.org>