Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion MyBatis generator with sqlite gives "did not resolve to any tables"

Date: Thu, 25 Oct 2012 16:37:42 -0700 (PDT)
From: cha <chaf...@gmail.com>
To: mybatis-user@googlegroups.com
Message-Id: <892d4721-8081-495c-9ad7-590d9bf335dc@googlegroups.com>
In-Reply-To: <CAKpaNj6AMwEu+sxCL3QGEGHbppdq0Oo0YruBqs99mkft1p0cfA@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>
Subject: Re: MyBatis generator with sqlite gives "did not resolve to any
 tables"
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_163_22543977.1351208262455"

------=_Part_163_22543977.1351208262455
Content-Type: multipart/alternative; 
	boundary="----=_Part_164_33545134.1351208262455"

------=_Part_164_33545134.1351208262455
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

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 <javascript:>> 
> 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//DTD MyBatis 
> >> > 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_164_33545134.1351208262455
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<DIV>Hmmm, if it uses getMetaData it should be fine. The ResultSet comes ba=
ck with the expected</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT size=3D2>
<P>null, null, tableName, col1Name, 12, TEXT, 2000000000 ...</P>
<P>for each column. Oddly enough it still gives the same answer if wrong ca=
talog and schema is given like dbmd.getColumns(wrongCatalog, wrongSchema, t=
ableName, null).</P>
<P>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 return=
s an empty ResultSet. This might be the problem if the generator calls getC=
olumns(null, null, null, null)&nbsp;at some point (say, to get a feel for t=
he entire database).</P></FONT><BR><BR>On Thursday, October 25, 2012 1:12:3=
1 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>My best guess is that there is a p=
roblem with the SQLite JDBC driver - <BR>either a bug or they have not impl=
emented the <BR>DatabaseMetaData.getColumns() method. <BR><BR>You can check=
 it yourself with a small Java program. &nbsp;This is <BR>virtually what th=
e generator does: <BR><BR>Connection c =3D getConnection(); &nbsp;// you mu=
st write the getConnection method <BR>DatabaseMetaData dbmd =3D c.getMetaDa=
ta(); <BR>ResultSet rs =3D dbmd.getColumns(catalog, schema, table, null); <=
BR><BR>If the ResultSet comes back empty, then you'll see the message your =
<BR>are seeing. &nbsp;The driver is not throwing an error, it's just return=
ing <BR>nothing. &nbsp;So there is no better error information to display. =
<BR><BR>You'll have to experiment with values for catalog, schema, and tabl=
e <BR>to see if you can get something to come back, &nbsp;You can set all f=
our <BR>parameters to null which should return information about every colu=
mn <BR>in the database (a long list). &nbsp;That would give you a clue as t=
o what <BR>needs to be entered. <BR><BR>Another issue could be case sensiti=
vity. &nbsp;If SQLite is case sensitive <BR>in the metadata then you will n=
eed to specify the proper case and set <BR>the table configuration to use d=
elimited parameters. <BR><BR>As for your other question about passing in a =
create table statement, <BR>there is no support for that in the generator. =
<BR><BR>Jeff Butler <BR><BR><BR>On Thu, Oct 25, 2012 at 3:44 PM, cha &lt;<A=
 href=3D"javascript:" target=3D_blank gdf-obfuscated-mailto=3D"2XCOTZrbLUkJ=
">cha...@gmail.com</A>&gt; wrote: <BR>&gt; Thanks, but I'm still having pro=
blems here. Do you know of anyone who has <BR>&gt; gotten this to work with=
 sqlite? <BR>&gt; <BR>&gt; What would help is more failure information. &nb=
sp;Is there a way to get more <BR>&gt; about why the table isn't resolved f=
rom the generator? For example the same <BR>&gt; error is given if the data=
base file testDB_DNE.sqlite doesn't exist as a <BR>&gt; table, schema, or c=
atalog that doesn't exist. <BR>&gt; <BR>&gt; Another way to fix this might =
be to just hand feed the tables' "create table <BR>&gt; ..." or something l=
ike that to the generator instead of having it <BR>&gt; instrospect. Is thi=
s possible? <BR>&gt; <BR>&gt; <BR>&gt; On Friday, October 19, 2012 11:20:45=
 AM UTC-7, Jeff Butler wrote: <BR>&gt;&gt; <BR>&gt;&gt; I'm not an SQLite u=
ser, so I don't know for sure. &nbsp;You might try <BR>&gt;&gt; setting sch=
ema to "testDB.sqlite". &nbsp;You might also try setting catalog <BR>&gt;&g=
t; to "testDB" and schema to "sqlite". It's really dependent on how they <B=
R>&gt;&gt; implemented the JDBC driver. <BR>&gt;&gt; <BR>&gt;&gt; Jeff Butl=
er <BR>&gt;&gt; <BR>&gt;&gt; On Fri, Oct 19, 2012 at 1:55 PM, cha &lt;<A>ch=
a...@gmail.com</A>&gt; wrote: <BR>&gt;&gt; &gt; Thanks for the reply. Origi=
nally, I left catalog and schema off and got <BR>&gt;&gt; &gt; <BR>&gt;&gt;=
 &gt; "Generation Warnings Occured <BR>&gt;&gt; &gt; &nbsp; Table configura=
tion with catalog null, schema null, and table <BR>&gt;&gt; &gt; testTable =
<BR>&gt;&gt; &gt; did not resolve to any tables" <BR>&gt;&gt; &gt; <BR>&gt;=
&gt; &gt; Which made me think I needed schema/catalog settings. The entire =
<BR>&gt;&gt; &gt; generatorConfig.xml is <BR>&gt;&gt; &gt; <BR>&gt;&gt; &gt=
; &lt;?xml version=3D"1.0" encoding=3D"UTF-8" ?&gt; <BR>&gt;&gt; &gt; &lt;!=
DOCTYPE generatorConfiguration PUBLIC "-//<A href=3D"http://mybatis.org//DT=
D" target=3D_blank>mybatis.org//DTD</A> MyBatis <BR>&gt;&gt; &gt; Generator=
 Configuration 1.0//EN" <BR>&gt;&gt; &gt; "<A href=3D"http://mybatis.org/dt=
d/mybatis-generator-config_1_0.dtd" target=3D_blank>http://mybatis.org/dtd/=
<WBR>mybatis-generator-config_1_0.<WBR>dtd</A>" &gt; <BR>&gt;&gt; &gt; &lt;=
generatorConfiguration &gt; <BR>&gt;&gt; &gt; &nbsp; &lt;context id=3D"cont=
ext"&gt; <BR>&gt;&gt; &gt; &nbsp; &nbsp; &lt;jdbcConnection driverClass=3D"=
org.sqlite.JDBC" <BR>&gt;&gt; &gt; connectionURL=3D"jdbc:sqlite:<WBR>testDB=
.sqlite" userId=3D"" password=3D"" <BR>&gt;&gt; &gt;&gt;&lt;/jdbcConnection=
&gt; <BR>&gt;&gt; &gt; &nbsp; &nbsp; &lt;javaModelGenerator targetPackage=
=3D"model" targetProject=3D"test/src" <BR>&gt;&gt; &gt;&gt;&lt;/javaModelGe=
nerator&gt; <BR>&gt;&gt; &gt; &nbsp; &nbsp; &lt;sqlMapGenerator targetPacka=
ge=3D"model" targetProject=3D"test/src" <BR>&gt;&gt; &gt;&gt;&lt;/sqlMapGen=
erator&gt; <BR>&gt;&gt; &gt; &nbsp; &nbsp; &lt;javaClientGenerator targetPa=
ckage=3D"model" targetProject=3D"test" <BR>&gt;&gt; &gt; type=3D"XMLMAPPER"=
 &gt;&lt;/javaClientGenerator&gt; <BR>&gt;&gt; &gt; &nbsp; &nbsp; &lt;table=
 tableName=3D"afloatplantest" &gt; <BR>&gt;&gt; &gt; <BR>&gt;&gt; &gt; &nbs=
p; &nbsp; &nbsp; &lt;property name=3D"useActualColumnNames" value=3D"true"/=
&gt; <BR>&gt;&gt; &gt; &nbsp; &nbsp; &lt;/table&gt; <BR>&gt;&gt; &gt; &nbsp=
; &lt;/context&gt; <BR>&gt;&gt; &gt; <BR>&gt;&gt; &gt; <BR>&gt;&gt; &gt; On=
 Friday, October 19, 2012 10:05:37 AM UTC-7, Jeff Butler wrote: <BR>&gt;&gt=
; &gt;&gt; <BR>&gt;&gt; &gt;&gt; sqlite does not have catalogs - leave that=
 off. <BR>&gt;&gt; &gt;&gt; <BR>&gt;&gt; &gt;&gt; Only use the schema if yo=
u create tables like schema.table_name. &nbsp;Else <BR>&gt;&gt; &gt;&gt; le=
ave that off too. <BR>&gt;&gt; &gt;&gt; <BR>&gt;&gt; &gt;&gt; You probably =
only need to specify the tableName. <BR>&gt;&gt; &gt;&gt; <BR>&gt;&gt; &gt;=
&gt; Jeff Butler <BR>&gt;&gt; &gt;&gt; <BR>&gt;&gt; &gt;&gt; <BR>&gt;&gt; &=
gt;&gt; On Fri, Oct 19, 2012 at 12:10 PM, cha &lt;<A>cha...@gmail.com</A>&g=
t; wrote: <BR>&gt;&gt; &gt;&gt; &gt; Hello, I am having a problem with MyBa=
tis generator on sqlite. <BR>&gt;&gt; &gt;&gt; &gt; When I try to generate,=
 I get <BR>&gt;&gt; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; "Generation Wa=
rnings Occured <BR>&gt;&gt; &gt;&gt; &gt; &nbsp; Table configuration with c=
atalog main, schema sqlite_master, and <BR>&gt;&gt; &gt;&gt; &gt; table <BR=
>&gt;&gt; &gt;&gt; &gt; testTable did not resolve to any tables" <BR>&gt;&g=
t; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; The table config that I am usin=
g is <BR>&gt;&gt; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; &lt;table catalo=
g=3D"main" schema=3D"sqlite_master" tableName=3D"testTable" &gt; <BR>&gt;&g=
t; &gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &lt;property name=3D"useActualColumnN=
ames" value=3D"true"/&gt; <BR>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; &lt;/tab=
le&gt; <BR>&gt;&gt; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; I have also tr=
ied variations like <BR>&gt;&gt; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; &=
lt;table catalog=3D"main" schema=3D"sqlite" tableName=3D"testTable" &gt; <B=
R>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; &nbsp; &lt;property name=3D"useActua=
lColumnNames" value=3D"true"/&gt; <BR>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; =
&lt;/table&gt; <BR>&gt;&gt; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; &lt;ta=
ble schema=3D"sqlite" tableName=3D"testTable" &gt; <BR>&gt;&gt; &gt;&gt; &g=
t; &nbsp; &nbsp; &nbsp; &lt;property name=3D"useActualColumnNames" value=3D=
"true"/&gt; <BR>&gt;&gt; &gt;&gt; &gt; &nbsp; &nbsp; &lt;/table&gt; <BR>&gt=
;&gt; &gt;&gt; &gt; <BR>&gt;&gt; &gt;&gt; &gt; Has anyone used succesfully =
used MyBatis generator with sqlite and <BR>&gt;&gt; &gt;&gt; &gt; know <BR>=
&gt;&gt; &gt;&gt; &gt; the <BR>&gt;&gt; &gt;&gt; &gt; schema settings? <BR>=
</BLOCKQUOTE>
------=_Part_164_33545134.1351208262455--

------=_Part_163_22543977.1351208262455--