Message from discussion
MyBatis generator with sqlite gives "did not resolve to any tables"
Received: by 10.58.170.6 with SMTP id ai6mr8513554vec.35.1351210378666;
Thu, 25 Oct 2012 17:12:58 -0700 (PDT)
X-BeenThere: mybatis-user@googlegroups.com
Received: by 10.52.20.7 with SMTP id j7ls4337243vde.0.gmail; Thu, 25 Oct 2012
17:12:56 -0700 (PDT)
Received: by 10.52.28.176 with SMTP id c16mr4032916vdh.5.1351210376662;
Thu, 25 Oct 2012 17:12:56 -0700 (PDT)
Date: Thu, 25 Oct 2012 17:12:56 -0700 (PDT)
From: cha <chaf...@gmail.com>
To: mybatis-user@googlegroups.com
Message-Id: <2db62032-258c-4354-88d0-0d336cc02800@googlegroups.com>
In-Reply-To: <CAKpaNj7rGZheO+Fa8bPHqZ5kpQObV9fReqnpy=X4bsPf2G1rUw@mail.gmail.com>
References: <0afa865a-4d6e-45e0-9c9b-426b18b2bc97@googlegroups.com>
<CAKpaNj5twucpyFV=EnAhgajcxAO2DyiAo-o28k6VwT9RghSd8g@mail.gmail.com>
<9e508b39-9111-491e-acbc-e26b1bde8ad4@googlegroups.com>
<CAKpaNj7PtsyP_Np6R6t+Rq=KsDJFkbuTA7LA564ZJRaxUPyvwQ@mail.gmail.com>
<509606e5-3931-4c04-9a49-f1eac2791124@googlegroups.com>
<CAKpaNj6AMwEu+sxCL3QGEGHbppdq0Oo0YruBqs99mkft1p0cfA@mail.gmail.com>
<892d4721-8081-495c-9ad7-590d9bf335dc@googlegroups.com>
<CAKpaNj7rGZheO+Fa8bPHqZ5kpQObV9fReqnpy=X4bsPf2G1rUw@mail.gmail.com>
Subject: Re: MyBatis generator with sqlite gives "did not resolve to any
tables"
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_166_32593953.1351210376336"
------=_Part_166_32593953.1351210376336
Content-Type: multipart/alternative;
boundary="----=_Part_167_30481157.1351210376336"
------=_Part_167_30481157.1351210376336
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
I'm pretty sure it isn't case sensive, tableName, TABLENAME, and tablename
all return the same metadata. Anyways, the case I am using is correct.
Which driver says it uses case sensitivity? I'm using sqitejdbc.
<classPathEntry location=*"\mylocation\sqlitejdbc-v056.jar"* />
On Thursday, October 25, 2012 5:02:52 PM UTC-7, Jeff Butler wrote:
> I looked at the source code for their driver. It ignores catalog and
> schema - so it doesn't matter what you put there. It is also case
> sensitive.
>
> The generator never calls getColumns with 4 nulls - that's just a
> debugging technique.
>
> This is probably a case sensitivity problem. In your generator
> config, specify this:
>
> <table tableName="yourTableName" />
>
> Specify the tableName in the same case you used in your test program.
>
> Jeff Butler
>
>
> On Thu, Oct 25, 2012 at 7:37 PM, cha <cha...@gmail.com <javascript:>>
> wrote:
> > Hmmm, if it uses getMetaData it should be fine. The ResultSet comes back
> > with the expected
> >
> >
> > null, null, tableName, col1Name, 12, TEXT, 2000000000 ...
> >
> > for each column. Oddly enough it still gives the same answer if wrong
> > catalog and schema is given like dbmd.getColumns(wrongCatalog,
> wrongSchema,
> > tableName, null).
> >
> > You mentioned that I try dbmd.getColumns(null, null, null, null) to get
> a
> > list of all the columns in the database. Using four nulls this way
> returns
> > an empty ResultSet. This might be the problem if the generator calls
> > getColumns(null, null, null, null) at some point (say, to get a feel for
> the
> > entire database).
> >
> >
> >
> > On Thursday, October 25, 2012 1:12:31 PM UTC-7, Jeff Butler wrote:
> >>
> >> My best guess is that there is a problem with the SQLite JDBC driver -
> >> either a bug or they have not implemented the
> >> DatabaseMetaData.getColumns() method.
> >>
> >> You can check it yourself with a small Java program. This is
> >> virtually what the generator does:
> >>
> >> Connection c = getConnection(); // you must write the getConnection
> >> method
> >> DatabaseMetaData dbmd = c.getMetaData();
> >> ResultSet rs = dbmd.getColumns(catalog, schema, table, null);
> >>
> >> If the ResultSet comes back empty, then you'll see the message your
> >> are seeing. The driver is not throwing an error, it's just returning
> >> nothing. So there is no better error information to display.
> >>
> >> You'll have to experiment with values for catalog, schema, and table
> >> to see if you can get something to come back, You can set all four
> >> parameters to null which should return information about every column
> >> in the database (a long list). That would give you a clue as to what
> >> needs to be entered.
> >>
> >> Another issue could be case sensitivity. If SQLite is case sensitive
> >> in the metadata then you will need to specify the proper case and set
> >> the table configuration to use delimited parameters.
> >>
> >> As for your other question about passing in a create table statement,
> >> there is no support for that in the generator.
> >>
> >> Jeff Butler
> >>
> >>
> >> On Thu, Oct 25, 2012 at 3:44 PM, cha <cha...@gmail.com> wrote:
> >> > Thanks, but I'm still having problems here. Do you know of anyone who
> >> > has
> >> > gotten this to work with sqlite?
> >> >
> >> > What would help is more failure information. Is there a way to get
> more
> >> > about why the table isn't resolved from the generator? For example
> the
> >> > same
> >> > error is given if the database file testDB_DNE.sqlite doesn't exist
> as a
> >> > table, schema, or catalog that doesn't exist.
> >> >
> >> > Another way to fix this might be to just hand feed the tables'
> "create
> >> > table
> >> > ..." or something like that to the generator instead of having it
> >> > instrospect. Is this possible?
> >> >
> >> >
> >> > On Friday, October 19, 2012 11:20:45 AM UTC-7, Jeff Butler wrote:
> >> >>
> >> >> I'm not an SQLite user, so I don't know for sure. You might try
> >> >> setting schema to "testDB.sqlite". You might also try setting
> catalog
> >> >> to "testDB" and schema to "sqlite". It's really dependent on how
> they
> >> >> implemented the JDBC driver.
> >> >>
> >> >> Jeff Butler
> >> >>
> >> >> On Fri, Oct 19, 2012 at 1:55 PM, cha <cha...@gmail.com> wrote:
> >> >> > Thanks for the reply. Originally, I left catalog and schema off
> and
> >> >> > got
> >> >> >
> >> >> > "Generation Warnings Occured
> >> >> > Table configuration with catalog null, schema null, and table
> >> >> > testTable
> >> >> > did not resolve to any tables"
> >> >> >
> >> >> > Which made me think I needed schema/catalog settings. The entire
> >> >> > generatorConfig.xml is
> >> >> >
> >> >> > <?xml version="1.0" encoding="UTF-8" ?>
> >> >> > <!DOCTYPE generatorConfiguration PUBLIC "-//mybatis.org//DTDMyBatis
> >> >> > Generator Configuration 1.0//EN"
> >> >> > "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" >
> >> >> > <generatorConfiguration >
> >> >> > <context id="context">
> >> >> > <jdbcConnection driverClass="org.sqlite.JDBC"
> >> >> > connectionURL="jdbc:sqlite:testDB.sqlite" userId="" password=""
> >> >> >></jdbcConnection>
> >> >> > <javaModelGenerator targetPackage="model"
> >> >> > targetProject="test/src"
> >> >> >></javaModelGenerator>
> >> >> > <sqlMapGenerator targetPackage="model"
> targetProject="test/src"
> >> >> >></sqlMapGenerator>
> >> >> > <javaClientGenerator targetPackage="model"
> targetProject="test"
> >> >> > type="XMLMAPPER" ></javaClientGenerator>
> >> >> > <table tableName="afloatplantest" >
> >> >> >
> >> >> > <property name="useActualColumnNames" value="true"/>
> >> >> > </table>
> >> >> > </context>
> >> >> >
> >> >> >
> >> >> > On Friday, October 19, 2012 10:05:37 AM UTC-7, Jeff Butler wrote:
> >> >> >>
> >> >> >> sqlite does not have catalogs - leave that off.
> >> >> >>
> >> >> >> Only use the schema if you create tables like schema.table_name.
> >> >> >> Else
> >> >> >> leave that off too.
> >> >> >>
> >> >> >> You probably only need to specify the tableName.
> >> >> >>
> >> >> >> Jeff Butler
> >> >> >>
> >> >> >>
> >> >> >> On Fri, Oct 19, 2012 at 12:10 PM, cha <cha...@gmail.com> wrote:
> >> >> >> > Hello, I am having a problem with MyBatis generator on sqlite.
> >> >> >> > When I try to generate, I get
> >> >> >> >
> >> >> >> > "Generation Warnings Occured
> >> >> >> > Table configuration with catalog main, schema sqlite_master,
> and
> >> >> >> > table
> >> >> >> > testTable did not resolve to any tables"
> >> >> >> >
> >> >> >> > The table config that I am using is
> >> >> >> >
> >> >> >> > <table catalog="main" schema="sqlite_master"
> tableName="testTable"
> >> >> >> > >
> >> >> >> > <property name="useActualColumnNames" value="true"/>
> >> >> >> > </table>
> >> >> >> >
> >> >> >> > I have also tried variations like
> >> >> >> >
> >> >> >> > <table catalog="main" schema="sqlite" tableName="testTable" >
> >> >> >> > <property name="useActualColumnNames" value="true"/>
> >> >> >> > </table>
> >> >> >> >
> >> >> >> > <table schema="sqlite" tableName="testTable" >
> >> >> >> > <property name="useActualColumnNames" value="true"/>
> >> >> >> > </table>
> >> >> >> >
> >> >> >> > Has anyone used succesfully used MyBatis generator with sqlite
> and
> >> >> >> > know
> >> >> >> > the
> >> >> >> > schema settings?
>
------=_Part_167_30481157.1351210376336
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<DIV>I'm pretty sure it isn't case sensive, tableName, TABLENAME, and table=
name all return the same metadata. Anyways, the case I am using is cor=
rect. Which driver says it uses case sensitivity? I'm using sqitejdbc.</DIV=
>
<DIV>
<P><FONT color=3D#3f7f7f size=3D2><FONT color=3D#3f7f7f size=3D2><classP=
athEntry</FONT></FONT><FONT color=3D#000000 size=3D2> </FONT><FONT color=3D=
#7f007f size=3D2><FONT color=3D#7f007f size=3D2>location</FONT></FONT><FONT=
color=3D#000000 size=3D2>=3D</FONT><I><FONT color=3D#2a00ff size=3D2><FONT=
color=3D#2a00ff size=3D2>"\mylocation\sqlitejdbc-v056.jar"</I></FONT></FON=
T><FONT color=3D#000000 size=3D2> </FONT><FONT color=3D#008080 size=3D2><FO=
NT color=3D#008080 size=3D2>/></P></FONT></FONT><BR>On Thursday, October=
25, 2012 5:02:52 PM UTC-7, Jeff Butler wrote:</DIV>
<BLOCKQUOTE style=3D"BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex=
; PADDING-LEFT: 1ex" class=3Dgmail_quote>I looked at the source code for th=
eir driver. It ignores catalog and <BR>schema - so it doesn't matter =
what you put there. It is also case <BR>sensitive. <BR><BR>The genera=
tor never calls getColumns with 4 nulls - that's just a <BR>debugging techn=
ique. <BR><BR>This is probably a case sensitivity problem. In your ge=
nerator <BR>config, specify this: <BR><BR><table tableName=3D"yourTableN=
ame" /> <BR><BR>Specify the tableName in the same case you used in your =
test program. <BR><BR>Jeff Butler <BR><BR><BR>On Thu, Oct 25, 2012 at 7:37 =
PM, cha <<A href=3D"javascript:" target=3D_blank gdf-obfuscated-mailto=
=3D"lXUxm3C4UiAJ">cha...@gmail.com</A>> wrote: <BR>> Hmmm, if it uses=
getMetaData it should be fine. The ResultSet comes back <BR>> with the =
expected <BR>> <BR>> <BR>> null, null, tableName, col1Name, 12, TE=
XT, 2000000000 ... <BR>> <BR>> for each column. Oddly enough it still=
gives the same answer if wrong <BR>> catalog and schema is given like d=
bmd.getColumns(wrongCatalog, wrongSchema, <BR>> tableName, null). <BR>&g=
t; <BR>> You mentioned that I try dbmd.getColumns(null, null, null, null=
) to get a <BR>> list of all the columns in the database. Using four nul=
ls this way returns <BR>> an empty ResultSet. This might be the problem =
if the generator calls <BR>> getColumns(null, null, null, null) at some =
point (say, to get a feel for the <BR>> entire database). <BR>> <BR>&=
gt; <BR>> <BR>> On Thursday, October 25, 2012 1:12:31 PM UTC-7, Jeff =
Butler wrote: <BR>>> <BR>>> My best guess is that there is a pr=
oblem with the SQLite JDBC driver - <BR>>> either a bug or they have =
not implemented the <BR>>> DatabaseMetaData.getColumns() method. <BR>=
>> <BR>>> You can check it yourself with a small Java program. =
This is <BR>>> virtually what the generator does: <BR>>> =
<BR>>> Connection c =3D getConnection(); // you must write the =
getConnection <BR>>> method <BR>>> DatabaseMetaData dbmd =3D c.=
getMetaData(); <BR>>> ResultSet rs =3D dbmd.getColumns(catalog, schem=
a, table, null); <BR>>> <BR>>> If the ResultSet comes back empt=
y, then you'll see the message your <BR>>> are seeing. The driv=
er is not throwing an error, it's just returning <BR>>> nothing. &nbs=
p;So there is no better error information to display. <BR>>> <BR>>=
> You'll have to experiment with values for catalog, schema, and table <=
BR>>> to see if you can get something to come back, You can set=
all four <BR>>> parameters to null which should return information a=
bout every column <BR>>> in the database (a long list). That wo=
uld give you a clue as to what <BR>>> needs to be entered. <BR>>&g=
t; <BR>>> Another issue could be case sensitivity. If SQLite is=
case sensitive <BR>>> in the metadata then you will need to specify =
the proper case and set <BR>>> the table configuration to use delimit=
ed parameters. <BR>>> <BR>>> As for your other question about p=
assing in a create table statement, <BR>>> there is no support for th=
at in the generator. <BR>>> <BR>>> Jeff Butler <BR>>> <BR=
>>> <BR>>> On Thu, Oct 25, 2012 at 3:44 PM, cha <<A>cha...@g=
mail.com</A>> wrote: <BR>>> > Thanks, but I'm still having prob=
lems here. Do you know of anyone who <BR>>> > has <BR>>> >=
; gotten this to work with sqlite? <BR>>> > <BR>>> > What=
would help is more failure information. Is there a way to get more <=
BR>>> > about why the table isn't resolved from the generator? For=
example the <BR>>> > same <BR>>> > error is given if the=
database file testDB_DNE.sqlite doesn't exist as a <BR>>> > table=
, schema, or catalog that doesn't exist. <BR>>> > <BR>>> >=
; Another way to fix this might be to just hand feed the tables' "create <B=
R>>> > table <BR>>> > ..." or something like that to the =
generator instead of having it <BR>>> > instrospect. Is this possi=
ble? <BR>>> > <BR>>> > <BR>>> > On Friday, Octob=
er 19, 2012 11:20:45 AM UTC-7, Jeff Butler wrote: <BR>>> >> <BR=
>>> >> I'm not an SQLite user, so I don't know for sure. =
You might try <BR>>> >> setting schema to "testDB.sqlite". &nbs=
p;You might also try setting catalog <BR>>> >> to "testDB" and =
schema to "sqlite". It's really dependent on how they <BR>>> >>=
implemented the JDBC driver. <BR>>> >> <BR>>> >> J=
eff Butler <BR>>> >> <BR>>> >> On Fri, Oct 19, 2012=
at 1:55 PM, cha <<A>cha...@gmail.com</A>> wrote: <BR>>> >&g=
t; > Thanks for the reply. Originally, I left catalog and schema off and=
<BR>>> >> > got <BR>>> >> > <BR>>> >=
;> > "Generation Warnings Occured <BR>>> >> > T=
able configuration with catalog null, schema null, and table <BR>>> &=
gt;> > testTable <BR>>> >> > did not resolve to any ta=
bles" <BR>>> >> > <BR>>> >> > Which made me t=
hink I needed schema/catalog settings. The entire <BR>>> >> >=
; generatorConfig.xml is <BR>>> >> > <BR>>> >> &=
gt; <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <BR>>> >>=
> <!DOCTYPE generatorConfiguration PUBLIC "-//<A href=3D"http://myba=
tis.org//DTD" target=3D_blank>mybatis.org//DTD</A> MyBatis <BR>>> >=
;> > Generator Configuration 1.0//EN" <BR>>> >> > "<A =
href=3D"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd" target=3D_=
blank>http://mybatis.org/dtd/<WBR>mybatis-generator-config_1_0.<WBR>dtd</A>=
" > <BR>>> >> > <generatorConfiguration > <BR>>&=
gt; >> > <context id=3D"context"> <BR>>> >&g=
t; > <jdbcConnection driverClass=3D"org.sqlite.JDBC" <B=
R>>> >> > connectionURL=3D"jdbc:sqlite:<WBR>testDB.sqlite" u=
serId=3D"" password=3D"" <BR>>> >> >></jdbcConnection&=
gt; <BR>>> >> > <javaModelGenerator targetP=
ackage=3D"model" <BR>>> >> > targetProject=3D"test/src" <BR>=
>> >> >></javaModelGenerator> <BR>>> >>=
> <sqlMapGenerator targetPackage=3D"model" targetProje=
ct=3D"test/src" <BR>>> >> >></sqlMapGenerator> <BR>=
>> >> > <javaClientGenerator targetPackage=
=3D"model" targetProject=3D"test" <BR>>> >> > type=3D"XMLMAP=
PER" ></javaClientGenerator> <BR>>> >> > &nb=
sp; <table tableName=3D"afloatplantest" > <BR>>> >> > =
<BR>>> >> > <property name=3D"useAct=
ualColumnNames" value=3D"true"/> <BR>>> >> >  =
; </table> <BR>>> >> > </context> <BR>>=
;> >> > <BR>>> >> > <BR>>> >> > O=
n Friday, October 19, 2012 10:05:37 AM UTC-7, Jeff Butler wrote: <BR>>&g=
t; >> >> <BR>>> >> >> sqlite does not have ca=
talogs - leave that off. <BR>>> >> >> <BR>>> >&g=
t; >> Only use the schema if you create tables like schema.table_name=
. <BR>>> >> >> Else <BR>>> >> >> leave =
that off too. <BR>>> >> >> <BR>>> >> >>=
You probably only need to specify the tableName. <BR>>> >> >=
;> <BR>>> >> >> Jeff Butler <BR>>> >> >=
> <BR>>> >> >> <BR>>> >> >> On Fri, =
Oct 19, 2012 at 12:10 PM, cha <<A>cha...@gmail.com</A>> wrote: <BR>&g=
t;> >> >> > Hello, I am having a problem with MyBatis gen=
erator on sqlite. <BR>>> >> >> > When I try to generat=
e, I get <BR>>> >> >> > <BR>>> >> >>=
> "Generation Warnings Occured <BR>>> >> >> > &nbs=
p; Table configuration with catalog main, schema sqlite_master, and <BR>>=
;> >> >> > table <BR>>> >> >> > test=
Table did not resolve to any tables" <BR>>> >> >> > <B=
R>>> >> >> > The table config that I am using is <BR>&=
gt;> >> >> > <BR>>> >> >> > <tabl=
e catalog=3D"main" schema=3D"sqlite_master" tableName=3D"testTable" <BR>>=
;> >> >> > > <BR>>> >> >> >  =
; <property name=3D"useActualColumnNames" value=3D"true"/&=
gt; <BR>>> >> >> > </table> <BR>&g=
t;> >> >> > <BR>>> >> >> > I have al=
so tried variations like <BR>>> >> >> > <BR>>> &=
gt;> >> > <table catalog=3D"main" schema=3D"sqlite" tableNam=
e=3D"testTable" > <BR>>> >> >> > &nbs=
p; <property name=3D"useActualColumnNames" value=3D"true"/> <BR>>&=
gt; >> >> > </table> <BR>>> >&g=
t; >> > <BR>>> >> >> > <table schema=3D"sq=
lite" tableName=3D"testTable" > <BR>>> >> >> > &nbs=
p; <property name=3D"useActualColumnNames" value=3D"true"/=
> <BR>>> >> >> > </table> <BR>&=
gt;> >> >> > <BR>>> >> >> > Has anyo=
ne used succesfully used MyBatis generator with sqlite and <BR>>> >=
;> >> > know <BR>>> >> >> > the <BR>>&g=
t; >> >> > schema settings? <BR></BLOCKQUOTE>
------=_Part_167_30481157.1351210376336--
------=_Part_166_32593953.1351210376336--